Designing Mapping API 62/48562/4 mapping
authora.shulga <a.shulga@samsung.com>
Wed, 23 Sep 2015 02:15:05 +0000 (11:15 +0900)
committerchanywa <cbible.kim@samsung.com>
Fri, 5 Feb 2016 05:00:58 +0000 (14:00 +0900)
1. Fixed compillation errors
2. Synchronized with Maps Service v0.4.6
3. Synchronized with Mapping API v0.5.4

Signed-off-by: a.shulga <a.shulga@samsung.com>
Change-Id: I5300482122e09181a8c0dabdb2c4e06437813d0f

123 files changed:
.gitignore [new file with mode: 0644]
CMakeLists.txt
capi-maps-service.changes
doc/map_view_doc.h [new file with mode: 0644]
doc/maps_service_doc.h
include/map_event_data.h [new file with mode: 0644]
include/map_gesture.h [new file with mode: 0644]
include/map_object.h [new file with mode: 0644]
include/map_snapshot.h [new file with mode: 0644]
include/map_view.h [new file with mode: 0644]
include/maps_address.h
include/maps_area.h
include/maps_coordinates.h
include/maps_error.h
include/maps_extra_types.h
include/maps_place.h
include/maps_plugin.h
include/maps_plugin_types.h [new file with mode: 0755]
include/maps_preference.h
include/maps_route_maneuver.h
include/maps_service.h
packaging/capi-maps-service.spec
src/api/map_event_data.cpp [new file with mode: 0755]
src/api/map_object.cpp [new file with mode: 0644]
src/api/map_view.cpp [new file with mode: 0755]
src/api/maps_address.cpp
src/api/maps_area.cpp
src/api/maps_coordinates.cpp
src/api/maps_extra_types.cpp
src/api/maps_extra_types_private.h [new file with mode: 0644]
src/api/maps_place.cpp
src/api/maps_place_attribute.cpp
src/api/maps_place_category.cpp
src/api/maps_place_contact.cpp
src/api/maps_place_editorial.cpp
src/api/maps_place_filter.cpp
src/api/maps_place_image.cpp
src/api/maps_place_link_object.cpp
src/api/maps_place_media.cpp
src/api/maps_place_private.h
src/api/maps_place_rating.cpp
src/api/maps_place_review.cpp
src/api/maps_place_url.cpp
src/api/maps_plugin_info.cpp
src/api/maps_preference.cpp
src/api/maps_route.cpp
src/api/maps_route_maneuver.cpp
src/api/maps_route_private.h
src/api/maps_route_segment.cpp
src/api/maps_route_segment_private.h
src/api/maps_service.cpp
src/maps_util.h
src/plugin/empty_module.cpp
src/plugin/module.cpp
src/plugin/module.h
src/session/command.cpp
src/session/command.h
src/session/command_queue.cpp
src/session/command_queue.h
src/session/commands.cpp [changed mode: 0755->0644]
src/session/commands.h
src/view/gesture_detector.cpp [new file with mode: 0644]
src/view/gesture_detector.h [new file with mode: 0644]
src/view/gesture_detector_script.cpp [new file with mode: 0644]
src/view/gesture_detector_script.h [new file with mode: 0644]
src/view/gesture_detector_statemachine.cpp [new file with mode: 0644]
src/view/gesture_detector_statemachine.h [new file with mode: 0644]
src/view/gesture_processor.cpp [new file with mode: 0644]
src/view/gesture_processor.h [new file with mode: 0644]
src/view/inertial_camera.cpp [new file with mode: 0644]
src/view/inertial_camera.h [new file with mode: 0644]
src/view/inertial_gesture.cpp [new file with mode: 0644]
src/view/inertial_gesture.h [new file with mode: 0644]
src/view/marker_constructor.cpp [new file with mode: 0644]
src/view/marker_constructor.h [new file with mode: 0644]
src/view/poly_shape_hit_test.cpp [new file with mode: 0644]
src/view/poly_shape_hit_test.h [new file with mode: 0644]
src/view/polygon_constructor.cpp [new file with mode: 0644]
src/view/polygon_constructor.h [new file with mode: 0644]
src/view/polyline_constructor.cpp [new file with mode: 0644]
src/view/polyline_constructor.h [new file with mode: 0644]
src/view/route_constructor.cpp [new file with mode: 0644]
src/view/route_constructor.h [new file with mode: 0644]
src/view/runtime_data.cpp [new file with mode: 0644]
src/view/runtime_data.h [new file with mode: 0644]
test/CMakeLists.txt
test/capi-maps-service-test.efl [new file with mode: 0644]
test/capi-maps-service-test.manifest
test/capi-maps-service-test.xml [new file with mode: 0644]
test/dummy_plugin/CMakeLists.txt [new file with mode: 0644]
test/dummy_plugin/dummy_plugin.cpp
test/dummy_plugin/dummy_route_constructor.cpp [new file with mode: 0644]
test/dummy_plugin/dummy_route_constructor.h [new file with mode: 0644]
test/dummy_plugin/maps-plugin-test.manifest [new file with mode: 0644]
test/src/api/map_event_data_test.cpp [new file with mode: 0644]
test/src/api/map_event_data_test.h [new file with mode: 0644]
test/src/api/map_object_test.cpp [new file with mode: 0644]
test/src/api/map_object_test.h [new file with mode: 0644]
test/src/api/map_view_test.cpp [new file with mode: 0644]
test/src/api/map_view_test.h [new file with mode: 0644]
test/src/api/maps_api_test.cpp
test/src/api/maps_api_test.h
test/src/api/maps_extra_types_test.cpp
test/src/api/maps_extra_types_test.h
test/src/api/maps_place_test.cpp
test/src/api/maps_route_segment_test.cpp
test/src/api/maps_route_test.cpp
test/src/maps_service_test.cpp
test/src/session/command_queue_test.cpp
test/src/util/maps_object.cpp
test/src/util/maps_test_utils.cpp
test/src/view/gesture_test.cpp [new file with mode: 0644]
test/src/view/gesture_test.h [new file with mode: 0644]
test/src/view/marker_constructor_test.cpp [new file with mode: 0644]
test/src/view/marker_constructor_test.h [new file with mode: 0644]
test/src/view/poly_shape_hit_test_test.cpp [new file with mode: 0644]
test/src/view/poly_shape_hit_test_test.h [new file with mode: 0644]
test/src/view/polygon_constructor_test.cpp [new file with mode: 0644]
test/src/view/polygon_constructor_test.h [new file with mode: 0644]
test/src/view/polyline_constructor_test.cpp [new file with mode: 0644]
test/src/view/polyline_constructor_test.h [new file with mode: 0644]
test/src/view/route_constructor_test.cpp [new file with mode: 0644]
test/src/view/route_constructor_test.h [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..ec092a0
--- /dev/null
@@ -0,0 +1,5 @@
+*.[oa]
+*~
+*.bak
+*.old
+*.sh
index 2bfcf579c67bd5c4b0685f3ebbfe152882baa09c..c2144b7d5fa5d462b2a7f4ddffb75783187fc7cb 100644 (file)
@@ -1,6 +1,5 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
 SET(fw_name "capi-maps-service")
-SET(DUMMY_PLUGIN "maps-plugin-test")
 
 PROJECT(${fw_name})
 
@@ -13,17 +12,31 @@ SET(INTERNAL_INC_DIR
        src/api
        src/plugin
        src/session
-       test/dummy_plugin/
-       test/src/util/
+       src/view
        )
 INCLUDE_DIRECTORIES(${INC_DIR} ${INTERNAL_INC_DIR})
 
-SET(DUMMY_PLUGIN_SRC
-       test/dummy_plugin/dummy_plugin.cpp
-       test/src/util/maps_object.cpp
+SET(dependents
+       # Maps API dependencies
+       glib-2.0
+       gmodule-2.0
+       capi-base-common
+       dlog
+       capi-appfw-app-manager
+       capi-appfw-package-manager
+       pkgmgr-info
+       privacy-manager-client
+       capi-system-info
+
+       # Mapping API dependencies
+       eina
+       evas
+       ecore
+#      capi-appfw-application
+#      ecore
+#      ecore-evas
+#      elementary
        )
-
-SET(dependents "glib-2.0 gmodule-2.0 dlog capi-base-common")
 SET(pc_dependents "capi-base-common")
 
 INCLUDE(FindPkgConfig)
@@ -37,7 +50,7 @@ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror -fvisibi
 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
 
 #SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror -g -fPIC -fdump-rtl-expand -std=c++0x")
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror -fvisibility=hidden")
 SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
 
 IF("${ARCH}" STREQUAL "arm")
@@ -54,27 +67,19 @@ aux_source_directory(src SOURCES)
 aux_source_directory(src/api SOURCES_API)
 aux_source_directory(src/plugin SOURCES_PLUGIN)
 aux_source_directory(src/session SOURCES_SESSION)
-
+aux_source_directory(src/view SOURCES_SESSION)
 ADD_LIBRARY(${fw_name} SHARED ${SOURCES} ${SOURCES_API} ${SOURCES_PLUGIN} ${SOURCES_SESSION})
+
 TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS})
-SET_TARGET_PROPERTIES(${fw_name}
-       PROPERTIES
-       VERSION ${FULLVER}
-       SOVERSION ${MAJORVER}
-       CLEAN_DIRECT_OUTPUT 1
-       )
-INSTALL(TARGETS ${fw_name} DESTINATION ${LIBDIR})
 
-ADD_LIBRARY(${DUMMY_PLUGIN} SHARED ${DUMMY_PLUGIN_SRC})
-TARGET_LINK_LIBRARIES(${DUMMY_PLUGIN} ${fw_name} ${${DUMMY_PLUGIN}_LDFLAGS})
-SET_TARGET_PROPERTIES(${DUMMY_PLUGIN}
+SET_TARGET_PROPERTIES(${fw_name}
        PROPERTIES
        VERSION ${FULLVER}
        SOVERSION ${MAJORVER}
        CLEAN_DIRECT_OUTPUT 1
        )
-INSTALL(TARGETS ${DUMMY_PLUGIN} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/maps/plugins)
 
+INSTALL(TARGETS ${fw_name} DESTINATION ${LIBDIR})
 INSTALL(
        DIRECTORY ${INC_DIR}/ DESTINATION include/maps
        FILES_MATCHING
@@ -96,7 +101,17 @@ CONFIGURE_FILE(
        )
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIBDIR}/pkgconfig)
 
-ADD_SUBDIRECTORY(test)
+
+
+# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+# WARNING! FOR TESTING PURPOSES ONLY
+# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+#Please don't release the below comment when you submit.
+#Please release the below comment, if you want to test code in local.
+#It is not good for security and increases binary size.
+#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror -fvisibility=default")
+#ADD_SUBDIRECTORY(test)
 
 IF(UNIX)
 
index 5788da42b3c45b61448dc6228dc84f41a9b3bfe1..6b70d2f2e76704bcb5af2dab9da0c041f7fc2c43 100644 (file)
@@ -1,29 +1,84 @@
-[Version]   capi-location-manager_0.4.2
+[Version]   capi-maps-service_0.5.4
+[Date]      19 October 2015
+[Title]     Renamed map_view_marker_type_e to map_marker_type_e.
+[Developer] Alexey Shulga <a.shulga@samsung.com>
+
+[Version]   capi-maps-service_0.5.3
+[Date]      14 October 2015
+[Title]     Added map_object_create_group API.
+[Developer] Alexey Shulga <a.shulga@samsung.com>
+
+[Version]   capi-maps-service_0.5.2
+[Date]      13 October 2015
+[Title]     Made more clear API for setting Map View event callback and reaction on User Gesture.
+[Developer] Alexey Shulga <a.shulga@samsung.com>
+
+[Version]   capi-maps-service_0.5.1
+[Date]      06 October 2015
+[Title]     Adopted recommended Map Object Life Cycle: create - set/get - add to view; optimized API names.
+[Developer] Alexey Shulga <a.shulga@samsung.com>
+
+[Version]   capi-maps-service_0.5.0
+[Date]      23 September 2015
+[Title]     Added Mapping API.
+[Developer] Alexey Shulga <a.shulga@samsung.com>
+
+[Version]   capi-maps-service_0.4.6
+[Date]      16 September 2015
+[Title]     Added -fvisibility=hidden to make EXPORT_API useful.
+[Developer] Young-Ae Kang <youngae.kang@samsung.com>
+
+[Version]   capi-maps-service_0.4.5
+[Date]      14 September 2015
+[Title]     [Bug Fixes] Added missing EXPORT_API macros to maps_place_filter.cpp.
+[Developer] Alexey Shulga <a.shulga@samsung.com>
+
+[Version]   capi-maps-service_0.4.4
+[Date]      02 September 2015
+[Title]     [ACR-394] Two more privilege are needed.
+[Developer] Young-Ae Kang <youngae.kang@samsung.com>
+
+[Version]   capi-maps-service_0.4.3
+[Date]      27 July 2015
+[Title]     Corrected order of error checking in Maps Service API, added "maps-service" privilege checking
+[Developer] Alexey Shulga <a.shulga@samsung.com>
+
+[Version]   capi-maps-service_0.4.2
 [Date]      22 July 2015
 [Title]     Removed "resident" mode of plugin binaries; it allowed to release memory properly when many instances of Maps Service are used
 [Developer] Alexey Shulga <a.shulga@samsung.com>
 
-[Version]   capi-location-manager_0.4.1
+[Version]   capi-maps-service_0.4.1
 [Date]      17 July 2015
 [Title]     Changed parameter checks in Maps API requsts: preference allowed to be NULL
 [Developer] Alexey Shulga <a.shulga@samsung.com>
 
-[Version]   capi-location-manager_0.4.0
+[Version]   capi-maps-service_0.4.0
 [Date]      14 July 2015
 [Title]    [ACR-309] [2.4][capi-maps-service][Modify] Visibility of some APIs of Maps was changed
 [Developer] Young-Ae Kang <youngae.kang@samsung.com>
 
-[Version]   capi-location-manager_0.3.2
+[Version]   capi-maps-service_0.3.2
 [Date]      27 May 2015
 [Title]     [ACR-248][2.4][capi-maps-service][Modify] The name of API was changed.
 [Developer] Young-Ae Kang <youngae.kang@samsung.com>
 
-[Version]   capi-location-manager_0.3.1
+[Version]   capi-maps-service_0.3.1
 [Date]      14 April 2015
 [Title]     Sources prepared for Prevent analysis
 [Developer] Alexey Shulga <a.shulga@samsung.com>
 
-[Version]   capi-location-manager_0.3.0
+[Version]   capi-maps-service_0.3.0
 [Date]      09 April 2015
 [Title]     Initial release
 [Developer] Alexey Shulga <a.shulga@samsung.com>
+
+[Version]   capi-maps-service_0.2.0
+[Date]      21 December 2014
+[Title]     First working version
+[Developer] Alexey Shulga <a.shulga@samsung.com>
+
+[Version]   capi-maps-service_0.1.0
+[Date]      17 August 2014
+[Title]     Started Implementation
+[Developer] Alexey Shulga <a.shulga@samsung.com>
diff --git a/doc/map_view_doc.h b/doc/map_view_doc.h
new file mode 100644 (file)
index 0000000..1503607
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __MAP_VIEW_DOC_H__
+#define __MAP_VIEW_DOC_H__
+/**
+ * @ingroup    CAPI_LOCATION_FRAMEWORK
+ * @defgroup   CAPI_MAP_VIEW_MODULE Map View
+ *
+ * @brief      The Map View provides a visual map panel with basic
+ * interactive graphical user interface.
+ *
+ * @section    CAPI_MAP_VIEW_MODULE_HEADER Required Header
+ * \#include <map_view.h>
+
+ * @section    CAPI_MAP_VIEW_MODULE_OVERVIEW Overview
+ *
+ * The Map View provides a visual map panel with basic
+ * interactive graphical user interface.
+ */
+#endif /*__MAP_VIEW_DOC_H__ */
+
index 4012ac121a4200e98d51d465b0a3f54275334efd..177e17d86862b2756461857975831b21c9c87a15 100644 (file)
  *
  *  - Category Search: search for popular places for the given location context
  *  and matching the category filter criteria.
- *    You can refine your search request by secifying the categories of place
+ *    You can refine your search request by specifying the categories of place
  *    you are searching for.
  *
  * - Result item type of searching
- *  - id, name, location, distance, uri, rating, category.
+ *  - id, name, location, distance, URI, rating, category.
  *  .
  * - Place information allows to fetch details about a place. The following
  * place content is supported:
  *  closings, disabled access.
  *  .
  * .
+ * Snapshots
+ * - The Maps Snapshot API allows to capture a snapshot of the map with
+ * specified parameters:
+ *  - geographical coordinates of central map location
+ *  - zoom level
+ *  - orientation (rotation angle)
+ *  - width and height in pixels
+ *  - etc
+ *  .
+ * .
  * The developer is allowed to choose one of map providers by manipulating map
- * plugins.
+ * plug-ins.
  *
  * @if WEARABLE
  * @section    CAPI_MAPS_SERVICE_MODULE_FEATURE Related Features
  * This API is related with the following features:
  *  - http://tizen.org/feature/network.internet
  *
- * It is recommended to design feature related codes in your application for reliability.\n
+ * It is recommended to design feature related codes in your application for
+ * reliability.\n
  *
- * You can check if a devrice supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n
+ * You can check if a device supports the related features for this API by using
+ * @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of
+ * your application.\n
  *
- * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
+ * To ensure your application is only running on the device with specific
+ * features, please define the features in your manifest file using the manifest
+ * editor in the SDK.\n
  *
- * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
+ * More details on featuring your application can be found from
+ * <a href="https://developer.tizen.org/development/tools/native-tools/manifest-text-editor#feature"><b>Feature Element</b>.</a>
+ * @endif
  */
 
 #endif /*__MAPS_SERVICE_DOC_H__ */
diff --git a/include/map_event_data.h b/include/map_event_data.h
new file mode 100644 (file)
index 0000000..9c8ae5d
--- /dev/null
@@ -0,0 +1,644 @@
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __MAP_EVENT_DATA_H__
+#define __MAP_EVENT_DATA_H__
+
+/**
+ *
+ * @ingroup    CAPI_MAP_VIEW_MODULE
+ * @defgroup   CAPI_MAP_EVENT_MODULE Map View Event Data
+ *
+ * @file map_event_data.h
+ * @brief This file contains the functions related to Maps View Event Data
+ * information.
+ *
+ * @addtogroup CAPI_MAP_EVENT_MODULE
+ * @{
+ * @brief This provides APIs related to operations with Maps View Event Data
+ * @details Supported Event types are following:
+ *  * User gesture over the Map
+ *  * Map action,  such as zooming or rotation
+ *  * Object Event, such as pressing or moving
+ *  * View readiness
+ *  .
+ * @par Features available by Event Type
+ * The correspondence between the type of event and available event data
+ * is following:
+ * | Feature/Event Type                  | Gesture | Action | Object | Ready |
+ * | :---------------------------------- | :-----: | :----: | :----: | :---: |
+ * | #map_event_type_e                   | +       | +      | +      | +     |
+ * | #map_gesture_e                      | +       |        | +      |       |
+ * | #map_action_e                       |         | +      |        |       |
+ * | map_event_data_destroy()            | +       | +      | +      | +     |
+ * | map_event_data_clone()              | +       | +      | +      | +     |
+ * | map_event_data_get_type()           | +       | +      | +      | +     |
+ * | map_event_data_get_gesture_type()   | +       |        | +      |       |
+ * | map_event_data_get_action_type()    |         | +      |        |       |
+ * | map_event_data_get_center()         |         | +      |        |       |
+ * | map_event_data_get_delta()          |         | +      |        |       |
+ * | map_event_data_get_xy()             | +       |        | +      |       |
+ * | map_event_data_get_fingers()        | +       |        | +      |       |
+ * | map_event_data_get_zoom_factor()    | +       | +      |        |       |
+ * | map_event_data_get_rotation_angle() | +       | +      |        |       |
+ * | map_event_data_get_object()         |         |        | +      |       |
+ *
+ * Note: the event of type #MAP_EVENT_READY has no additional data besides the
+ * type.
+ *
+
+ */
+
+
+#include <map_object.h>
+#include <map_gesture.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+ * @brief      The Maps View Event data handle
+ * @details The handle of Maps View Event Data instance.
+ * @remarks To release the handle use map_event_data_destroy().
+ * \n To clone the handle use map_event_data_clone().
+ * @since_tizen 3.0
+ *
+ * @see map_event_data_destroy()
+ * @see map_event_data_clone()
+ */
+typedef void *map_event_data_h;
+
+/**
+ * @brief      Enumerations of map view actions
+ * @details This is an enumeration of actions map view is capable to perform.
+ * @since_tizen 3.0
+ * @remarks The view performs actions in response on user gestures, such as tap,
+ * zoom, long press, or APIs, such as set center or change zoom level.
+ * \n To re-assign view actions to user gestures use map_view_set_gesture_action().
+ *
+ * @see map_view_set_gesture_action()
+ * @see #map_gesture_e
+ */
+typedef enum _map_action_e {
+       /** Indicates the set center action */
+       MAP_ACTION_SCROLL,
+
+#ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+       /** Indicates the zoom action */
+       MAP_ACTION_ZOOM,
+
+       MAP_ACTION_ZOOM_IN,
+
+       MAP_ACTION_ZOOM_OUT,
+
+       MAP_ACTION_ZOOM_AND_SCROLL,
+
+       MAP_ACTION_ZOOM_AND_ROTATE,
+#else
+       /** Indicates the move center action */
+       MAP_ACTION_MOVE_CENTER,
+
+       /** Indicates the zoom action */
+       MAP_ACTION_ZOOM,
+#endif
+
+       /** Indicates the rotation action */
+       MAP_ACTION_ROTATE,
+
+       /** Indicates the empty action */
+       MAP_ACTION_NONE,
+} map_action_e;
+
+/**
+ * @brief      Enumerations of map event types
+ * @since_tizen 3.0
+ */
+typedef enum _map_event_type_e {
+       /** Indicates the gesture event callback */
+       MAP_EVENT_GESTURE,
+
+       /** Indicates the action callback */
+       MAP_EVENT_ACTION,
+
+       /** Indicates the object event callback */
+       MAP_EVENT_OBJECT,
+
+       /** Indicates the map view readiness callback */
+       MAP_EVENT_READY
+} map_event_type_e;
+
+
+/**
+ * @brief      Destroys the event data handle.
+ * @details This function destroys the event data handle and releases all its
+ * resources.
+ * @since_tizen 3.0
+ *
+ * @param[in]  event           The event data handle to destroy
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a event may be obtained in map_view_on_event_cb()
+ *
+ * @see #map_event_data_h
+ * @see map_event_data_clone()
+ */
+int map_event_data_destroy(map_event_data_h event);
+
+/**
+ * @brief      Clones the event handle.
+ * @details This function clones the event handle @a origin and all its
+ * resources.
+ * @since_tizen 3.0
+ * @remarks @a cloned must be released using map_event_data_destroy().
+ *
+ * @param[in]  origin          The original event handle
+ * @param[out] cloned          A cloned event handle
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a event may be obtained in map_view_on_event_cb()
+ *
+ * @see #map_event_data_h
+ * @see map_event_data_destroy()
+ * @see map_view_on_event_cb()
+ */
+int map_event_data_clone(const map_event_data_h origin,
+                        map_event_data_h *cloned);
+
+
+/**
+ * @brief      Gets the event type.
+ * @details This function gets the event type.
+ * @since_tizen 3.0
+ *
+ * @param[in]  event           The event data handle
+ * @param[out] event_type      The pointer to the  #map_event_type_e in which
+ * to store the event type
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a event may be obtained in map_view_on_event_cb()
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+static void map_view_event_cb(maps_error_e result,
+                             const map_event_type_e type,
+                             map_event_data_h event_data,
+                             void *user_data)
+{
+       LOG("map_view_event_cb enter");
+
+       map_gesture_e gesture_type = MAP_GESTURE_NONE;
+       map_action_e action_type = MAP_ACTION_NONE;
+
+       switch (type) {
+               case MAP_EVENT_GESTURE:
+               case MAP_EVENT_OBJECT:
+                       LOG("MAP_EVENT_GESTURE or MAP_EVENT_OBJECT");
+                       map_event_data_get_gesture_type(event_data,
+                                                       &gesture_type);
+                       switch (gesture_type) {
+                               case MAP_GESTURE_SCROLL:
+                                       LOG("MAP_GESTURE_SCROLL");
+                                       break;
+                               case MAP_GESTURE_TAP:
+                                       LOG("MAP_GESTURE_TAP");
+                                       break;
+                               case MAP_GESTURE_DOUBLE_TAP:
+                                       LOG("MAP_GESTURE_SCROLL");
+                                       break;
+                               case MAP_GESTURE_2_FINGER_TAP:
+                                       LOG("MAP_GESTURE_2_FINGER_TAP");
+                                       break;
+                               case MAP_GESTURE_LONG_PRESS:
+                                       LOG("MAP_GESTURE_LONG_PRESS");
+                                       break;
+                               case MAP_GESTURE_NONE:
+                               default:
+                                       LOG("default gesture_type");
+                                       break;
+                       }
+                       break;
+               case MAP_EVENT_ACTION:
+                       LOG("MAP_EVENT_ACTION");
+                       map_event_data_get_action_type(event_data,
+                                                      &action_type);
+                       switch (action_type) {
+                               case MAP_ACTION_SCROLL:
+                                       LOG("MAP_ACTION_SCROLL");
+                                       break;
+                               case MAP_ACTION_MOVE_CENTER:
+                                       LOG("MAP_ACTION_MOVE_CENTER");
+                                       break;
+                               case MAP_ACTION_ZOOM:
+                                       LOG("MAP_ACTION_ZOOM");
+                                       break;
+                               case MAP_ACTION_ROTATE:
+                                       LOG("MAP_ACTION_ROTATE");
+                                       break;
+                               case MAP_ACTION_NONE:
+                               default:
+                                       LOG("default action_type");
+                                       break;
+                       }
+                       break;
+               case MAP_EVENT_READY:
+                       LOG("MAP_EVENT_READY");
+                       break;
+               default:
+                       LOG("default type");
+                       break;
+       }
+       map_event_data_destroy(event_data);
+}
+ * @endcode
+ *
+ * @see #map_event_type_e
+ * @see map_view_on_event_cb()
+ * @see map_event_data_destroy()
+ * @see #map_event_data_h
+ * @see map_view_on_event_cb()
+ */
+int map_event_data_get_type(const map_event_data_h event,
+                           map_event_type_e *event_type);
+/**
+ * @brief      Gets the event gesture type.
+ * @details This function gets the event gesture type if the event type is
+ * #MAP_EVENT_GESTURE or returns the #MAPS_ERROR_NOT_SUPPORTED instead
+ * @since_tizen 3.0
+ *
+ * @param[in]  event           The event data handle
+ * @param[out] gesture_type    The pointer to the #map_gesture_e in which to
+ * store the gesture type
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval     #MAPS_ERROR_NOT_SUPPORTED The @a gesture_type value is not
+ * supported
+ *
+ * @pre @a event may be obtained in map_view_on_event_cb()
+ *
+ * @see map_event_data_get_type()
+ * @see #map_gesture_e
+ * @see #map_event_data_h
+ * @see map_view_on_event_cb()
+ */
+int map_event_data_get_gesture_type(map_event_data_h event,
+                                   map_gesture_e *gesture_type);
+/**
+ * @brief      Gets the event action type.
+ * @details This function gets the event action type if the event type is
+ * #MAP_EVENT_ACTION or returns the #MAPS_ERROR_NOT_SUPPORTED instead
+ * @since_tizen 3.0
+ *
+ * @param[in]  event           The event data handle
+ * @param[out] action_type     The pointer to the #map_action_e in which to
+ * store the action type
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval     #MAPS_ERROR_NOT_SUPPORTED The @a action_type value is not
+ * supported
+ *
+ * @pre @a event may be obtained in map_view_on_event_cb()
+ *
+ * @see map_event_data_get_type()
+ * @see #map_action_e
+ * @see #map_event_data_h
+ * @see map_view_on_event_cb()
+ */
+int map_event_data_get_action_type(map_event_data_h event,
+                                  map_action_e *action_type);
+
+/**
+ * @brief      Gets the new map center coordinates.
+ * @details This function gets the new map center coordinates if the event type
+ * is #MAP_EVENT_ACTION or returns the #MAPS_ERROR_NOT_SUPPORTED instead
+ * @since_tizen 3.0
+ *
+ * @param[in]  event           The event data handle
+ * @param[out] center          The pointer to the #maps_coordinates_h in which
+ * to store the new center coordinates
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval     #MAPS_ERROR_NOT_SUPPORTED The @a x and @a y values is not supported
+ *
+ * @pre @a event may be obtained in map_view_on_event_cb()
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// event obtained earlier in the map_view_on_event_cb
+
+int error = MAPS_ERROR_NONE;
+maps_coordinates_h center = NULL;
+
+// Getting coordinates of new center of the map
+error = map_event_data_get_center(event, &center);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+
+// Do something with center coordinates ...
+
+// Release coordinates
+maps_coordinates_destroy(center);
+ * @endcode
+ *
+ * @see map_event_data_get_type()
+ * @see #map_event_type_e
+ * @see #map_event_data_h
+ * @see #maps_coordinates_h
+ * @see map_view_on_event_cb()
+ */
+int map_event_data_get_center(map_event_data_h event,
+                             maps_coordinates_h *center);
+
+/**
+ * @brief      Gets the new map center movement coordinates delta.
+ * @details This function gets the screen coordinates delta of  map center
+ * movement if the event type is #MAP_EVENT_ACTION or returns the
+ * #MAPS_ERROR_NOT_SUPPORTED instead
+ * @since_tizen 3.0
+ *
+ * @param[in]  event           The event data handle
+ * @param[out] delta_x         The pointer to an integer in which to store the
+ * delta x
+ * @param[out] delta_y         The pointer to an integer in which to store the
+ * delta y
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval     #MAPS_ERROR_NOT_SUPPORTED The @a x and @a y values is not supported
+ *
+ * @pre @a event may be obtained in map_view_on_event_cb()
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// event obtained earlier in the map_view_on_event_cb
+
+int error = MAPS_ERROR_NONE;
+int delta_x = 0;
+int delta_y = 0;
+
+// Getting the delta coordinates of moved center of the map
+error = map_event_data_get_delta(event, &delta_x,  &delta_y);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see map_event_data_get_type()
+ * @see #map_event_type_e
+ * @see #map_event_data_h
+ * @see map_view_on_event_cb()
+ */
+int map_event_data_get_delta(map_event_data_h event,
+                            int *delta_x, int *delta_y);
+
+/**
+ * @brief      Gets the event screen coordinates.
+ * @details This function gets the event screen coordinates if the event type is
+ * #MAP_EVENT_GESTURE or returns the #MAPS_ERROR_NOT_SUPPORTED instead
+ * @since_tizen 3.0
+ *
+ * @param[in]  event           The event data handle
+ * @param[out] x               The pointer to an integer in which to store tha
+ * x coordinate of the event
+ * @param[out] y               The pointer to an integer in which to store the
+ * y coordinate of the event
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval     #MAPS_ERROR_NOT_SUPPORTED The @a x and @a y values is not
+ * supported
+ *
+ * @pre @a event may be obtained in map_view_on_event_cb()
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// event obtained earlier in the map_view_on_event_cb
+
+int error = MAPS_ERROR_NONE;
+int x = 0;
+int y = 0;
+
+// Getting screen coordinates of the event
+error = map_event_data_get_xy(event, &x, &y);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see map_event_data_get_type()
+ * @see #map_event_type_e
+ * @see #map_event_data_h
+ * @see map_view_on_event_cb()
+ */
+int map_event_data_get_xy(map_event_data_h event, int *x, int* y);
+
+/**
+ * @brief      Gets the number of fingers, detected in the event.
+ * @details This function gets the number of user's fingers, detected in the
+ * event, when the event type is #MAP_EVENT_GESTURE or returns the
+ * #MAPS_ERROR_NOT_SUPPORTED instead
+ * @since_tizen 3.0
+ *
+ * @param[in]  event           The event data handle
+ * @param[out] fingers         The pointer to an integer in which to store the
+ * number of fingers, detected in the gesture
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval     #MAPS_ERROR_NOT_SUPPORTED The @a fingers value is not supported
+ *
+ * @pre @a event may be obtained in map_view_on_event_cb()
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// event obtained earlier in the map_view_on_event_cb
+
+int error = MAPS_ERROR_NONE;
+int fingers = 0;
+
+// Getting the number of user's fingers
+error = map_event_data_get_fingers(event, &fingers);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see map_event_data_get_type()
+ * @see #map_event_type_e
+ * @see #map_event_data_h
+ * @see map_view_on_event_cb()
+ */
+int map_event_data_get_fingers(map_event_data_h event, int *fingers);
+
+/**
+ * @brief      Gets zoom factor of zoom gesture or action.
+ * @details When the event type is #MAP_EVENT_GESTURE or
+ * #MAP_EVENT_ACTION this function gets the corresponding zoom factor.
+ * Otherwise it returns #MAPS_ERROR_NOT_SUPPORTED.
+ * @since_tizen 3.0
+ *
+ * @param[in]  event           The event data handle
+ * @param[out] zoom_factor     The pointer to a double in which to store the
+ * zoom factor
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval     #MAPS_ERROR_NOT_SUPPORTED The @a zoom_factor value is not
+ * supported
+ *
+ * @pre @a event may be obtained in map_view_on_event_cb()
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// event obtained earlier in the map_view_on_event_cb
+
+int error = MAPS_ERROR_NONE;
+double zoom_factor = .0;
+
+// Getting the new zoom factor
+error = map_event_data_get_zoom_factor(event, &zoom_factor);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see map_event_data_get_type()
+ * @see #map_event_type_e
+ * @see #map_event_data_h
+ * @see map_view_on_event_cb()
+ */
+int map_event_data_get_zoom_factor(map_event_data_h event,
+                                  double *zoom_factor);
+
+/**
+ * @brief      Gets rotation angle of rotation gesture or action.
+ * @details When the event type is #MAP_EVENT_GESTURE or
+ * #MAP_EVENT_ACTION this function gets the corresponding rotation angle.
+ * Otherwise it returns #MAPS_ERROR_NOT_SUPPORTED.
+ * @since_tizen 3.0
+ *
+ * @param[in]  event           The event data handle
+ * @param[out] rotation_angle  The pointer to a double in which to store the
+ * rotation angle
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval     #MAPS_ERROR_NOT_SUPPORTED The @a rotation_angle value is not
+ * supported
+ *
+ * @pre @a event may be obtained in map_view_on_event_cb()
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// event obtained earlier in the map_view_on_event_cb
+
+int error = MAPS_ERROR_NONE;
+double rotation_angle = .0;
+
+// Getting the new rotation angle
+error = map_event_data_get_rotation_angle(event, &rotation_angle);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see map_event_data_get_type()
+ * @see #map_event_type_e
+ * @see #map_event_data_h
+ * @see map_view_on_event_cb()
+ */
+int map_event_data_get_rotation_angle(map_event_data_h event,
+                                     double *rotation_angle);
+
+/**
+ * @brief      Gets object of event.
+ * @details When the event type is  #MAP_EVENT_OBJECT this function gets
+ * the corresponding object handle.
+ * Otherwise it returns #MAPS_ERROR_NOT_SUPPORTED.
+ * @since_tizen 3.0
+ * @remarks The @a object must not be released.
+ *
+ * @param[in]  event           The event data handle
+ * @param[out] object          The pointer to #map_object_h in which to store
+ * the object handle
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval     #MAPS_ERROR_NOT_SUPPORTED The @a object value is not supported
+ * @see #map_object_h
+ *
+ * @pre @a event may be obtained in map_view_on_event_cb()
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// event obtained earlier in the map_view_on_event_cb
+
+int error = MAPS_ERROR_NONE;
+map_object_h object = NULL;
+
+// Getting the object, involved in the detected event
+error = map_event_data_get_object(event, &object);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see map_event_data_get_type()
+ * @see #map_event_type_e
+ * @see #map_event_data_h
+ * @see map_view_on_event_cb()
+ */
+int map_event_data_get_object(map_event_data_h event,
+                             map_object_h *object);
+
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif                         /* __MAP_EVENT_DATA_H__*/
diff --git a/include/map_gesture.h b/include/map_gesture.h
new file mode 100644 (file)
index 0000000..d96308f
--- /dev/null
@@ -0,0 +1,312 @@
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __MAP_GESTURE_H__
+#define __MAP_GESTURE_H__
+
+/**
+ *
+ * @ingroup    CAPI_MAP_VIEW_MODULE
+ * @defgroup   CAPI_MAP_GESTURE_MODULE User's Gestures
+ *
+ * @file map_gesture.h
+ * @brief This file contains functions related to user's gestures on the
+ * map view.
+ *
+ * @addtogroup CAPI_MAP_GESTURE_MODULE
+ * @{
+ * @brief This provides APIs related to operations with user's gestures on
+ * map view.
+ * @details The handle of gesture data is retrieved to the application
+ * via map_view_on_gesture_cb() callback when one of gesture types, listed in
+ * #map_gesture_e, occurs.
+ * \n To register and unregister the callback use
+ * map_view_set_gesture_cb() and map_view_unset_gesture_cb()
+ * respectively.
+ */
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+ * @brief      The user's gesture data handle
+ * @details The handle of user's gesture data instance which is retrieved via
+ * map_view_on_gesture_cb().
+ * @remarks To release the handle use map_gesture_destroy().
+ * \n To get the type of the gesture use map_gesture_get_type().
+ * @since_tizen 3.0
+ *
+ * @see map_gesture_destroy()
+ * @see map_view_on_gesture_cb().
+ */
+typedef void *map_gesture_h;
+
+
+/**
+ * @brief      Enumeration of user gestures over map view
+ * @since_tizen 3.0
+ */
+typedef enum _map_gesture_e {
+#ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+       MAP_GESTURE_SCROLL, /**< Indicates the move map user gesture */
+
+       MAP_GESTURE_ZOOM, /**< Indicates the zoom user gesture */
+
+       MAP_GESTURE_FLICK, /**< Indicates the flick user gesture */
+
+       MAP_GESTURE_TAP, /**< Indicates the tap user gesture */
+
+       MAP_GESTURE_DOUBLE_TAP, /**< Indicates the double tap user gesture */
+
+       MAP_GESTURE_2_FINGER_TAP, /**< Indicates the two-finger tap user
+                                   gesture */
+
+       MAP_GESTURE_SINGLE_FINGER_ZOOM, /**< Indicates the single finger zoom
+                                         user gesture (the gesture consist of
+                                         initial click and following pan) */
+
+       MAP_GESTURE_LONG_PRESS, /**< Indicates the long press user gesture */
+
+       MAP_GESTURE_NONE, /**< Indicates the empty gesture */
+#else
+       MAP_GESTURE_SCROLL, /**< Indicates the move map user gesture */
+
+       MAP_GESTURE_FLICK, /**< Indicates the flick user gesture */
+
+       MAP_GESTURE_PINCH, /**< Indicates the pinch user gesture */
+
+       MAP_GESTURE_TAP, /**< Indicates the tap user gesture */
+
+       MAP_GESTURE_DOUBLE_TAP, /**< Indicates the double tap user gesture */
+
+       MAP_GESTURE_2_FINGER_TAP, /**< Indicates the two-finger tap user
+                                   gesture */
+
+       MAP_GESTURE_ZOOM, /**< Indicates the zoom user gesture (performing with
+                           pinch) */
+
+       MAP_GESTURE_SINGLE_FINGER_ZOOM, /**< Indicates the single finger zoom
+                                         user gesture (the gesture consist of
+                                         initial click and following pan) */
+
+       MAP_GESTURE_ROTATE, /**< Indicates the rotate user gesture */
+
+       MAP_GESTURE_LONG_PRESS, /**< Indicates the long press user gesture */
+
+       MAP_GESTURE_NONE /**< Indicates the empty gesture */
+#endif
+} map_gesture_e;
+
+/**
+ * @brief      Destroys the gesture data handle.
+ * @details This function destroys the gesture data handle and releases all its
+ * resources.
+ * @since_tizen 3.0
+ *
+ * @param[in]  gesture         The gesture data handle to destroy
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a gesture may be obtained in map_view_on_gesture_cb()
+ *
+ * @see #map_gesture_h
+ * @see map_view_on_gesture_cb()
+ */
+int map_gesture_destroy(map_gesture_h gesture);
+
+/**
+ * @brief      Gets the gesture type.
+ * @details This function gets the gesture type.
+ * @since_tizen 3.0
+ *
+ * @param[in]  gesture         The gesture data handle
+ * @param[out] type            The pointer to the #map_gesture_e in which
+ * to store the gesture type
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a gesture may be obtained in map_view_on_gesture_cb()
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+static void map_view_gesture_cb(map_gesture_h gesture, void *user_data)
+{
+       map_gesture_e gesture_type = MAP_GESTURE_NONE;
+       map_gesture_get_type(gesture, &gesture_type);
+       switch (gesture_type) {
+               case MAP_GESTURE_SCROLL:
+                       LOG("MAP_GESTURE_SCROLL");
+                       break;
+               case MAP_GESTURE_TAP:
+                       LOG("MAP_GESTURE_TAP");
+                       break;
+               case MAP_GESTURE_DOUBLE_TAP:
+                       LOG("MAP_GESTURE_SCROLL");
+                       break;
+               case MAP_GESTURE_2_FINGER_TAP:
+                       LOG("MAP_GESTURE_2_FINGER_TAP");
+                       break;
+               case MAP_GESTURE_LONG_PRESS:
+                       LOG("MAP_GESTURE_LONG_PRESS");
+                       break;
+               case MAP_GESTURE_NONE:
+               default:
+                       LOG("default gesture type");
+                       break;
+       }
+       map_gesture_destroy(gesture);
+}
+ * @endcode
+ *
+ * @see #map_gesture_e
+ * @see map_gesture_get_fingers()
+ * @see map_gesture_get_zoom()
+ * @see map_gesture_get_rotation()
+ * @see map_view_on_gesture_cb()
+ */
+int map_gesture_get_type(const map_gesture_h gesture, map_gesture_e *type);
+
+
+/**
+ * @brief      Gets the number of fingers, detected in the gesture.
+ * @details This function gets the number of user's fingers, detected in the
+ * gesture.
+ * @since_tizen 3.0
+ *
+ * @param[in]  gesture         The gesture data handle
+ * @param[out] fingers         The pointer to an integer in which to store the
+ * number of fingers, detected in the gesture
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a gesture may be obtained in map_view_on_gesture_cb()
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// gesture obtained earlier in the map_view_on_gesture_cb()
+
+int error = MAPS_ERROR_NONE;
+int fingers = 0;
+
+// Getting the number of user's fingers
+error = map_gesture_get_fingers(gesture, &fingers);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see map_gesture_get_type()
+ * @see map_gesture_get_zoom()
+ * @see map_gesture_get_rotation()
+ * @see map_view_on_gesture_cb()
+ */
+int map_gesture_get_fingers(map_gesture_h gesture, int *fingers);
+
+/**
+ * @brief      Gets zoom factor of gesture.
+ * @details This function gets the zoom factor, set to the map in response on
+ * zoom gesture.
+ * @since_tizen 3.0
+ *
+ * @param[in]  gesture         The gesture data handle
+ * @param[out] zoom_factor     The pointer to a double in which to store the
+ * zoom factor
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a gesture may be obtained in map_view_on_gesture_cb()
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// gesture obtained earlier in the map_view_on_gesture_cb()
+
+int error = MAPS_ERROR_NONE;
+double zoom_factor = .0;
+
+// Getting the new zoom factor
+error = map_gesture_get_zoom(gesture, &zoom_factor);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see map_gesture_get_type()
+ * @see map_gesture_get_fingers()
+ * @see map_gesture_get_rotation()
+ * @see map_view_on_gesture_cb()
+ */
+int map_gesture_get_zoom(map_gesture_h gesture, double *zoom_factor);
+
+/**
+ * @brief      Gets rotation angle of gesture.
+ * @details This function gets the rotation angle, set to the map in response on
+ * rotation gesture.
+ * @since_tizen 3.0
+ *
+ * @param[in]  gesture         The gesture data handle
+ * @param[out] rotation_angle  The pointer to a double in which to store the
+ * rotation angle
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a gesture may be obtained in map_view_on_gesture_cb()
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// gesture obtained earlier in the map_view_on_gesture_cb()
+
+int error = MAPS_ERROR_NONE;
+double rotation_angle = .0;
+
+// Getting the new rotation angle
+error = map_gesture_get_rotation(gesture, &rotation_angle);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see map_gesture_get_type()
+ * @see map_gesture_get_zoom()
+ * @see map_gesture_get_fingers()
+ * @see map_view_on_gesture_cb()
+ */
+int map_gesture_get_rotation(map_gesture_h gesture, double *rotation_angle);
+
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif                         /* __MAP_GESTURE_H__*/
diff --git a/include/map_object.h b/include/map_object.h
new file mode 100644 (file)
index 0000000..ffcc7e0
--- /dev/null
@@ -0,0 +1,2063 @@
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __MAP_OBJECT_H__
+#define __MAP_OBJECT_H__
+
+#include <maps_service.h>
+#include <maps_coordinates.h>
+
+/**
+ * @ingroup    CAPI_MAP_VIEW_MODULE
+ * @defgroup   CAPI_MAP_OBJECTS_MODULE Maps View Objects
+ *
+ * @file map_object.h
+ * @brief This file contains the functions of Map Object API
+ *
+ * @addtogroup CAPI_MAP_OBJECTS_MODULE
+ * @{
+ * @brief This file contains the functions related to Map View Objects
+ * @details Supported Object types are following:
+ *  * Markers
+ *  * Polygons
+ *  * Polylines
+ *  * Group Objects
+ *  .
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*#define TIZEN_3_0_NEXT_MS*/
+
+/**
+ * @brief      The Map Visual Object handle
+ * @details The handle of an arbitrary visual object instance.
+ * @remarks The handle may be issued with one of following functions:
+ *  * map_object_create_marker()
+ *  * map_object_create_polygon()
+ *  * map_object_create_polyline()
+ *  * map_object_create_group()
+ * \n To release the handle use map_object_destroy().
+ * \n Note that when the object is added to Map View it will be released
+ * automatically when the Map View is destroyed
+ * @since_tizen 3.0
+ *
+ * @see map_object_destroy()
+ * @see map_view_add_object()
+ */
+typedef void *map_object_h;
+
+/**
+ * @brief      Enumerations of visual object types
+ * @since_tizen 3.0
+ */
+typedef enum _map_object_type_e {
+
+       /** Indicates the group of visual objects */
+       MAP_OBJECT_GROUP,
+
+       /** Indicates the polyline */
+       MAP_OBJECT_POLYLINE,
+
+       /** Indicates the polygon */
+       MAP_OBJECT_POLYGON,
+
+       /** Indicates the marker */
+       MAP_OBJECT_MARKER,
+
+#ifdef TIZEN_3_0_NEXT_MS
+       /** Indicates the route */
+       MAP_OBJECT_ROUTE,
+#endif /* TIZEN_3_0_NEXT_MS */
+
+       /** Indicates the unknown type of visual object */
+       MAP_OBJECT_UNKNOWN,
+} map_object_type_e;
+
+/**
+ * @brief      Enumerations of map marker types
+ * @since_tizen 3.0
+ */
+typedef enum _map_marker_type_e {
+#ifdef IMPROVEMENT_OF_VISUAL_OBJECTS
+       /** Indicates the pin marker type*/
+       MAP_MARKER_PIN,
+
+       /** Indicates the POI (Point of Interest)  marker type (temp)*/
+       MAP_MARKER_POI = MAP_MARKER_PIN,
+
+       /** Indicates the sticker marker type*/
+       MAP_MARKER_STICKER,
+#else
+/* REVIEW: You seem like defining the marker to display the origin and destination of route.
+It is not clear purpose.
+We had better redesing marker type. We can think bubble type, pin type, or etc..
+*/
+
+/* REDESIGN */
+#ifdef TIZEN_3_0_NEXT_MS
+       /** Indicates the start marker type*/
+       MAP_MARKER_START,
+
+       /** Indicates the finish marker type*/
+       MAP_MARKER_FINISH,
+
+       /** Indicates the "first" marker type*/
+       MAP_MARKER_FIRST,
+
+       /** Indicates the "second" marker type*/
+       MAP_MARKER_SECOND,
+
+       /** Indicates the favourite marker type*/
+       MAP_MARKER_FAVOURITE,
+
+       /** Indicates the construction marker type*/
+       MAP_MARKER_CONSTRUCTION,
+#endif /* TIZEN_3_0_NEXT_MS */
+
+       /** Indicates the POI (Point of Interest)  marker type*/
+       MAP_MARKER_POI,
+#endif
+       /** Indicates the empty marker type*/
+       MAP_MARKER_NONE,
+} map_marker_type_e;
+
+/* TODO: Mark it as "inhouse" API */
+/**
+ * @brief      Enumerations of operation types over the map view object
+ * @since_tizen 3.0
+ */
+typedef enum _map_object_operation_e {
+
+       /** Indicates the add object operation */
+       MAP_OBJECT_ADD,
+
+       /** Indicates the change object visibility operation */
+       MAP_OBJECT_SET_VISIBLE,
+
+       /** Indicates the move object operation */
+       MAP_OBJECT_MOVE,
+
+       /** Indicates the operation of changing object specific properties */
+       MAP_OBJECT_CHANGE,
+
+       /** Indicates the remove object operation */
+       MAP_OBJECT_REMOVE,
+
+       /** Indicates the remove all objects operation */
+       MAP_OBJECT_REMOVE_ALL,
+
+} map_object_operation_e;
+
+
+/**
+ * @brief      Called when requesting the list of visual objects of the group.
+ * @details This callback is invoked while iterating through the list of
+ * visual objects, added to the group.
+ * @since_tizen 3.0
+ * @remarks no need to release @a object.
+ *
+ * @param[in]  index           The current index of object
+ * @param[in]  total           The total amount of objects
+ * @param[in]  object          The visual object handle
+ * @param[in]  user_data       The user data pointer passed from
+ * map_object_group_foreach_object()
+ * @return     @c true to continue with the next iteration of the loop, \n @c
+ * false to break out of the loop
+ *
+ * @pre map_object_group_foreach_object() will invoke this callback.
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+static bool foreach_marker_cb(int index, int total,
+                                     map_object_h object,
+                                     void *user_data)
+{
+       if (!object)
+               return false;
+
+       map_object_type_e type = MAP_OBJECT_UNKNOWN;
+       int error = MAPS_ERROR_NONE;
+
+       // Extract the type of the object
+       error = map_object_get_type(object, &type);
+       if (error != MAPS_ERROR_NONE)
+               return false;
+
+       if (type != MAP_OBJECT_MARKER)
+               return true; // This is not a marker
+
+       // Do something...
+
+       // Continue iteration
+       return true;
+}
+ * @endcode
+ *
+ * @see #map_object_h
+ * @see map_object_group_foreach_object()
+ * @see map_object_group_add_object()
+ * @see map_object_group_remove_object()
+ */
+typedef bool(*map_object_group_object_cb) (int index, int total,
+                                          map_object_h object,
+                                          void *user_data);
+
+/**
+ * @brief      Called when requesting the list of points of the polyline.
+ * @details This callback is invoked while iterating through the list of
+ * points, added to the polyline.
+ * @since_tizen 3.0
+ * @remarks @a point must be released using maps_coordinates_destroy().
+ * \n To use @a point outside this function, clone it with
+ * maps_coordinates_clone().
+ *
+ * @param[in]  index           The current index of path point
+ * @param[in]  total           The total amount of path points
+ * @param[in]  point           The point
+ * @param[in]  user_data       The user data pointer passed from
+ * map_object_polyline_foreach_point()
+ * @return     @c true to continue with the next iteration of the loop, \n @c
+ * false to break out of the loop
+ *
+ * @pre map_object_polyline_foreach_point() will invoke this callback.
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+static bool path_point_cb(int index, int total,
+                         maps_coordinates_h point,
+                         void *user_data)
+{
+       double latitude = .0;
+       double longitude = .0;
+       int error = MAPS_ERROR_NONE;
+
+       // Get latitude and longitude of the current point
+       error = maps_coordinates_get_latitude_longitude(point, &latitude, &longitude);
+       if(error != MAPS_ERROR_NONE) {
+               // Handle the error
+       }
+
+       return true; // Continue iteration
+}
+ * @endcode
+ *
+ * @see map_object_polyline_foreach_point()
+ * @see #maps_coordinates_h
+ */
+typedef bool(*map_object_polyline_point_cb) (int index, int total,
+                                            maps_coordinates_h point,
+                                            void *user_data);
+
+
+/**
+ * @brief      Called when requesting the list of points of the polygon.
+ * @details This callback is invoked while iterating through the list of
+ * points, added to the polygon.
+ * @since_tizen 3.0
+ * @remarks @a point must be released using maps_coordinates_destroy().
+ * \n To use @a point outside this function, clone it with
+ * maps_coordinates_clone().
+ *
+ * @param[in]  index           The current index of path point
+ * @param[in]  total           The total amount of path points
+ * @param[in]  point           The point
+ * @param[in]  user_data       The user data pointer passed from
+ * map_object_polygon_foreach_point()
+ * @return     @c true to continue with the next iteration of the loop, \n @c
+ * false to break out of the loop
+ *
+ * @pre map_object_polygon_foreach_point() will invoke this callback.
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+static bool border_point_cb(int index, int total,
+                           maps_coordinates_h point,
+                           void *user_data)
+{
+       double latitude = .0;
+       double longitude = .0;
+       int error = MAPS_ERROR_NONE;
+
+       // Get latitude and longitude of the current point
+       error = maps_coordinates_get_latitude_longitude(point, &latitude, &longitude);
+       if(error != MAPS_ERROR_NONE) {
+               // Handle the error
+       }
+
+       return true; // Continue iteration
+}
+ * @endcode
+ *
+ * @see map_object_polygon_foreach_point()
+ * @see #maps_coordinates_h
+ */
+typedef bool(*map_object_polygon_point_cb) (int index, int total,
+                                           maps_coordinates_h point,
+                                           void *user_data);
+
+
+/*----------------------------------------------------------------------------*/
+/*
+ * Common Visual Object Features
+ */
+
+
+/**
+ * @brief      Creates a marker visual object.
+ * @details This function creates a marker on a given geographical coordinates.
+ * The marker is specified with a given image file and a type.
+ * @since_tizen 3.0
+ * @remarks @a marker can be released by using map_object_destroy().
+ * \n If added to the Map View using map_view_add_object(), @a marker will be
+ * released automatically when the Map View is destroyed.
+ *
+ * @param[in]  coordinates     The geographical coordinates to add marker on
+ * @param[in]  image_file_path The file name with the image for the marker
+ * @param[in]  type            The type of the marker, one of listed in
+ * map_marker_type_e
+ * @param[out] marker          The handle of newly created marker
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a coordinates are created using map_coordinates_create().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+int error = MAPS_ERROR_NONE;
+map_object_h marker = NULL;
+maps_coordinates_h coordinates = NULL;
+
+
+// Obtain a geographical position to put a marker
+error = maps_coordinates_create(39.929386, 23.696087, &coordinates);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the create coordinates error
+}
+
+// Create an instance of a marker
+error = map_object_create_marker(coordinates,
+                               "resources/marker_icon.png",
+                               MAP_MARKER_POI,
+                               &marker);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the create marker error
+}
+
+// Release coordinates
+maps_coordinates_destroy(coordinates);
+ * @endcode
+ *
+ * @see #map_object_h
+ * @see #map_marker_type_e
+ * @see map_object_create_polygon()
+ * @see map_object_create_polyline()
+ * @see map_object_create_group()
+ * @see map_view_add_object()
+ * @see map_object_destroy()
+ * @see #maps_coordinates_h
+ */
+int map_object_create_marker(const maps_coordinates_h coordinates,
+                            const char *image_file_path,
+                            const map_marker_type_e type,
+                            map_object_h *marker);
+
+
+#ifdef TIZEN_3_0_NEXT_MS
+/**
+ * @brief      Creates a route visual object.
+ * @details This function creates a visual object group, representing the route,
+ * specified with @a route parameter.
+ * @since_tizen 3.0
+ * @remarks @a route_object will be released by map view.
+ *
+ * @param[in]  view            The view handle
+ * @param[in]  route           The route data
+ * @param[out] route_object    The added route handle
+ * @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 map_view_create().
+ *
+ * @see map_view_create()
+ * @see #map_object_h
+ * @see #maps_route_h
+ */
+
+/*
+REVIEW: The API is not clear. Moreover, we had better add route related API in the next MS.
+*/
+
+int map_object_create_route(const maps_route_h route,
+                           map_object_h *route_object);
+#endif /* TIZEN_3_0_NEXT_MS */
+
+/**
+ * @brief      Creates a polyline visual object.
+ * @details This function creates a polyline visual object, specified
+ * with a list of geographical coordinates, line width and color.
+ * @since_tizen 3.0
+ * @remarks @a polyline can be released by using map_object_destroy().
+ * \n If added to the Map View using map_view_add_object(), @a polyline will be
+ * released automatically when the Map View is destroyed.
+ *
+ * @param[in]  coordinates     The list of geographical coordinates
+ * @param[in]  r               The red component of polyline color
+ * @param[in]  g               The green component of polyline color
+ * @param[in]  b               The blue component of polyline color
+ * @param[in]  a               The alpha  component of polyline color
+ * @param[in]  width           The width of line
+ * @param[out] polyline        The handle of newly added polyline
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a coordinates is created using maps_coordinates_list_create().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+int error = MAPS_ERROR_NONE;
+map_object_h polyline = NULL;
+maps_coordinates_list_h coordinates = NULL;
+maps_coordinates_h c = NULL;
+
+// Prepare a list of polyline coordinates
+error = maps_coordinates_list_create(&coordinates);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the create coordinate list error
+}
+
+double latitudes[] = {40.206056, 40.140998, 40.123673, 40.087435, 40.042768,
+       40.003331, 39.978080, 39.934394, 39.929129, 39.915964};
+double longitudes[] = {23.327389, 23.363781, 23.412533, 23.437939, 23.479137,
+       23.564281, 23.665905, 23.688564, 23.743496, 23.742809};
+for(int i = 0; i < sizeof(latitudes) / sizeof(latitudes[0])) {
+       maps_coordinates_create(latitudes[i], longitudes[i], &c);
+       maps_coordinates_list_append(coordinates, c);
+}
+
+// Create an instance of a polyline
+error = map_object_create_polyline(coordinates, 255, 242, 0, 255, &polyline);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the create polyline error
+}
+
+// Release coordinates
+maps_coordinates_list_destroy(coordinates);
+ * @endcode
+ *
+ * @see #map_object_h
+ * @see map_object_create_marker()
+ * @see map_object_create_polygon()
+ * @see map_object_create_group()
+ * @see map_view_add_object()
+ * @see map_object_destroy()
+ * @see #maps_coordinates_list_h
+ * @see maps_coordinates_list_create()
+ */
+int map_object_create_polyline(const maps_coordinates_list_h coordinates,
+                              const unsigned char r,
+                              const unsigned char g,
+                              const unsigned char b,
+                              const unsigned char a,
+                              const int width,
+                              map_object_h *polyline);
+
+/**
+ * @brief      Create a polygon visual object.
+ * @details This function creates a polygon visual object, specified
+ * with a list of geographical coordinates and fill color.
+ * @since_tizen 3.0
+ * @remarks @a polygon can be released by using map_object_destroy().
+ * \n If added to the Map View using map_view_add_object(), @a polygon will be
+ * released automatically when the Map View is destroyed.
+ *
+ * @param[in]  coordinates     The list of geographical coordinates
+ * @param[in]  r               The red component of polygon background color
+ * @param[in]  g               The green component of polygon background color
+ * @param[in]  b               The blue component of polygon background color
+ * @param[in]  a               The alpha  component of polygon background color
+ * @param[out] polygon         The handle of newly created polygon
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a coordinates is created using maps_coordinates_list_create().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+int error = MAPS_ERROR_NONE;
+map_object_h polygon = NULL;
+maps_coordinates_list_h coordinates = NULL;
+maps_coordinates_h c = NULL;
+
+// Prepare a list of polygon coordinates
+error = maps_coordinates_list_create(&coordinates);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the create coordinate list error
+}
+
+double latitudes[] = {11.990638, 11.998026, 11.981234, 11.969983, 11.954029,
+       11.956045, 11.946976, 11.941098, 11.940426, 11.965785, 11.982074};
+double longitudes[] = {121.907848, 121.925873, 121.929478, 121.926903,
+       121.937717, 121.945442, 121.947330, 121.942009, 121.934456,
+       121.921581, 121.908878};
+for(int i = 0; i < sizeof(latitudes) / sizeof(latitudes[0])) {
+       maps_coordinates_create(latitudes[i], longitudes[i], &c);
+       maps_coordinates_list_append(coordinates, c);
+}
+
+// Create an instance of a polygon
+error = map_object_create_polygon(coordinates, 255, 242, 0, 255, &polygon);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the create polygon error
+}
+
+// Release coordinates
+maps_coordinates_list_destroy(coordinates);
+ * @endcode
+ *
+ * @see #map_object_h
+ * @see map_object_create_marker()
+ * @see map_object_create_polyline()
+ * @see map_object_create_group()
+ * @see map_view_add_object()
+ * @see map_object_destroy()
+ * @see #maps_coordinates_list_h
+ * @see maps_coordinates_list_create()
+ */
+int map_object_create_polygon(const maps_coordinates_list_h coordinates,
+                             const unsigned char r,
+                             const unsigned char g,
+                             const unsigned char b,
+                             const unsigned char a,
+                             map_object_h *polygon);
+
+/**
+ * @brief      Creates a group of visual objects.
+ * @details This function creates a group of visual objects.
+ * @since_tizen 3.0
+ * @remarks @a group can be released by using map_object_destroy().
+ * \n If added to the Map View using map_view_add_object(), @a group will be
+ * released automatically when the Map View is destroyed.
+ *
+ * @param[out] group           The handle of newly added group
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_object_h path is created ahead using map_object_create_polyline;
+// map_object_h marker_start and marker_finish are created ahead
+// using map_object_create marker;
+
+int error = MAPS_ERROR_NONE;
+map_object_h route = NULL;
+
+// Create an instance of a route as an object group
+error = map_object_create_group(&route);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the create group error
+}
+
+// Composing a route out of the path, start and stop markers
+error = map_object_group_add_object(route, path);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the add to group error
+}
+error = map_object_group_add_object(group, marker_start);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the add to group error
+}
+error = map_object_group_add_object(group, marker_finish);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the add to group error
+}
+ * @endcode
+ *
+ * @see #map_object_h
+ * @see map_object_create_marker()
+ * @see map_object_create_polyline()
+ * @see map_object_create_group()
+ * @see map_object_group_add_object()
+ * @see map_view_add_object()
+ * @see map_object_destroy()
+ * @see #maps_coordinates_list_h
+ * @see maps_coordinates_list_create()
+ */
+int map_object_create_group(map_object_h *group);
+
+
+
+/**
+ * @brief      Destroys the object.
+ * @details This function destroys the object handle and releases all its
+ * resources.
+ * @since_tizen 3.0
+ *
+ * @param[in]  object          The object handle to destroy
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see #map_object_h
+ * @see map_object_create_marker()
+ * @see map_object_create_polygon()
+ * @see map_object_create_polyline()
+ * @see map_object_create_group()
+ */
+int map_object_destroy(map_object_h object);
+
+/**
+ * @brief      Gets the object type.
+ * @details This function gets the object type.
+ * @since_tizen 3.0
+ *
+ * @param[in]  object          The object handle
+ * @param[out] type            The pointer to #map_object_type_e in which to
+ * store the object type
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a object is created using map_object_create_marker(),
+ * map_object_create_polyline(), map_object_create_polygon() or
+ * map_object_create_group().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_object_h object is created ahead
+
+int error = MAPS_ERROR_NONE;
+map_object_type_e type = MAP_OBJECT_UNKNOWN;
+
+// Fetching a type of the object
+error = map_object_get_type(object, &type);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see #map_object_h
+ * @see map_object_create_marker()
+ * @see map_object_create_polyline()
+ * @see map_object_create_polygon()
+ * @see map_object_create_group()
+ */
+/*
+I recondiderate map_object API, netherless we have to provider create API.
+Tizen object's life cyle is creating, getting, foreach, and destroying...
+Please see other CAPIs.
+
+After creating object with create(), you have to get properites.
+*/
+int map_object_get_type(const map_object_h object,
+                       map_object_type_e *type);
+
+/**
+ * @brief      Moves the object to specified geographical coordinates.
+ * @details This function moves the object on the map to specified geographical
+ * coordinates.
+ * @since_tizen 3.0
+ *
+ * @param[in]  object          The object handle
+ * @param[in]  coordinates     The coordinates to move the object to
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a object is created using map_object_create_marker(),
+ * map_object_create_polyline(), map_object_create_polygon() or
+ * map_object_create_group().
+ * @pre @a coordinates are created using maps_coordinates_create(),
+ *
+ * @see #map_object_h
+ * @see map_object_create_marker()
+ * @see map_object_create_polyline()
+ * @see map_object_create_polygon()
+ * @see map_object_create_group()
+ * @see maps_coordinates_create()
+ */
+int map_object_move(map_object_h object,
+                   const maps_coordinates_h coordinates);
+
+/**
+ * @brief      Shows the object.
+ * @details This function changes the visibility of the given object on the map
+ * view.
+ * @since_tizen 3.0
+ *
+ * @param[in]  object          The object handle
+ * @param[in]  visible         The new visibility of the object
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a object is created using map_object_create_marker(),
+ * map_object_create_polyline(), map_object_create_polygon() or
+ * map_object_create_group().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_object_h object is created ahead
+
+int error = MAPS_ERROR_NONE;
+
+// Hiding the object on the view
+error = map_object_set_visible(object, false);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see #map_object_h
+ * @see map_object_get_visible()
+ */
+int map_object_set_visible(map_object_h object, const bool visible);
+
+/**
+ * @brief      Gets the object visibility.
+ * @details This function retrieves whether or not the given object is visible.
+ * @since_tizen 3.0
+ *
+ * @param[in]  object          The object handle
+ * @param[out] visible         The pointer to a boolean in which to store the
+ * object visibility
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a object is created using map_object_create_marker(),
+ * map_object_create_polyline(), map_object_create_polygon() or
+ * map_object_create_group().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_object_h object is created ahead
+
+int error = MAPS_ERROR_NONE;
+bool visible = false;
+
+// Obtaining the visibility of the object
+error = map_object_get_visible(object, &visible);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see #map_object_h
+ * @see map_object_set_visible()
+ */
+int map_object_get_visible(map_object_h object, bool *visible);
+
+/*----------------------------------------------------------------------------*/
+/*
+ * Group
+ */
+
+/**
+ * @brief      Adds an arbitrary visual object in the group.
+ * @details This function adds an arbitrary visual object in the group.
+ * @since_tizen 3.0
+ *
+ * @param[in]  group           The group object handle
+ * @param[in]  object          The object handle to add
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a group is created using map_object_create_group().
+ * @pre @a object is created using map_object_create_marker(),
+ * map_object_create_polyline(), map_object_create_polygon() or
+ * map_object_create_group().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_object_h route is created ahead using map_object_create_group;
+// map_object_h path is created ahead using map_object_create_polyline;
+// map_object_h marker_start and marker_finish are created ahead
+// using map_object_create marker;
+
+int error = MAPS_ERROR_NONE;
+
+// Composing a route out of the path, start and stop markers
+error = map_object_group_add_object(route, path);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the add to group error
+}
+error = map_object_group_add_object(group, marker_start);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the add to group error
+}
+error = map_object_group_add_object(group, marker_finish);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the add to group error
+}
+ * @endcode
+ *
+ * @see #map_object_h
+ * @see map_object_create_marker()
+ * @see map_object_create_polyline()
+ * @see map_object_create_polygon()
+ * @see map_object_create_group()
+ * @see map_object_group_foreach_object()
+ * @see map_object_group_remove_object()
+ */
+/*
+REVIEW: We will support group for real map groups such as 2D, traffic, satellite, and terrain.
+object word is repeately. Please change the name.
+Please change the name of API.
+*/
+int map_object_group_add_object(map_object_h group,
+                               const map_object_h object);
+
+/**
+ * @brief      Removes a visual object from the group.
+ * @details This function removes a visual object from the group.
+ * @since_tizen 3.0
+ *
+ * @param[in]  group           The group object handle
+ * @param[in]  object          The object handle to remove
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a group is created using map_object_create_group().
+ * @pre @a object is created using map_object_create_marker(),
+ * map_object_create_polyline(), map_object_create_polygon() or
+ * map_object_create_group().
+ *
+ * @see #map_object_h
+ * @see map_object_create_marker()
+ * @see map_object_create_polyline()
+ * @see map_object_create_polygon()
+ * @see map_object_create_group()
+ * @see map_object_group_add_object()
+ * @see map_object_group_foreach_object()
+ */
+
+int map_object_group_remove_object(map_object_h group, map_object_h object);
+
+/**
+ * @brief      Retrieves all visual objects, added to the group.
+ * @details This function retrieves all visual objects, added to the group.
+ * @since_tizen 3.0
+ * @remarks The objects will be delivered via map_object_group_object_cb().
+ *
+ * @param[in]  group           The group object handle
+ * @param[in]  callback        The callback function to invoke
+ * @param[in]  user_data       The user data pointer to be passed to the
+ * callback function
+ * @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_FOUND Result not found
+ * @retval     #MAPS_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @pre @a group is created using map_object_create_group().
+ * @post This function invokes map_object_group_object_cb() repeatedly to
+ * retrieve each visual object.
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_object_h group is created ahead
+
+static bool foreach_marker_cb(int index, int total,
+                             map_object_h object,
+                             void *user_data)
+{
+       if (!object)
+               return false;
+
+       map_object_type_e type = MAP_OBJECT_UNKNOWN;
+       int error = MAPS_ERROR_NONE;
+
+       // Extract the type of the object
+       error = map_object_get_type(object, &type);
+       if (error != MAPS_ERROR_NONE)
+               return false;
+
+       if (type != MAP_OBJECT_MARKER)
+               return true; // This is not a marker
+
+       // Do something...
+
+       // Continue iteration
+       return true;
+}
+
+static void process_markers()
+{
+       const int error = map_object_group_foreach_object(group,
+                                                         foreach_marker_cb,
+                                                         NULL);
+       if (error != MAPS_ERROR_NONE) {
+               // Handle the error
+       }
+       return error;
+}
+ * @endcode
+ *
+ * @see map_object_create_group()
+ * @see map_object_group_object_cb()
+ * @see map_object_group_add_object()
+ * @see map_object_group_remove_object()
+ */
+int map_object_group_foreach_object(const map_object_h group,
+                                   map_object_group_object_cb callback,
+                                   void* user_data);
+
+
+/*----------------------------------------------------------------------------*/
+/*
+ * Polyline
+ */
+
+/**
+ * @brief      Adds a point to the polyline.
+ * @details This function adds a point to the polyline.
+ * @since_tizen 3.0
+ *
+ * @param[in]  polyline        The polyline object handle
+ * @param[in]  point           The point handle to add
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a polyline is created using map_object_create_polyline().
+ * @pre @a coordinates are created using maps_coordinates_create().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_object_h path is created ahead using map_object_create_polyline;
+
+int error = MAPS_ERROR_NONE;
+maps_coordinates_h point = NULL;
+
+// Create a point to add to the path
+error = maps_coordinates_create(50.073482, 14.427961, &point);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the create coordinates error
+}
+
+// Appending a point to the path
+error = map_object_polyline_add_point(path, point);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the add to polyline error
+}
+
+// Release the coordinates handle
+maps_coordinates_destroy(point);
+ * @endcode
+ *
+ * @see #map_object_h
+ * @see #maps_coordinates_h
+ * @see map_object_create_polyline()
+ * @see maps_coordinates_create()
+ * @see map_object_polyline_set_polyline()
+ * @see map_object_polyline_foreach_point()
+ */
+
+/*
+REVIEW: I think we don't need this API.
+If a developer need a new polyline, developer can call map_object_create_polygon() and map_object_set_polyline().
+As you defined API, a developer, after removing polyline and the adding polyline.
+
+Don't use _poly_. It is different between polyline and polygon. You have to check when you create polygon, polygon is created with locations.
+Please see location code. It has the checking routine.
+
+API Name have to be clear like below:
+map_object_create_polyline()
+map_object_create_polygon()
+
+*/
+int map_object_polyline_add_point(map_object_h polyline,
+                                 const maps_coordinates_h point);
+
+/**
+ * @brief      Sets points to the polyline.
+ * @details This function sets point list to the polyline.
+ * @since_tizen 3.0
+ *
+ * @param[in]  polyline        The polyline object handle
+ * @param[in]  points          The points to set
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a polyline is created using map_object_create_polyline().
+ * @pre @a points are created using maps_coordinates_list_create().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_object_h polyline is created ahead using map_object_create_polyline.
+
+int error = MAPS_ERROR_NONE;
+maps_coordinates_list_h coordinates = NULL;
+maps_coordinates_h c = NULL;
+
+// Prepare a list of polyline coordinates
+error = maps_coordinates_list_create(&coordinates);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+
+double latitudes[] = {40.206056, 40.140998, 40.123673, 40.087435, 40.042768,
+       40.003331, 39.978080, 39.934394, 39.929129, 39.915964};
+double longitudes[] = {23.327389, 23.363781, 23.412533, 23.437939, 23.479137,
+       23.564281, 23.665905, 23.688564, 23.743496, 23.742809};
+for(int i = 0; i < sizeof(latitudes) / sizeof(latitudes[0])) {
+       maps_coordinates_create(latitudes[i], longitudes[i], &c);
+       maps_coordinates_list_append(coordinates, c);
+}
+
+// Set a list of points to the polyline
+error = map_object_polyline_set_polyline(polyline, coordinates);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+
+// Release coordinates
+maps_coordinates_list_destroy(coordinates);
+ * @endcode
+ *
+ * @see map_object_create_polyline()
+ * @see #map_object_h
+ * @see #maps_coordinates_list_h
+ * @see maps_coordinates_list_create()
+ * @see map_object_polyline_add_point()
+ * @see map_object_polyline_foreach_point()
+ */
+/*
+REVIEW: maps_item_list API is not for public API, but it is platform API.
+Please don't use it. Please public CAPI such as eina_list. Don't provide redundant data structure API.
+If you want to provide list as a prarameter, please define wrapping API.
+*/
+int map_object_polyline_set_polyline(map_object_h polyline,
+                                    const maps_coordinates_list_h points);
+
+
+/**
+ * @brief      Retrieves all points, added to the polyline.
+ * @details This function retrieves all points, added to the polyline.
+ * @since_tizen 3.0
+ * @remarks The points will be delivered via map_object_polyline_point_cb().
+ *
+ * @param[in]  polyline        The polyline object handle
+ * @param[in]  callback        The callback function to invoke
+ * @param[in]  user_data       The user data pointer to be passed to the
+ * callback function
+ * @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_FOUND Result not found
+ * @retval     #MAPS_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @pre @a polyline is created using map_object_create_polyline().
+ * @post This function invokes map_object_polyline_point_cb() repeatedly to
+ * retrieve each point.
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_object_h path is created ahead using map_object_create_polyline.
+
+static bool path_point_cb(int index, int total,
+                         maps_coordinates_h point,
+                         void *user_data)
+{
+       double latitude = .0;
+       double longitude = .0;
+       int error = MAPS_ERROR_NONE;
+
+       // Get latitude and longitude of the current point
+       error = maps_coordinates_get_latitude_longitude(point, &latitude, &longitude);
+       if(error != MAPS_ERROR_NONE) {
+               // Handle the error
+       }
+
+       return true; // Continue iteration
+}
+
+static void move_through_path()
+{
+       int error = MAPS_ERROR_NONE;
+
+       // Iterate through the path
+       error = map_object_polyline_foreach_point(path, path_point_cb, NULL);
+       if(error != MAPS_ERROR_NONE) {
+               // Handle the error
+       }
+}
+ * @endcode
+ *
+ * @see map_object_polyline_point_cb()
+ * @see map_object_create_polyline()
+ * @see #map_object_h
+ * @see map_object_polyline_add_point()
+ * @see map_object_polyline_set_polyline()
+ */
+/*
+REVIEW: As I told you your before, maps_item_list API is not for public API, but it is platform API.
+Please don't use it. Please public CAPI such as eina_list. Don't provide redundant data structure API.
+If you want to provide list as a prarameter, please define wrapping API.
+*/
+int map_object_polyline_foreach_point(map_object_h polyline,
+                                     maps_coordinates_cb callback,
+                                     void *user_data);
+
+/**
+ * @brief      Sets the polyline color.
+ * @details This function sets the polyline color on canvas.
+ * @since_tizen 3.0
+ *
+ * @param[in]  polyline        The polyline object handle
+ * @param[in]  r               The red component of the color
+ * @param[in]  g               The green component of the color
+ * @param[in]  b               The blue component of the color
+ * @param[in]  a               The alpha component of the color
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a polyline is created using map_object_create_polyline().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_object_h polyline is created ahead using map_object_create_polyline.
+
+int error = MAPS_ERROR_NONE;
+
+// Change the color of the polyline
+error = map_object_polyline_set_color(polyline, 0xC0, 0xFF, 0xEE, 0xFF);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see map_object_polyline_get_color()
+ * @see map_object_polyline_set_width()
+ * @see map_object_create_polyline()
+ */
+int map_object_polyline_set_color(map_object_h polyline,
+                                 const unsigned char r,
+                                 const unsigned char g,
+                                 const unsigned char b,
+                                 const unsigned char a);
+
+/**
+ * @brief      Gets the polyline color.
+ * @details This function gets the polyline color on canvas.
+ * @since_tizen 3.0
+ *
+ * @param[in]  polyline        The polyline object handle
+ * @param[out] r               The unsigned char pointer in which to store the
+ * red component of the color, or NULL if not interested
+ * @param[out] g               The unsigned char pointer in which to store the
+ * green component of the color, or NULL if not interested
+ * @param[out] b               The unsigned char pointer in which to store the
+ * blue component of the color, or NULL if not interested
+ * @param[out] a               The unsigned char pointer in which to store the
+ * alpha component of the color, or NULL if not interested
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a polyline is created using map_object_create_polyline().
+ * @pre color components may be previously set using
+ * map_object_polyline_set_color().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_object_h polyline is created ahead using map_object_create_polyline.
+
+int error = MAPS_ERROR_NONE;
+unsigned char r = 0;
+unsigned char g = 0;
+unsigned char b = 0;
+
+// Get the color components of the polyline
+error = map_object_polyline_get_color(polyline, &r, &g, &b, NULL);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see map_object_polyline_set_color()
+ * @see map_object_polyline_get_width()
+ * @see map_object_create_polyline()
+ */
+int map_object_polyline_get_color(const map_object_h polyline,
+                                 unsigned char *r,
+                                 unsigned char *g,
+                                 unsigned char *b,
+                                 unsigned char *a);
+
+/**
+ * @brief      Sets the polyline width.
+ * @details This function sets the polyline width on canvas.
+ * @since_tizen 3.0
+ *
+ * @param[in]  polyline        The polyline object handle
+ * @param[in]  width           The new width
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a polyline is created using map_object_create_polyline().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_object_h polyline is created ahead using map_object_create_polyline.
+
+int error = MAPS_ERROR_NONE;
+
+// Change the width of the polyline
+error = map_object_polyline_set_width(polyline, 5);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see map_object_polyline_get_width()
+ * @see map_object_polyline_set_color()
+ * @see map_object_create_polyline()
+ */
+int map_object_polyline_set_width(map_object_h polyline, const int width);
+
+/**
+ * @brief      Gets the polyline width.
+ * @details This function gets the polyline width on canvas.
+ * @since_tizen 3.0
+ *
+ * @param[in]  polyline        The polyline object handle
+ * @param[out] width           The width
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a polyline is created using map_object_create_polyline().
+ * @pre @a width may be previously set using map_object_polyline_set_width().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_object_h polyline is created ahead using map_object_create_polyline.
+
+int error = MAPS_ERROR_NONE;
+int width = 0;
+
+// Get the width of the polyline
+error = map_object_polyline_get_width(polyline, &width);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see map_object_polyline_set_width()
+ * @see map_object_polyline_get_color()
+ * @see map_object_create_polyline()
+ */
+int map_object_polyline_get_width(const map_object_h polyline, int *width);
+
+
+/*----------------------------------------------------------------------------*/
+/*
+ * Polygon
+ */
+
+/**
+ * @brief      Adds a point to the polygon.
+ * @details This function adds a point to the polygon.
+ * @since_tizen 3.0
+ *
+ * @param[in]  polygon         The polygon object handle
+ * @param[in]  point           The point handle to add
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a polygon is created using map_object_create_polygon().
+ * @pre @a coordinates are created using maps_coordinates_create().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_object_h border is created ahead using map_object_create_polygon;
+
+int error = MAPS_ERROR_NONE;
+maps_coordinates_h point = NULL;
+
+// Create a point to add to the border
+error = maps_coordinates_create(50.073482, 14.427961, &point);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the create coordinates error
+}
+
+// Appending a point to the border
+error = map_object_polygon_add_point(border, point);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the add to polygon error
+}
+
+// Release the coordinates handle
+maps_coordinates_destroy(point);
+ * @endcode
+ *
+ * @see #map_object_h
+ * @see #maps_coordinates_h
+ * @see map_object_create_polygon()
+ * @see maps_coordinates_create()
+ * @see map_object_polygon_set_polygon()
+ * @see map_object_polygon_foreach_point()
+ */
+/*
+REVIEW: I think we don't need this API.
+If a developer need a new polyline, developer can call map_object_create_polygon() and map_object_set_polyline().
+As you defined API, a developer, after removing polyline and the adding polyline.
+
+Don't use _poly_. It is different between polyline and polygon. You have to check when you create polygon, polygon is created with locations.
+Please see location code. It has the checking routine.
+
+API Name have to be clear like below:
+map_object_create_polyline()
+map_object_create_polygon()
+
+*/
+int map_object_polygon_add_point(map_object_h polygon,
+                                const maps_coordinates_h point);
+
+/**
+ * @brief      Sets points to the polygon.
+ * @details This function sets point list to the polygon.
+ * @since_tizen 3.0
+ *
+ * @param[in]  polygon         The polygon object handle
+ * @param[in]  points          The points to set
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a polygon is created using map_object_create_polygon().
+ * @pre @a points are created using maps_coordinates_list_create().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_object_h polygon is created ahead using map_object_create_polygon.
+
+int error = MAPS_ERROR_NONE;
+maps_coordinates_list_h coordinates = NULL;
+maps_coordinates_h c = NULL;
+
+// Prepare a list of polygon coordinates
+error = maps_coordinates_list_create(&coordinates);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the create coordinate list error
+}
+
+double latitudes[] = {11.990638, 11.998026, 11.981234, 11.969983, 11.954029,
+       11.956045, 11.946976, 11.941098, 11.940426, 11.965785, 11.982074};
+double longitudes[] = {121.907848, 121.925873, 121.929478, 121.926903,
+       121.937717, 121.945442, 121.947330, 121.942009, 121.934456,
+       121.921581, 121.908878};
+for(int i = 0; i < sizeof(latitudes) / sizeof(latitudes[0])) {
+       maps_coordinates_create(latitudes[i], longitudes[i], &c);
+       maps_coordinates_list_append(coordinates, c);
+}
+
+// Set a list of points to the polygon
+error = map_object_polygon_set_polygon(polygon, coordinates);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+
+// Release coordinates
+maps_coordinates_list_destroy(coordinates);
+ * @endcode
+ *
+ * @see map_object_create_polygon()
+ * @see #map_object_h
+ * @see #maps_coordinates_list_h
+ * @see maps_coordinates_list_create()
+ * @see map_object_polygon_add_point()
+ * @see map_object_polygon_foreach_point()
+ */
+/*
+REVIEW: maps_item_list API is not for public API, but it is platform API.
+Please don't use it. Please public CAPI such as eina_list. Don't provide redundant data structure API.
+If you want to provide list as a prarameter, please define wrapping API.
+*/
+int map_object_polygon_set_polygon(map_object_h polygon,
+                                   const maps_coordinates_list_h points);
+
+
+/**
+ * @brief      Retrieves all points, added to the polygon.
+ * @details This function retrieves all points, added to the polygon.
+ * @since_tizen 3.0
+ * @remarks The objects will be delivered via map_object_polygon_point_cb().
+ *
+ * @param[in]  polygon         The polygon object handle
+ * @param[in]  callback        The callback function to invoke
+ * @param[in]  user_data       The user data to be passed to the
+ * callback function
+ * @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_FOUND Result not found
+ * @retval     #MAPS_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @pre @a polygon is created using map_object_create_polygon().
+ * @post This function invokes map_object_polygon_point_cb() repeatedly to
+ * retrieve each point.
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_object_h border is created ahead using map_object_create_polygon.
+
+static bool border_point_cb(int index, int total,
+                           maps_coordinates_h point,
+                           void *user_data)
+{
+       double latitude = .0;
+       double longitude = .0;
+       int error = MAPS_ERROR_NONE;
+
+       // Get latitude and longitude of the current point
+       error = maps_coordinates_get_latitude_longitude(point, &latitude, &longitude);
+       if(error != MAPS_ERROR_NONE) {
+               // Handle the error
+       }
+
+       return true; // Continue iteration
+}
+
+static void move_along_border()
+{
+       int error = MAPS_ERROR_NONE;
+
+       // Iterate through the path
+       error = map_object_polygon_foreach_point(border, border_point_cb, NULL);
+       if(error != MAPS_ERROR_NONE) {
+               // Handle the error
+       }
+}
+ * @endcode
+ *
+ * @see map_object_polygon_point_cb()
+ * @see map_object_create_polygon()
+ * @see #map_object_h
+ * @see map_object_polygon_add_point()
+ * @see map_object_polygon_set_polygon()
+ */
+/*
+REVIEW: As I told you your before, maps_item_list API is not for public API, but it is platform API.
+Please don't use it. Please public CAPI such as eina_list. Don't provide redundant data structure API.
+If you want to provide list as a prarameter, please define wrapping API.
+*/
+int map_object_polygon_foreach_point(map_object_h polygon,
+                                    maps_coordinates_cb callback,
+                                    void *user_data);
+/**
+ * @brief      Sets polygon fill color.
+ * @details This function sets the polygon fill color on canvas.
+ * @since_tizen 3.0
+ *
+ * @param[in]  polygon         The polygon object handle
+ * @param[in]  r               The red component of the fill color
+ * @param[in]  g               The green component of the fill color
+ * @param[in]  b               The blue component of the fill color
+ * @param[in]  a               The alpha component of the fill color
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a polygon is created using map_object_create_polygon().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_object_h polygon is created ahead using map_object_create_polygon.
+
+int error = MAPS_ERROR_NONE;
+
+// Change the fill color of the polygon
+error = map_object_polygon_set_fill_color(polygon, 0xC0, 0xFF, 0xEE, 0xFF);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see map_object_polygon_get_fill_color()
+ * @see map_object_create_polygon()
+ */
+int map_object_polygon_set_fill_color(map_object_h polygon,
+                                     const unsigned char r,
+                                     const unsigned char g,
+                                     const unsigned char b,
+                                     const unsigned char a);
+
+/**
+ * @brief      Gets polygon fill color.
+ * @details This function gets the polygon fill color on canvas.
+ * @since_tizen 3.0
+ *
+ * @param[in]  polygon         The polygon data handle
+ * @param[in]  r               The unsigned char pointer in which to store the
+red component of the background color
+ * @param[in]  g               The unsigned char pointer in which to store the
+green component of the background color
+ * @param[in]  b               The unsigned char pointer in which to store the
+blue component of the background color
+ * @param[in]  a               The unsigned char pointer in which to store the
+alpha component of the background color
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a polygon is created using map_object_create_polygon().
+ * @pre fill color components may be previously set using
+ * map_object_polygon_set_fill_color().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_object_h polygon is created ahead using map_object_create_polygon.
+
+int error = MAPS_ERROR_NONE;
+unsigned char r = 0;
+unsigned char g = 0;
+unsigned char b = 0;
+
+// Get the fill color components of the polygon
+error = map_object_polygon_get_color(polygon, &r, &g, &b, NULL);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see map_object_polygon_set_fill_color()
+ * @see map_object_create_polygon()
+ */
+int map_object_polygon_get_fill_color(const map_object_h polygon,
+                                     unsigned char *r,
+                                     unsigned char *g,
+                                     unsigned char *b,
+                                     unsigned char *a);
+
+
+/*----------------------------------------------------------------------------*/
+/*
+ * Marker
+ */
+
+/**
+ * @brief      Sets the marker coordinates.
+ * @details This function sets the marker geographical coordinates.
+ * @since_tizen 3.0
+ *
+ * @param[in]  marker          The marker object handle
+ * @param[in]  coordinates     The marker geographical coordinates handle
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a marker is created using map_object_create_marker().
+ * @pre @a coordinates are created using maps_coordinates_create().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_object_h marker is created ahead using map_object_create_marker;
+
+int error = MAPS_ERROR_NONE;
+maps_coordinates_h point = NULL;
+
+// Create a point to set as marker coordinates
+error = maps_coordinates_create(50.073482, 14.427961, &point);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the create coordinates error
+}
+
+// Set marker coordinates
+error = map_object_marker_set_coordinates(marker, point);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+
+// Release the coordinates handle
+maps_coordinates_destroy(point);
+ * @endcode
+ *
+ * @see map_object_create_marker()
+ * @see map_object_marker_get_coordinates()
+ * @see #maps_coordinates_h
+ * @see maps_coordinates_create()
+ */
+int map_object_marker_set_coordinates(map_object_h marker,
+                                     const maps_coordinates_h coordinates);
+
+/**
+ * @brief      Sets the marker screen size.
+ * @details This function sets the marker screen size.
+ * @since_tizen 3.0
+ *
+ * @param[in]  marker          The marker object handle
+ * @param[in]  screen_width    The marker width on the screen
+ * @param[in]  screen_height   The marker height on the screen
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a marker is created using map_object_create_marker().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_object_h marker is created ahead using map_object_create_marker;
+
+int error = MAPS_ERROR_NONE;
+
+// Set marker screen size
+error = map_object_marker_resize(marker, 50, 50);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see map_object_create_marker()
+ * @see map_object_marker_get_size()
+ */
+/*
+REVIEW: I don't know what this API does.
+Maker's size is decided height and width. If a developer want to change the size, a developer will call resize().
+If we don't provide resize API, we have to provide it.
+*/
+int map_object_marker_resize(map_object_h marker,
+                            const int screen_width,
+                            const int screen_height);
+/**
+ * @brief      Sets the marker image file path.
+ * @details This function sets the marker image file path.
+ * @since_tizen 3.0
+ *
+ * @param[in]  marker          The marker object handle
+ * @param[in]  file_path       The marker image file path
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a marker is created using map_object_create_marker().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_object_h marker is created ahead using map_object_create_marker;
+
+int error = MAPS_ERROR_NONE;
+
+// Set marker image file path
+error = map_object_marker_set_image_file(marker, "resources/maker_icon.png");
+if (error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see map_object_marker_get_image_file()
+ * @see map_object_create_marker()
+ */
+/*
+REVIEW: evas_object can be our reference. I don't mean that we following evas_object...
+map_object_marker_set_image_file is better.
+*/
+int map_object_marker_set_image_file(map_object_h marker,
+                                    const char *file_path);
+
+#if 0
+/* TO BE REMOVED */
+/**
+ * @brief      Sets the marker type.
+ * @details This function sets the marker type.
+ * @since_tizen 3.0
+ *
+ * @param[in]  marker          The marker object handle
+ * @param[in]  type            The marker type
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a marker is created using map_object_create_marker().
+ *
+ * @see map_object_create_marker()
+ * @see #map_marker_type_e
+ */
+
+/*
+REVIEW: I think we don't need this API.
+When marker is created, market type is decided. The market type is not changed.
+map_object_marker_set_image_file is better.
+*/
+
+int map_object_marker_set_type(map_object_h marker,
+                              const map_marker_type_e type);
+#endif
+
+/* TODO: Check if marker text is supported by map provider */
+/**
+ * @brief      Sets the marker text.
+ * @details This function sets the marker text.
+ * @since_tizen 3.0
+ *
+ * @param[in]  marker          The marker object handle
+ * @param[in]  text            The marker text
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a marker is created using map_object_create_marker().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_object_h marker is created ahead using map_object_create_marker;
+
+int error = MAPS_ERROR_NONE;
+
+// Set marker text
+error = map_object_marker_set_text(marker, "Destination");
+if (error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see map_object_marker_get_text()
+ * @see map_object_create_marker()
+ */
+
+/*
+REVIEW: I heard that HERE didn't support text
+Please check it
+*/
+int map_object_marker_set_text(map_object_h marker,
+                              const char *text);
+
+/**
+ * @brief      Gets the marker coordinates.
+ * @details This function gets the marker geographical coordinates.
+ * @since_tizen 3.0
+ *
+ * @param[in]  marker          The marker object handle
+ * @param[out] coordinates     The pointer to #maps_coordinates_h in which to
+ * store the marker geographical coordinates
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a marker is created using map_object_create_marker().
+ * @pre @a coordinates may be set previously using
+ * map_object_marker_set_coordinates().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_object_h marker is created ahead using map_object_create_marker;
+
+int error = MAPS_ERROR_NONE;
+maps_coordinates_h point = NULL;
+
+// Fetch the geographical coordinates of a marker
+error = map_object_marker_get_coordinates(marker, &point);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+
+// Do something with coordinates...
+
+// Release the coordinates handle
+maps_coordinates_destroy(point);
+ * @endcode
+ *
+ * @see map_object_marker_set_coordinates()
+ * @see #maps_coordinates_h
+ * @see map_object_create_marker()
+ */
+int map_object_marker_get_coordinates(const map_object_h marker,
+                                     maps_coordinates_h *coordinates);
+
+/**
+ * @brief      Gets the marker screen size.
+ * @details This function gets the marker size on the screen.
+ * @since_tizen 3.0
+ *
+ * @param[in]  marker          The marker object handle
+ * @param[out] width           The pointer to an integer in which to store the
+ * marker width on the screen
+ * @param[out] height          The pointer to an integer in which to store the
+ * marker height on the screen
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a marker is created using map_object_create_marker().
+ * @pre @a width ind @a height may be set previously using
+ * map_object_marker_resize().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_object_h marker is created ahead using map_object_create_marker;
+
+int error = MAPS_ERROR_NONE;
+int width = 0;
+int height = 0;
+
+// Get marker screen size
+error = map_object_marker_get_size(marker, &width, &height);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see map_object_marker_resize()
+ * @see map_object_create_marker()
+ */
+
+/*
+REVIEW: Same as above about screen_size.
+*/
+int map_object_marker_get_size(map_object_h marker,
+                              int *width,
+                              int *height);
+
+/**
+ * @brief      Gets the marker image file path.
+ * @details This function gets the marker image file path.
+ * @since_tizen 3.0
+ *
+ * @param[in]  marker          The marker object handle
+ * @param[out] file_path       The marker image file path
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a marker is created using map_object_create_marker().
+ * @pre @a file_path may be set previously using
+ * map_object_marker_set_image_file().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_object_h marker is created ahead using map_object_create_marker;
+
+int error = MAPS_ERROR_NONE
+char *image_file = NULL;
+
+// Get marker image file path
+error = map_object_marker_get_image_file(marker, &image_file);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+
+// Do something with image_file...
+
+free(image_file);
+ * @endcode
+ *
+ * @see map_object_marker_set_image_file()
+ * @see map_object_create_marker()
+ */
+/*
+REVIEW: I think we don't need this API.
+When marker is created, market type is decided. The market type is not changed.
+map_object_marker_get_image_file is better.
+*/
+/* Remaining this API for a while: it may be useful to deliver marker file name
+*  to the plugin; there is no other way to do it now */
+int map_object_marker_get_image_file(const map_object_h marker,
+                                    char **file_path);
+
+/**
+ * @brief      Gets the marker type.
+ * @details This function gets the marker type.
+ * @since_tizen 3.0
+ *
+ * @param[in]  marker          The marker object handle
+ * @param[out] type            The pointer to a map_marker_type_e in which to
+ * store the marker type
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a marker is created using map_object_create_marker().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_object_h marker is created ahead using map_object_create_marker;
+
+int error = MAPS_ERROR_NONE;
+map_marker_type_e type = MAP_MARKER_NONE;
+
+// Get marker type
+error = map_object_marker_get_type(marker, &type);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see #map_marker_type_e
+ * @see map_object_create_marker()
+ */
+int map_object_marker_get_type(const map_object_h marker,
+                              map_marker_type_e *type);
+
+/* TODO: Check if marker text is supported by map provider */
+/**
+ * @brief      Gets the marker text.
+ * @details This function gets the text.
+ * @remarks Release the @ text with free().
+ * @since_tizen 3.0
+ *
+ * @param[in]  marker          The marker object handle
+ * @param[out] text            The text
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a marker is created using map_object_create_marker().
+ * @pre @a text may be set previously using map_object_marker_set_text().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_object_h marker is created ahead using map_object_create_marker;
+
+int error = MAPS_ERROR_NONE;
+char *text = NULL;
+
+// Get marker text
+error = map_object_marker_get_text(marker, &text);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+
+// Do something with text ...
+
+free(text);
+ * @endcode
+ *
+ * @see map_object_marker_set_text()
+ * @see map_object_create_marker()
+ */
+/*
+REVIEW: I heard that HERE didn't support text
+Please check it
+*/
+int map_object_marker_get_text(const map_object_h marker,
+                              char **text);
+
+#ifdef TIZEN_3_0_NEXT_MS
+/**
+ * @brief      Gets the route content.
+ * @details This function gets the content of the route.
+ * @remarks Release the @ content with maps_route_destroy().
+ * @since_tizen 3.0
+ *
+ * @param[in]  route           The route object handle
+ * @param[out] content         The content of the route of maps_route_h type
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a route is created using map_object_create_route().
+ *
+ * @see map_object_create_route()
+ */
+
+
+/*
+REVIEW: The API is not clear. Moreover, we had better add route related API in the next MS.
+*/
+
+int map_object_route_get_content(const map_object_h route,
+                                maps_route_h *content);
+#endif /* TIZEN_3_0_NEXT_MS */
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif                         /* __MAP_OBJECT_H__*/
diff --git a/include/map_snapshot.h b/include/map_snapshot.h
new file mode 100644 (file)
index 0000000..6b603c2
--- /dev/null
@@ -0,0 +1,275 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MAP_SNAPSHOT_H__
+#define __MAP_SNAPSHOT_H__
+
+#include <tizen_type.h>
+#include <maps_error.h>
+#include <maps_area.h>
+#include <maps_coordinates.h>
+#include <Evas.h>
+
+/**
+ *
+ * @file map_snapshot.h
+ * @brief This file contains the Map Snapshot API
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+ * @ingroup    CAPI_MAP_SNAPSHOT_MODULE
+ * @defgroup   CAPI_MAP_SNAPSHOT_DATA_MODULE Snapshot
+ *
+ * @addtogroup CAPI_MAP_SNAPSHOT_DATA_MODULE
+ * @{
+ * @brief This provides APIs allowing to capture Map Snapshots.
+ *
+ */
+
+/**
+ * @brief      Handle of the Map Snapshot.
+ * @details The Snapshot handle can be obtained via call of
+ * map_view_capture_snapshot() or maps_service_capture_snapshot().
+ * @since_tizen 3.0
+ * @remarks To release the handle use map_snapshot_destroy().
+ *
+ * @see map_view_capture_snapshot()
+ * @see maps_service_capture_snapshot()
+ * @see map_snapshot_destroy()
+ */
+typedef void *map_snapshot_h;
+
+
+/**
+ * @brief      Destroys the Map Snapshot and releases all its resources.
+ * @details This function destroys the Map Snapshot handle and releases all its
+ * resources.
+ * @since_tizen 3.0
+ *
+ * @param[in]  snapshot        The Snapshot handle to destroy
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a snapshot is retrieved in map_view_capture_snapshot() or
+ * maps_service_capture_snapshot()
+ *
+ * @see map_view_capture_snapshot()
+ * @see maps_service_capture_snapshot()
+ */
+int map_snapshot_destroy(map_snapshot_h snapshot);
+
+/**
+ * @brief      Gets the snapshot pixel data.
+ * @details This function gets the pixel data of the snapshot.
+ * @remarks Release the @a data with free() when no needed.
+ * @since_tizen 3.0
+ *
+ * @param[in]  snapshot        The snapshot handle
+ * @param[out] data            The pointer to snapshot pixels
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a snapshot is retrieved via maps_service_capture_snapshot() or
+ * map_view_capture_snapshot().
+ *
+ * @see maps_service_capture_snapshot()
+ * @see map_view_capture_snapshot()
+ * @see #map_snapshot_h
+ */
+int map_snapshot_get_data(const map_snapshot_h snapshot,
+                         void **data);
+
+/**
+ * @brief      Gets the snapshot color space.
+ * @details This function gets the color space of the snapshot.
+ * @since_tizen 3.0
+ *
+ * @param[in]  snapshot        The snapshot handle
+ * @param[out] colorspace      The pointer to Evas_Colorspace in which to store
+ * the color space, used while capturing snapshot
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a snapshot is retrieved via maps_service_capture_snapshot() or
+ * map_view_capture_snapshot().
+ *
+ * @see maps_service_capture_snapshot()
+ * @see map_view_capture_snapshot()
+ * @see #map_snapshot_h
+ */
+int map_snapshot_get_color_space(const map_snapshot_h snapshot,
+                                Evas_Colorspace *colorspace);
+
+
+/**
+ * @brief      Gets the snapshot center.
+ * @details This function gets the geographical coordinates of snapshot center.
+ * @remarks Release the @a center with maps_coordinates_destroy().
+ * @since_tizen 3.0
+ *
+ * @param[in]  snapshot        The snapshot handle
+ * @param[out] center          The pointer to #maps_coordinates_h in which to
+ * store the handle of snapshot center
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a snapshot is retrieved via maps_service_capture_snapshot() or
+ * map_view_capture_snapshot().
+ *
+ * @see maps_service_capture_snapshot()
+ * @see map_view_capture_snapshot()
+ * @see #map_snapshot_h
+ */
+int map_snapshot_get_center(const map_snapshot_h snapshot,
+                           maps_coordinates_h *center);
+
+/**
+ * @brief      Gets the snapshot area.
+ * @details This function gets the geographical area corresponding to the
+ * snapshot.
+ * @remarks Release the @a area with maps_area_destroy().
+ * @since_tizen 3.0
+ *
+ * @param[in]  snapshot        The snapshot handle
+ * @param[out] area            The pointer to #maps_area_h in which to store
+ * the handle of the snapshot area
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a snapshot is retrieved via maps_service_capture_snapshot() or
+ * map_view_capture_snapshot().
+ *
+ * @see maps_service_capture_snapshot()
+ * @see map_view_capture_snapshot()
+ * @see #map_snapshot_h
+ */
+int map_snapshot_get_area(const map_snapshot_h snapshot,
+                         maps_area_h *area);
+
+
+/**
+ * @brief      Gets the snapshot zoom level.
+ * @details This function gets the snapshot zoom level.
+ * @since_tizen 3.0
+ * @remarks Note, the snapshot is made asynchronously, so it is preferable to
+ * use this function instead of map_view_get_zoom_level(): zoom level might be
+ * changed already.
+ *
+ * @param[in]  snapshot        The snapshot handle
+ * @param[out] zoom_level      The pointer to an integer in which to store the
+ * snapshot zoom level
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a snapshot is retrieved via maps_service_capture_snapshot() or
+ * map_view_capture_snapshot().
+ *
+ * @see maps_service_capture_snapshot()
+ * @see map_view_capture_snapshot()
+ * @see #map_snapshot_h
+ */
+int map_snapshot_get_zoom_level(const map_snapshot_h snapshot, int *zoom_level);
+
+/**
+ * @brief      Gets the snapshot zoom factor.
+ * @details This function gets the snapshot zoom factor.
+ * @since_tizen 3.0
+ *
+ * @param[in]  snapshot        The snapshot handle
+ * @param[out] zoom_factor     The pointer to a double in which to store the
+ * snapshot zoom factor
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a snapshot is retrieved via maps_service_capture_snapshot() or
+ * map_view_capture_snapshot().
+ *
+ * @see maps_service_capture_snapshot()
+ * @see map_view_capture_snapshot()
+ * @see #map_snapshot_h
+ */
+int map_snapshot_get_zoom_factor(const map_snapshot_h snapshot,
+                                double *zoom_factor);
+
+/**
+ * @brief      Gets the snapshot orientation.
+ * @details This function gets the snapshot orientation.
+ * @since_tizen 3.0
+ *
+ * @param[in]  snapshot        The snapshot handle
+ * @param[out] rotation_angle  The pointer to a double in which to store the
+ * snapshot orientation
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a snapshot is retrieved via maps_service_capture_snapshot() or
+ * map_view_capture_snapshot().
+ *
+ * @see maps_service_capture_snapshot()
+ * @see map_view_capture_snapshot()
+ * @see #map_snapshot_h
+ */
+int map_snapshot_get_orientation(const map_snapshot_h snapshot,
+                                double *rotation_angle);
+
+/**
+ * @brief      Gets the snapshot screen size.
+ * @details This function gets the snapshot size on the screen.
+ * @since_tizen 3.0
+ *
+ * @param[in]  snapshot        The snapshot handle
+ * @param[out] width           The pointer to an integer in which to store the
+ * snapshot width, in screen units
+ * @param[out] height          The pointer to an integer in which to store the
+ * snapshot height, in screen units
+ * @return     0, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a snapshot is retrieved via maps_service_capture_snapshot() or
+ * map_view_capture_snapshot().
+ *
+ * @see maps_service_capture_snapshot()
+ * @see map_view_capture_snapshot()
+ * @see #map_snapshot_h
+ */
+int map_snapshot_get_size(const map_snapshot_h snapshot,
+                         int *width,
+                         int *height);
+
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+#endif                         /* __MAPS_SNAPSHOT_H__ */
diff --git a/include/map_view.h b/include/map_view.h
new file mode 100644 (file)
index 0000000..89b3fb7
--- /dev/null
@@ -0,0 +1,2281 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MAP_VIEW_H__
+#define __MAP_VIEW_H__
+
+#include <Evas.h>
+#include <maps_service.h>
+#include <map_gesture.h>
+#include <map_snapshot.h>
+#include <map_object.h>
+#include <map_event_data.h>
+
+/**
+ *
+ * @ingroup    CAPI_MAP_VIEW_MODULE
+ * @defgroup   CAPI_MAP_VIEW_PANEL_MODULE Map View
+ *
+ * @file map_view.h
+ * @brief This file contains the top level functions of map view API
+ *
+ * @addtogroup CAPI_MAP_VIEW_PANEL_MODULE
+ * @{
+ * @brief This provides map view APIs related to operations with map view
+ * @details Supported map view API features include:
+ *  * Creating and destroying the map view port, moving and resizing it
+ *  * Changing map zoom, and orientation
+ *  * Changing map properties: theme (day, satellite ,terrain),
+ *  language (English, Russian, Chinese, Italian, German, Spanish, etc.)
+ *  * Converting screen coordinates to geographical and vise versa
+ *  * Capturing snapshot with current map view image
+ *  * Managing user's gestures: receiving user's gesture events, enabling or
+ *  disabling specified user gestures, assigning map view actions, which must be
+ *  taken in response on user gestures
+ *  .
+ */
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+ /**
+ * @brief      The map view handle
+ * @details The handle of map view instance.
+ * @remarks To release the handle use map_view_destroy().
+ * @since_tizen 3.0
+ *
+ * @see map_view_create()
+ * @see map_view_destroy()
+ */
+typedef void *map_view_h;
+
+
+/**
+ * @brief      Enumeration of map view types (themes)
+ * @since_tizen 3.0
+ */
+typedef enum _map_view_type_e {
+
+       MAP_VIEW_TYPE_DAY, /**< Indicates the day theme */
+
+       MAP_VIEW_TYPE_SATELLITE, /**< Indicates the satellite theme */
+
+       MAP_VIEW_TYPE_TRANSIT, /**< Indicates the public transport scheme in
+                                daylight mode */
+
+       MAP_VIEW_TYPE_TRAFFIC, /**< Indicates the traffic scheme in
+                                daylight mode */
+
+       MAP_VIEW_TYPE_HYBRID_DAY, /**< Indicates the hybrid theme which
+                                   composes satellite and roads themes */
+
+       MAP_VIEW_TYPE_HYBRID_TRANSIT, /**< Indicates the satellite map view with
+                               public transport scheme in daylight mode */
+
+       MAP_VIEW_TYPE_HYBRID_TRAFFIC, /**< Indicates the satellite map view with
+                               streets scheme designed for traffic */
+
+
+       MAP_VIEW_TYPE_TERRAIN,  /**< Indicates the terrain theme */
+
+} map_view_type_e;
+
+/**
+ * @brief      Called when requesting the list of visual objects of the Map
+ * View.
+ * @details This callback is invoked while iterating through the list of
+ * visual objects, added to the Map View.
+ * @since_tizen 3.0
+ * @remarks @a object must be released using maps_visual_object_destroy().
+ * \n To use @a object outside this function, clone it with
+ * maps_visual_object_clone().
+ *
+ * @param[in]  index           The current index of path point
+ * @param[in]  total           The total amount of path points
+ * @param[in]  object          The visual object
+ * @param[in]  user_data       The user data pointer passed from
+ * map_view_foreach_object()
+ * @return     @c true to continue with the next iteration of the loop, \n @c
+ * false to break out of the loop
+ *
+ * @pre map_view_foreach_object() will invoke this callback.
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_view_h view is created ahead
+
+static bool draw_map_object_cb(int index, int total,
+                            map_object_h object,
+                            void *user_data)
+{
+       if (!object)
+               return false;
+
+       bool visible = false;
+       map_object_type_e type = MAP_OBJECT_UNKNOWN;
+       int error = MAPS_ERROR_NONE;
+
+       error = map_object_get_visible(object, &visible);
+       if (error != MAPS_ERROR_NONE)
+               return false;
+
+       if (!visible)
+               return true; // This object should not be drawn
+
+       // Extract the type of the object
+       error = map_object_get_type(object, &type);
+       if (error != MAPS_ERROR_NONE)
+               return false;
+
+       // Dispatch the drawing routines
+       switch(type) {
+       case MAP_OBJECT_MARKER:
+               __draw_marker(object);
+               break;
+       case MAP_OBJECT_POLYLINE:
+               __draw_polyline(object);
+               break;
+       case MAP_OBJECT_POLYGON:
+               __draw_polygon(object);
+               break;
+       case MAP_OBJECT_GROUP:
+               __draw_group(object);
+               break;
+       case MAP_OBJECT_UNKNOWN:
+       default:
+               // Handle the error of unsupported Map View Object type
+               break;
+       }
+       return true;
+}
+ * @endcode
+ *
+ * @see #map_object_h
+ * @see map_view_foreach_object()
+ */
+typedef bool(*map_object_cb) (int index, int total,
+                             map_object_h object,
+                             void *user_data);
+
+/**
+ * @brief      Called when user's gesture occurs.
+ * @details The map view invokes this callback when one of user's gestures,
+ * listed in #map_gesture_e, occurs.
+ * @since_tizen 3.0
+ * @remarks The @a gesture handle must be released using map_gesture_destroy().
+ * \n To use @a gesture outside this function, clone it with
+ * map_gesture_clone().
+ *
+ * @param[in]  gesture         The gesture data handle
+ * @param[in]  user_data       The user data pointer registered in
+ * map_view_set_gesture_cb()
+ *
+ * @pre map_view_set_gesture_cb() sets this callback.
+ * @pre User's gestures, such as tap, double tap, map rotate or long press
+ * invoke the callback.
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+static void map_view_gesture_cb(map_gesture_h gesture, void *user_data)
+{
+       map_gesture_e gesture_type = MAP_GESTURE_NONE;
+       map_gesture_get_type(gesture, &gesture_type);
+       switch (gesture_type) {
+               case MAP_GESTURE_SCROLL:
+                       LOG("MAP_GESTURE_SCROLL");
+                       break;
+               case MAP_GESTURE_TAP:
+                       LOG("MAP_GESTURE_TAP");
+                       break;
+               case MAP_GESTURE_DOUBLE_TAP:
+                       LOG("MAP_GESTURE_SCROLL");
+                       break;
+               case MAP_GESTURE_2_FINGER_TAP:
+                       LOG("MAP_GESTURE_2_FINGER_TAP");
+                       break;
+               case MAP_GESTURE_PRESS:
+                       LOG("MAP_GESTURE_PRESS");
+                       break;
+               case MAP_GESTURE_NONE:
+               default:
+                       LOG("default gesture type");
+                       break;
+       }
+       map_gesture_destroy(gesture);
+}
+ * @endcode
+ *
+ * @see map_view_set_gesture_cb()
+ * @see map_view_unset_gesture_cb()
+ * @see #map_gesture_h
+ */
+typedef void(*map_view_on_gesture_cb) (map_gesture_h gesture, void *user_data);
+
+/**
+ * @brief      Called when requesting the list of visual objects of the Map
+ * View.
+ * @details This callback is invoked while iterating through the list of
+ * visual objects, added to the Map View.
+ * @since_tizen 3.0
+ * @remarks @a object must be released using maps_visual_object_destroy().
+ * \n To use @a object outside this function, clone it with
+ * maps_visual_object_clone().
+ *
+ * @param[in]  index           The current index of path point
+ * @param[in]  total           The total amount of path points
+ * @param[in]  object          The visual object
+ * @param[in]  user_data       The user data pointer passed from
+ * map_view_foreach_object()
+ * @return     @c true to continue with the next iteration of the loop, \n @c
+ * false to break out of the loop
+ *
+ * @pre map_view_foreach_object() will invoke this callback.
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_view_h view is created ahead
+
+static bool draw_map_object_cb(int index, int total,
+                            map_object_h object,
+                            void *user_data)
+{
+       if (!object)
+               return false;
+
+       bool visible = false;
+       map_object_type_e type = MAP_OBJECT_UNKNOWN;
+       int error = MAPS_ERROR_NONE;
+
+       error = map_object_get_visible(object, &visible);
+       if (error != MAPS_ERROR_NONE)
+               return false;
+
+       if (!visible)
+               return true; // This object should not be drawn
+
+       // Extract the type of the object
+       error = map_object_get_type(object, &type);
+       if (error != MAPS_ERROR_NONE)
+               return false;
+
+       // Dispatch the drawing routines
+       switch(type) {
+       case MAP_OBJECT_MARKER:
+               __draw_marker(object);
+               break;
+       case MAP_OBJECT_POLYLINE:
+               __draw_polyline(object);
+               break;
+       case MAP_OBJECT_POLYGON:
+               __draw_polygon(object);
+               break;
+       case MAP_OBJECT_GROUP:
+               __draw_group(object);
+               break;
+       case MAP_OBJECT_UNKNOWN:
+       default:
+               // Handle the error of unsupported Map View Object type
+               break;
+       }
+       return true;
+}
+ * @endcode
+ *
+ * @see #map_object_h
+ * @see map_view_foreach_object()
+ */
+typedef bool(*map_object_cb) (int index, int total,
+                             map_object_h object,
+                             void *user_data);
+
+/**
+ * @brief      Called when the map event occurs.
+ * @details The Map View Panel invokes this callback when the map event occurs.
+ * @since_tizen 3.0
+ * @remarks @a event_data must be released using map_event_data_destroy().
+ * \n To use @a event_data outside this function, clone it with
+ * map_event_data_clone().
+ *
+ * @param[in]  result          The result of request
+ * @param[in]  type            The new type of callback, listed
+ * in #map_event_type_e
+ * @param[in]  cb_data         The event data
+ * @param[in]  user_data       The user data pointer registered in
+ * map_view_set_event_callback()
+ *
+ * @pre map_view_set_event_callback() sets the callback.
+ * @pre map_view_set_center(),
+ * map_view_set_zoom_level(),
+ * map_view_set_zoom_factor(),
+ * map_view_set_orientation(),
+ * invoke the callback with the type #MAP_EVENT_ACTION.
+ * @pre map_view_redraw() invoke the callback with the type #MAP_EVENT_READY.
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+static void map_view_event_cb(maps_error_e result,
+                             const map_event_type_e type,
+                             map_event_data_h event_data,
+                             void *user_data)
+{
+       LOG("map_view_event_cb enter");
+
+       map_gesture_e gesture_type = MAP_GESTURE_NONE;
+       map_action_e action_type = MAP_ACTION_NONE;
+
+       switch (type) {
+               case MAP_EVENT_GESTURE:
+               case MAP_EVENT_OBJECT:
+                       LOG("MAP_EVENT_GESTURE or MAP_EVENT_OBJECT");
+                       map_event_data_get_gesture_type(event_data,
+                                                       &gesture_type);
+                       switch (gesture_type) {
+                               case MAP_GESTURE_SCROLL:
+                                       LOG("MAP_GESTURE_SCROLL");
+                                       break;
+                               case MAP_GESTURE_TAP:
+                                       LOG("MAP_GESTURE_TAP");
+                                       break;
+                               case MAP_GESTURE_DOUBLE_TAP:
+                                       LOG("MAP_GESTURE_SCROLL");
+                                       break;
+                               case MAP_GESTURE_2_FINGER_TAP:
+                                       LOG("MAP_GESTURE_2_FINGER_TAP");
+                                       break;
+                               case MAP_GESTURE_PRESS:
+                                       LOG("MAP_GESTURE_PRESS");
+                                       break;
+                               case MAP_GESTURE_NONE:
+                               default:
+                                       LOG("default gesture_type");
+                                       break;
+                       }
+                       break;
+               case MAP_EVENT_ACTION:
+                       LOG("MAP_EVENT_ACTION");
+                       map_event_data_get_action_type(event_data,
+                                                      &action_type);
+                       switch (action_type) {
+                               case MAP_ACTION_SCROLL:
+                                       LOG("MAP_ACTION_SCROLL");
+                                       break;
+                               case MAP_ACTION_MOVE_CENTER:
+                                       LOG("MAP_ACTION_MOVE_CENTER");
+                                       break;
+                               case MAP_ACTION_ZOOM:
+                                       LOG("MAP_ACTION_ZOOM");
+                                       break;
+                               case MAP_ACTION_ROTATE:
+                                       LOG("MAP_ACTION_ROTATE");
+                                       break;
+                               case MAP_ACTION_NONE:
+                               default:
+                                       LOG("default action_type");
+                                       break;
+                       }
+                       break;
+               case MAP_EVENT_READY:
+                       LOG("MAP_EVENT_READY");
+                       break;
+               default:
+                       LOG("default type");
+                       break;
+       }
+       map_event_data_destroy(event_data);
+}
+ * @endcode
+ *
+ * @see map_view_set_event_callback()
+ * @see map_view_set_center()
+ * @see map_view_set_zoom_level()
+ * @see map_view_set_zoom_factor()
+ * @see map_view_set_orientation()
+ * @see map_view_redraw()
+ */
+typedef void(*map_view_on_event_cb) (maps_error_e result,
+                                    const map_event_type_e type,
+                                    map_event_data_h event_data,
+                                    void *user_data);
+
+/* ----------------------CREATE AND DESTROY-----------------------------------*/
+
+/**
+ * @brief      Creates the map view and link it to the instance of
+ * maps service.
+ * @details This function creates a new map view widget, allocate all needed
+ * resources and issues its handle.
+ * \n The newly created map view is linked to the specified maps service.
+ * \n The view by default is resized to fill whole parent area.
+ * \n To center the map on a specifies geographical coordinates with a desired
+ * zoom level and rotation angle use map_view_set_center(),
+ * map_view_set_zoom_level() and map_view_set_orientation() respectively.
+ * \n To change map theme, size and visibility properties use
+ * map_view_set_type() and map_view_set_visibility() respectively.
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/mapservice
+ * @remarks The @a view must be released using map_view_destroy().
+ *
+ * @param[in]  maps            The maps service handle
+ * @param[in]  obj             The image object
+ * @param[out] view            The handle pointer to a map_viwe_h,
+ * in which to store the newly created map view handle
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval     #MAPS_ERROR_PERMISSION_DENIED Permission Denied
+ *
+ * @pre @a maps is created using maps_service_create().
+ *
+ * @par Example
+ * @code
+#include <maps_service.h>
+#include <map_view.h>
+
+int main (int argc, char *argv[])
+{
+       maps_service_h maps = NULL;
+       map_view_h view = NULL;
+       Evas_Image *map_view_place_holder = NULL;
+       int error = MAPS_ERROR_NONE;
+       do {
+               // Create App UI ...
+               // map_view_place_holder = ...
+
+               // Create an instance of maps service
+               error = maps_service_create("Maps Provider", &maps);
+               if(error != MAPS_ERROR_NONE)
+                       break;
+
+               // Set the provider security key
+               error = maps_service_set_provider_key(maps, "provider_key");
+               if(error != MAPS_ERROR_NONE)
+                       break;
+
+               // Create a map view
+               error = map_view_create(maps, map_view_place_holder, &view);
+               if(error != MAPS_ERROR_NONE)
+                       break;
+
+               // Work with map view ...
+
+       } while(false);
+
+       // Release the map view, maps service and all used resources
+       map_view_destroy(view);
+       maps_service_destroy(maps);
+       return error;
+}
+ * @endcode
+ *
+ * @see map_view_destroy()
+ * @see maps_service_create()
+ * @see map_view_set_center()
+ * @see map_view_set_zoom_level()
+ * @see map_view_set_orientation()
+ * @see map_view_set_type()
+ * @see map_view_set_visibility()
+ */
+int map_view_create(const maps_service_h maps,
+                   Evas_Image *obj,
+                   map_view_h *view);
+
+/**
+ * @brief      Destroys the map view.
+ * @details This function destroys the map view, releases its handle and
+ * all allocated resources, unlinks the view from the instance of maps service.
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/mapservice
+ *
+ * @param[in]  view            The view handle to destroy
+ * @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
+ *
+ * @pre @a view is created using map_view_create().
+ *
+ * @see map_view_create()
+ *
+ */
+int map_view_destroy(map_view_h view);
+
+
+/*----------------------MAP ZOOM, ROTATE, SET CENTER--------------------------*/
+
+
+/**
+ * @brief      Centers the map on a given geographical coordinates.
+ * @details This function centers the map on a given geographical coordinates
+ * using current zoom and orientation.
+ * @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
+ *
+ * @param[in]  view            The view handle
+ * @param[in]  coordinates     The geographical coordinates of the position to
+ * be centered on the map view
+ * @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
+ *
+ * @pre @a view is created using map_view_create().
+ * @pre @a coordinates are created using maps_coordinates_create().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_view_h view is created ahead
+
+int error = MAPS_ERROR_NONE;
+maps_coordinates_h coordinates = NULL;
+
+// Obtain a geographical location to be focused
+error = maps_coordinates_create(39.929386, 23.696087, &coordinates);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+
+// Center a map view on specified coordinates
+error = map_view_set_center(view, coordinates);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+
+// Release coordinates handle
+maps_coordinates_destroy(coordinates);
+ * @endcode
+ *
+ * @see map_view_get_center()
+ * @see map_view_set_zoom_level()
+ * @see map_view_set_zoom_factor()
+ * @see map_view_set_orientation()
+ * @see maps_coordinates_create()
+ * @see map_view_create()
+ */
+int map_view_set_center(const map_view_h view,
+                       const maps_coordinates_h coordinates);
+
+/**
+ * @brief      Gets the central coordinates of a map.
+ * @details This function gets the current central coordinates of a map.
+ * @since_tizen 3.0
+ * @remarks The @a coordinates must be released using
+ * maps_coordinates_destroy().
+ *
+ * @param[in]  view            The view handle
+ * @param[out] coordinates     The pointer to #maps_coordinates_h in which to
+ * store the geographical coordinates of the central position of the map
+ * @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 map_view_create().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_view_h view is created ahead
+
+int error = MAPS_ERROR_NONE;
+maps_coordinates_h coordinates = NULL;
+
+// Get the central coordinates of the map
+error = map_view_get_center(view, &coordinates);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+
+// Do something with obtained coordinates...
+double latitude = .0;
+double longitude = .0;
+error = maps_coordinates_get_latitude_longitude(coordinates, &latitude, &longitude);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+
+// Release coordinates handle
+maps_coordinates_destroy(coordinates);
+ * @endcode
+ *
+ * @see map_view_set_center()
+ * @see map_view_get_zoom_level()
+ * @see map_view_get_zoom_factor()
+ * @see map_view_get_orientation()
+ * @see maps_coordinates_destroy()
+ * @see map_view_create()
+ */
+int map_view_get_center(const map_view_h view,
+                       maps_coordinates_h *coordinates);
+
+/**
+ * @brief      Sets zooms level of the map.
+ * @details This function sets the integer zoom level of the map.
+ * \n If the specified zoom level exceeds the maps Provider allowed zoom range,
+ * the function returns #MAPS_ERROR_INVALID_PARAMETER error.
+ * \n To check the range of allowed zoom level use map_view_get_min_zoom_level()
+ * and map_view_get_max_zoom_level().
+ * @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
+ *
+ * @param[in]  view            The view handle
+ * @param[in]  level           The new zoom level
+ * @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
+ *
+ * @pre @a view is created using map_view_create().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_view_h view is created ahead
+
+int error = MAPS_ERROR_NONE;
+
+// Set a specified zoom level for the map view
+error = map_view_set_zoom_level(view, 8);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see map_view_get_zoom_level()
+ * @see map_view_set_orientation()
+ * @see map_view_get_min_zoom_level()
+ * @see map_view_get_max_zoom_level()
+ * @see map_view_set_zoom_factor()
+ * @see map_view_create()
+ */
+int map_view_set_zoom_level(map_view_h view, const int level);
+
+/**
+ * @brief      Gets zooms level of the map.
+ * @details This function gets the current integer zoom level of the map.
+ * @since_tizen 3.0
+ *
+ * @param[in]  view            The view handle
+ * @param[out] level           The pointer to an integer in which to store the
+ * current zoom level
+ * @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 map_view_create().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_view_h view is created ahead
+
+int error = MAPS_ERROR_NONE;
+int current_zoom_level = 0;
+
+// Get the current zoom level of the map
+error = map_view_get_zoom_level(view, &zoom_level);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see map_view_set_zoom_level()
+ * @see map_view_get_min_zoom_level()
+ * @see map_view_get_max_zoom_level()
+ * @see map_view_get_zoom_factor()
+ * @see map_view_create()
+ */
+int map_view_get_zoom_level(const map_view_h view, int *level);
+
+/**
+ * @brief      Gets the minimal zooms level of the map.
+ * @details This function gets the minimally allowed zoom level of the map.
+ * @since_tizen 3.0
+ * @privlevel public
+ *
+ * @param[in]  view            The view handle
+ * @param[out] min_zoom_level  The pointer to an integer in which to store the
+ * minimally allowed zoom level
+ * @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
+ *
+ * @pre @a view is created using map_view_create().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_view_h view is created ahead
+
+int error = MAPS_ERROR_NONE;
+int min_zoom_level = 0;
+
+// Get the minimally allowed zoom level of the map
+error = map_view_get_min_zoom_level(view, &min_zoom_level);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see map_view_get_max_zoom_level()
+ * @see map_view_get_zoom_level()
+ * @see map_view_get_zoom_factor()
+ * @see map_view_set_zoom_level()
+ * @see map_view_create()
+ */
+int map_view_get_min_zoom_level(const map_view_h view, int *min_zoom_level);
+
+/**
+ * @brief      Gets the maximal zooms level of the map.
+ * @details This function gets the maximally allowed zoom level of the map.
+ * @since_tizen 3.0
+ * @privlevel public
+ *
+ * @param[in]  view            The view handle
+ * @param[out] max_zoom_level  The pointer to an integer in which to store the
+ * maximally allowed zoom level
+ * @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
+ *
+ * @pre @a view is created using map_view_create().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_view_h view is created ahead
+
+int error = MAPS_ERROR_NONE;
+int max_zoom_level = 0;
+
+// Get the maximally allowed zoom level of the map
+error = map_view_get_max_zoom_level(view, &max_zoom_level);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see map_view_get_min_zoom_level()
+ * @see map_view_get_zoom_level()
+ * @see map_view_get_zoom_factor()
+ * @see map_view_set_zoom_level()
+ * @see map_view_create()
+ */
+int map_view_get_max_zoom_level(const map_view_h view, int *max_zoom_level);
+
+/**
+ * @brief      Zooms the map on the view.
+ * @details This function zooms the map on the Map View with real value of zoom
+ * factor.
+ * @since_tizen 3.0
+ * @privlevel public
+ *
+ * @param[in]  view            The view handle
+ * @param[out] zoom_factor     The new zoom 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_PERMISSION_DENIED Permission Denied
+ *
+ * @pre @a view is created using map_view_create().
+ * @post This function invokes map_view_on_event_cb() with the event type
+ * #MAP_EVENT_ACTION and action type #MAP_ACTION_ZOOM.
+ * \n The value of new zoom factor will be accessible via
+ * map_event_data_get_zoom_factor().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_view_h view is created ahead
+
+int error = MAPS_ERROR_NONE;
+
+// Set a specified zoom factor for the Map View
+error = map_view_set_zoom_factor(view, 8.5);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see map_view_get_zoom_factor()
+ * @see map_view_set_zoom_level()
+ * @see map_view_get_min_zoom_level()
+ * @see map_view_get_max_zoom_level()
+ * @see map_view_on_event_cb()
+ * @see map_view_set_event_callback()
+ * @see map_view_create()
+*/
+int map_view_set_zoom_factor(const map_view_h view, const double zoom_factor);
+
+/**
+ * @brief      Gets the map zoom factor.
+ * @details This function gets the current zoom factor of the Map on the Map
+ * View.
+ * @since_tizen 3.0
+ * @remarks zoom @a factor can be obtained also in map_view_on_event_cb()
+ * callback, assigned using map_view_set_event_callback() with the event
+ * type #MAP_EVENT_ACTION specified.
+ *
+ * @param[in]  view            The view handle
+ * @param[out] zoom_factor     The pointer to a double in which to store the
+ * current zoom factor
+ * @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 map_view_create().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_view_h view is created ahead
+
+int error = MAPS_ERROR_NONE;
+double current_zoom_factor = .0;
+
+// Fetch the current zoom factor of the Map View
+error = map_view_get_zoom_factor(view, &zoom_factor);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see map_view_set_zoom_factor()
+ * @see map_view_set_event_callback()
+ * @see map_view_on_zoom_cb()
+ * @see map_view_create()
+ */
+int map_view_get_zoom_factor(const map_view_h view, double *zoom_factor);
+
+/**
+ * @brief      Sets the map orientation on the map view.
+ * @details This function sets the rotation angle of the map on the map view.
+ * \n If the specified rotation angle exceeds the [0..360] range, the
+ * function returns #MAPS_ERROR_INVALID_PARAMETER error.
+ * @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
+ *
+ * @param[in]  view            The view handle
+ * @param[in]  angle           The new orientation angle
+ * @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
+ *
+ * @pre @a view is created using map_view_create().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_view_h view is created ahead
+
+int error = MAPS_ERROR_NONE;
+
+// Set a specified orientation of the map
+error = map_view_set_orientation(view, 60.);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+*
+ * @see map_view_get_orientation()
+ * @see map_view_set_zoom_level()
+ * @see map_view_set_zoom_factor()
+ * @see map_view_create()
+ */
+int map_view_set_orientation(const map_view_h view, const double angle);
+
+/**
+ * @brief      Gets the map orientation.
+ * @details This function gets the current map rotation angle on the map view.
+ * @since_tizen 3.0
+ *
+ * @param[in]  view            The view handle
+ * @param[out] rotation_angle  The pointer to a double in which to store the
+ * current rotation angle
+ * @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 map_view_create().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_view_h view is created ahead
+
+int error = MAPS_ERROR_NONE;
+double current_orientation = .0;
+
+// Get the current orientation of the map
+error = map_view_get_orientation(view, &orientation);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see map_view_set_orientation()
+ * @see map_view_get_zoom_level()
+ * @see map_view_create()
+ */
+int map_view_get_orientation(const map_view_h view, double *rotation_angle);
+
+
+/*----------------------SCREEN <--> GEOGRAPHY---------------------------------*/
+
+/**
+ * @brief      Converts screen coordinates to the geographical coordinates.
+ * @details This function converts screen coordinates to the geographical
+ * coordinates accordingly to the current map zoom and orientation.
+ * @since_tizen 3.0
+ * @remarks The @a coordinates must be released using
+ * maps_coordinates_destroy().
+ *
+ * @param[in]  view            The view handle
+ * @param[in]  x               The x coordinate on the screen
+ * @param[in]  y               The y coordinate on the screen
+ * @param[out] coordinates     The pointer to a #maps_coordinates_h in which to
+ * store the handle of geographical coordinates, corresponding to given screen
+ * coordinates
+ * @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
+ *
+ * @pre @a view is created using map_view_create().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_view_h view is created ahead
+
+int error = MAPS_ERROR_NONE;
+maps_coordinates_h coordinates = NULL;
+
+// Convert screen coordinates to geographical
+error = map_view_screen_to_geography(view, 100, 150, &coordinates);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+
+// Do something with obtained geographical coordinates...
+
+// Release the coordinates
+maps_coordinates_destroy(coordinates);
+ * @endcode
+ *
+ * @see map_view_geography_to_screen()
+ * @see #maps_coordinates_h
+ * @see maps_coordinates_destroy()
+ * @see map_view_create()
+ */
+int map_view_screen_to_geography(const map_view_h view,
+                                const int x,
+                                const int y,
+                                maps_coordinates_h *coordinates);
+
+/**
+ * @brief      Converts geographical coordinates to the screen coordinates.
+ * @details This function converts geographical coordinates to the screen
+ * coordinates accordingly to the current map zoom and orientation.
+ * @since_tizen 3.0
+ *
+ * @param[in]  view            The view handle
+ * @param[in]  coordinates     The geographical coordinates
+ * @param[out] x               The pointer to an integer in which to store the
+ * x coordinate on the screen, corresponding to given geographical coordinates
+ * @param[out] y               The pointer to an integer in which to store the
+ * y coordinate on the screen, corresponding to given geographical coordinates
+ * @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
+ *
+ * @pre @a view is created using map_view_create().
+ * @pre @a coordinates are created using maps_coordinates_create().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_view_h view is created ahead
+
+int error = MAPS_ERROR_NONE;
+maps_coordinates_h coordinates = NULL;
+int x = 0;
+int y = 0;
+
+// Prepare a geographical coordinates
+error = maps_coordinates_create(39.929386, 23.696087, &coordinates);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+
+// Convert screen coordinates to geographical
+error = map_view_geography_to_screen(view, coordinates, &x, &y);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+
+// Do something with obtained screen coordinates x,y...
+
+// Release the coordinates
+maps_coordinates_destroy(coordinates);
+ * @endcode
+ *
+ * @see map_view_screen_to_geography()
+ * @see #maps_coordinates_h
+ * @see maps_coordinates_create()
+ * @see map_view_create()
+ */
+int map_view_geography_to_screen(const map_view_h view,
+                                const maps_coordinates_h coordinates,
+                                int *x,
+                                int *y);
+
+
+/* --------------------MAPS VIEW PREFERENCES----------------------------------*/
+
+
+/**
+ * @brief      Sets map view type.
+ * @details This function switches the map view to a specified type, one of
+ * listed in #map_view_type_e enumeration.
+ * @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
+ *
+ * @param[in]  view            The view handle
+ * @param[in]  type            The view type, one of listed in #map_view_type_e
+ * @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_CONNECTION_TIME_OUT Timeout error, no answer
+ * @retval     #MAPS_ERROR_NETWORK_UNREACHABLE Network unavailable
+ *
+ * @pre @a view is created using map_view_create().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_view_h view is created ahead
+
+int error = MAPS_ERROR_NONE;
+
+// Set Satellite map view theme
+error = map_view_set_type(view, MAP_VIEW_TYPE_SATELLITE);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see #map_view_type_e
+ * @see map_view_get_type()
+ * @see map_view_set_language()
+ * @see map_view_create()
+ */
+int map_view_set_type(map_view_h view, const map_view_type_e type);
+
+/**
+ * @brief      Gets map view type.
+ * @details This function gets the type of the given map view.
+ * \n The type options are defined in the #map_view_type_e enumeration.
+ * @since_tizen 3.0
+ *
+ * @param[in]  view            The view handle
+ * @param[out] type            The pointer to a #map_view_type_e in which to
+ * store current view type
+ * @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 map_view_create().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_view_h view is created ahead
+
+int error = MAPS_ERROR_NONE;
+map_view_type_e type = MAP_VIEW_TYPE_DAY;
+
+// Obtain current map view theme
+error = map_view_get_type(view, &type);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ * @see #map_view_type_e
+ * @see map_view_set_type()
+ * @see map_view_get_language()
+ * @see map_view_create()
+ */
+int map_view_get_type(const map_view_h view, map_view_type_e *type);
+
+/**
+ * @brief      Sets map view language.
+ * @details This function sets the language to the given map view.
+ * \n Note that map display language is different from places and route
+ * language.
+ * @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 If specific language wasn't set explicitly or map tile doesn't
+ * support the requested language, the default language of your Maps Provider
+ * is used.
+ * \n In general, Map Provider set the
+ * default language as the mother tongue of the country or English.
+ *
+ * @param[in]  view            The view handle
+ * @param[in]  language        The language string value indicates the current
+ * language setting in the \<LANGUAGE\>_\<REGION\> syntax. \n The \<LANGUAGE\>
+ * setting is in the ISO 639-1 alfa-2 format and the \<REGION\> setting is in
+ * the ISO 3166-1 alpha-2 format.
+ * @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
+ *
+ * @pre @a view is created using map_view_create().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_view_h view is created ahead
+
+int error = MAPS_ERROR_NONE;
+
+// Set Russian as map view language
+error = map_view_set_language(view, "ru-RU");
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see map_view_get_language()
+ * @see map_view_set_type()
+ * @see map_view_create()
+ */
+int map_view_set_language(map_view_h view, const char *language);
+
+/**
+ * @brief      Gets map view language.
+ * @details This function gets the language set to the map view.
+ * \n Note that map display language is different from places and route
+ * language.
+ * @remarks The @a language must be released using free().
+ * @since_tizen 3.0
+ *
+ * @param[in]  view            The view handle
+ * @param[out] language        The pointer to a char* in which to store the
+ * language string value
+ * @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 map_view_create().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_view_h view is created ahead
+
+int error = MAPS_ERROR_NONE;
+char *language = NULL;
+
+// Get map view language
+error = map_view_get_language(view, &language);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+
+// Do something with obtained language value
+
+free(language);
+ * @endcode
+ *
+ * @see map_view_set_language()
+ * @see map_view_get_type()
+ * @see map_view_create()
+ */
+int map_view_get_language(const map_view_h view, char **language);
+
+/**
+ * @brief      Turns on or off the inertia of the map.
+ * @details This function turns on or off the inertia of map view operations,
+ * such as panning and zooming.
+ * @since_tizen 3.0
+ *
+ * @param[in]  view            The view handle
+ * @param[in]  enabled         The flag indicating if the inertia is enabled
+ * @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 map_view_create().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_view_h view is created ahead
+
+int error = MAPS_ERROR_NONE;
+
+// Turn map view inertia on
+error = map_view_set_inertia_enable(view, true);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see map_view_get_inertia_enabled()
+ * @see map_view_get_visibility()
+ * @see map_view_create()
+ */
+int map_view_set_inertia_enabled(map_view_h view, bool enabled);
+
+/**
+ * @brief      Checks if the map inertia is enable.
+ * @details This function checks if the map view inertia is enabled.
+ * @since_tizen 3.0
+ *
+ * @param[in]  view            The view handle
+ * @param[out] enabled         The pointer to a boolean in which to store the
+ * flag indicating if the inertia of the map view is turned on
+ * @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 map_view_create().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_view_h view is created ahead
+
+int error = MAPS_ERROR_NONE;
+bool enabled = false;
+
+// Check if map view inertia is turned on
+error = map_view_get_visibility(view, &enabled);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see map_view_get_inertia_enabled()
+ * @see map_view_set_visibility()
+ * @see map_view_create()
+ */
+int map_view_get_inertia_enabled(map_view_h view, bool *enabled);
+
+/* --------------------MAPS PANEL MANIPULATIONS-------------------------------*/
+
+
+/**
+ * @brief      Gets the map view port.
+ * @details This function gets the map view port as a pointer on Evas_Object.
+ * @since_tizen 3.0
+ *
+ * @param[in]  view            The view handle
+ * @param[out] viewport        The pointer to Evas_Object in which to store
+ * the map view port
+ * @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 map_view_create().
+ *
+ * @see map_view_create()
+ * @see Evas_Object
+ */
+int map_view_get_port(const map_view_h view, Evas_Object **viewport);
+
+/**
+ * @brief      Gets geometry of map view port.
+ * @details This function retrieves the position and (rectangular) size of the
+ * given map view.
+ * \n The position, naturally, will be relative to the top left corner of the
+ * parent window.
+ * @remarks Use NULL pointers on the geometry components you're not
+ * interested in.
+ * @since_tizen 3.0
+ *
+ * @param[in]  view            The view handle
+ * @param[out] x               The pointer to an integer in which to store the X
+ * coordinate of the view
+ * @param[out] y               The pointer to an integer in which to store the Y
+ * coordinate of the view
+ * @param[out] width           The pointer to an integer in which to store the
+ * width of the view
+ * @param[out] height          The pointer to an integer in which to store the
+ * height of the view
+ * @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 map_view_create().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_view_h view is created ahead
+
+int error = MAPS_ERROR_NONE;
+int x = 0;
+int y = 0;
+int width = 0;
+int height = 0;
+
+// Obtain map view geometry
+error = map_view_get_geometry(view, &x, &y, &width, &height);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see map_view_resize()
+ * @see map_view_get_visibility()
+ * @see map_view_create()
+ */
+int map_view_get_geometry(const map_view_h view,
+                         int *x,
+                         int *y,
+                         int *width,
+                         int *height);
+
+/**
+ * @brief      Resizes the map view.
+ * @details This function changes the size of the given map view.
+ * @remarks Newly created map view port has the size of its parent.
+ * @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
+ *
+ * @param[in]  view            The view handle
+ * @param[in]  width           The new new width, in screen units
+ * @param[in]  height          The new new height, in screen units
+ * @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
+ *
+ * @pre @a view is created using map_view_create().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_view_h view is created ahead
+
+int error = MAPS_ERROR_NONE;
+
+// Resize the map view
+error = map_view_resize(view, 720, 1280);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see map_view_get_geometry()
+ * @see map_view_set_visibility()
+ * @see map_view_create()
+ */
+int map_view_resize(const map_view_h view, const int width, const int height);
+
+/**
+ * @brief      Shows or hides the map view.
+ * @details This function changes the visibility of map view.
+ * on the screen.
+ * @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
+ *
+ * @param[in]  view            The view handle
+ * @param[in]  visible         The new visibility of the map view
+ * @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
+ *
+ * @pre @a view is created using map_view_create().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_view_h view is created ahead
+
+int error = MAPS_ERROR_NONE;
+
+// Set map view visible
+error = map_view_set_visibility(view, true);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see map_view_get_visibility()
+ * @see map_view_create()
+ */
+int map_view_set_visibility(const map_view_h view, const bool visible);
+
+/**
+ * @brief      Gets the map view visibility.
+ * @details This function retrieves whether or not the given map view is
+ * visible.
+ * @since_tizen 3.0
+ *
+ * @param[in]  view            The view handle
+ * @param[out] visible         The pointer to a boolean in which to store the
+ * visibility of the map view
+ * @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 map_view_create().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_view_h view is created ahead
+
+int error = MAPS_ERROR_NONE;
+bool visible = false;
+
+// Get map view visible
+error = map_view_get_visibility(view, &visible);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see map_view_set_visibility()
+ * @see map_view_create()
+ */
+int map_view_get_visibility(const map_view_h view, bool *visible);
+
+/**
+ * @brief      Redraws the map view.
+ * @details This function forces the redraw routine of the map view on the
+ * screen.
+ * @remarks Note that this function only marks the map view as needed to be
+ * redrawn. Actual redraw is happening when the OS drawing system is ready for
+ * it.
+ * @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
+ *
+ * @param[in]  view            The view handle
+ * @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
+ *
+ * @pre @a view is created using map_view_create().
+ *
+ * @see map_view_get_visibility()
+ * @see map_view_set_visibility()
+ * @see map_view_create()
+ */
+int map_view_redraw(const map_view_h view);
+
+
+/* ---------------------USER CONTROL------------------------------------------*/
+
+#ifdef IMPROVEMENT_OF_VISUAL_OBJECTS // temp
+int map_view_set_event_callback(map_view_h view,
+                               const map_event_type_e type,
+                               map_view_on_event_cb callback,
+                               void *user_data);
+
+int map_view_unset_event_callback(map_view_h view,
+                               const map_event_type_e type);
+#endif
+
+/**
+ * @brief      Sets the user's gesture callback.
+ * @details This function sets the callback which will be invoked every time the
+ * map view processes the user's gesture over the map.
+ * @since_tizen 3.0
+ * @remarks To unregister the callback use map_view_unset_gesture_cb().
+ *
+ * @param[in]  view            The view handle
+ * @param[in]  callback        The callback, matching the
+ * map_view_on_gesture_cb() prototype
+ * @param[in]  user_data       The user data pointer to be passed to the
+ * callback
+ * @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 map_view_create().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_view_h view is created ahead
+
+static void my_user_gesture_cb(map_gesture_h gesture, void *user_data)
+{
+       // Handle the gesture...
+
+       // Release the gesture data
+       map_gesture_destroy(gesture);
+}
+
+static int register_gesture_cbs()
+{
+       // Register user's gesture callback
+       int error = map_view_set_gesture_cb(view,
+               my_user_gesture_cb, NULL);
+       if (error != MAPS_ERROR_NONE) {
+               // Handle the error...
+       }
+       return error;
+}
+ * @endcode
+ *
+ * @see map_view_unset_gesture_cb()
+ * @see map_view_on_gesture_cb()
+ * @see map_view_set_gesture_action()
+ * @see map_view_set_gesture_enabled()
+ * @see map_view_create()
+ */
+int map_view_set_gesture_cb(map_view_h view,
+                                 map_view_on_gesture_cb callback,
+                                 void *user_data);
+
+/**
+ * @brief      Unsets the user's gesture callback.
+ * @details This function unsets the user's gesture callback.
+ * @since_tizen 3.0
+ *
+ * @param[in]  view            The view handle
+ * @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 map_view_create().
+ * @pre the user's gesture callback is registered using
+ * map_view_set_gesture_cb()
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_view_h view is created ahead
+
+// Unregister the user's gesture callback
+int error = map_view_unset_gesture_cb(view);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the error...
+}
+ * @endcode
+ *
+ * @see map_view_set_gesture_cb()
+ * @see map_view_get_gesture_action()
+ * @see map_view_get_gesture_enabled()
+ * @see map_view_create()
+ */
+int map_view_unset_gesture_cb(map_view_h view);
+
+/**
+ * @brief      Assigns the action to the user gesture.
+ * @details This function sets the behaviour of map view by assigning a type of
+ * action, listed in #map_action_e, which should be taken in response on a
+ * given user's gesture, one of #map_gesture_e.
+ * @remarks Note: not all actions can be assigned with a specified gesture.
+ * @par Matching gestures to actions
+ * | Gesture                         | Allowed Action                       |
+ * | :------------------------------ | :----------------------------------- |
+ * | #MAP_GESTURE_SCROLL             | #MAP_ACTION_SCROLL                   |
+ * | #MAP_GESTURE_FLICK              | #MAP_ACTION_SCROLL                   |
+ * | #MAP_GESTURE_PINCH              | #MAP_ACTION_ZOOM                     |
+ * | #MAP_GESTURE_TAP                | #MAP_ACTION_SCROLL, #MAP_ACTION_ZOOM |
+ * | #MAP_GESTURE_DOUBLE_TAP         | #MAP_ACTION_ZOOM, #MAP_ACTION_SCROLL |
+ * | #MAP_GESTURE_2_FINGER_TAP       | #MAP_ACTION_ZOOM                     |
+ * | #MAP_GESTURE_ZOOM               | #MAP_ACTION_ZOOM                     |
+ * | #MAP_GESTURE_SINGLE_FINGER_ZOOM | #MAP_ACTION_ZOOM                     |
+ * | #MAP_GESTURE_ROTATE             | #MAP_ACTION_ROTATE                   |
+ * | #MAP_GESTURE_PRESS              | #MAP_ACTION_SCROLL, #MAP_ACTION_ZOOM |
+ * @remarks Note: each gesture can be assigned with #MAP_ACTION_NONE.
+ * The Application will keep receiving corresponding gesture notifications,
+ * however the map view will not be changing.
+ *
+ * @param[in]  view            The view handle
+ * @param[in]  gesture         The user gesture, one of listed in
+ * #map_gesture_e
+ * @param[in]  action          The action which should be taken, on of
+ * listed in #map_action_e
+ * @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 map_view_create().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_view_h view is created ahead
+
+int error = MAPS_ERROR_NONE;
+
+// Center the map on the position, taped by the User
+error = map_view_set_gesture_action(view,
+                                   MAP_GESTURE_TAP,
+                                   MAP_ACTION_SCROLL);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see #map_gesture_e
+ * @see #map_action_e
+ * @see map_view_get_gesture_action()
+ * @see map_view_set_gesture_enabled()
+ * @see map_view_get_gesture_enabled()
+ * @see map_view_create()
+ */
+int map_view_set_gesture_action(map_view_h view,
+                               const map_gesture_e gesture,
+                               const map_action_e action);
+
+/**
+ * @brief      Gets the action, assigned to the user gesture.
+ * @details This function gets the behaviour of map view: it retrieves the
+ * action, assigned as a reaction on a given user gesture.
+ * @since_tizen 3.0
+ *
+ * @param[in]  view            The view handle
+ * @param[in]  gesture         The user gesture
+ * @param[out] action          The pointer to a #map_action_e in which
+ * to store the action assigned to the user gesture
+ * @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 map_view_create().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_view_h view is created ahead
+
+int error = MAPS_ERROR_NONE;
+map_action_e action = MAP_ACTION_NONE;
+
+// Get the action, assigned to the tap gesture
+error = map_view_get_gesture_action(view, MAP_GESTURE_TAP, &action);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see #map_gesture_e
+ * @see #map_action_e
+ * @see map_view_set_gesture_action()
+ * @see map_view_set_gesture_enabled()
+ * @see map_view_get_gesture_enabled()
+ * @see map_view_create()
+ */
+int map_view_get_gesture_action(map_view_h view,
+                               const map_gesture_e gesture,
+                               map_action_e *action);
+
+/**
+ * @brief      Enables or disables the user gesture.
+ * @details This function allows or blocks reaction on a given user gesture.
+ * @since_tizen 3.0
+ *
+ * @param[in]  view            The view handle
+ * @param[in]  gesture         The user gesture, one of listed in
+ * #map_gesture_e
+ * @param[in]  enabled         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 map_view_create().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_view_h view is created ahead
+
+int error = MAPS_ERROR_NONE;
+
+// Disabling long press gesture
+error = map_view_set_gesture_enabled(view, MAP_GESTURE_PRESS, false);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see #map_gesture_e
+ * @see map_view_get_gesture_enabled()
+ * @see map_view_set_gesture_action()
+ * @see map_view_get_gesture_action()
+ * @see map_view_create()
+ */
+int map_view_set_gesture_enabled(map_view_h view,
+                                const map_gesture_e gesture,
+                                const bool enabled);
+
+/**
+ * @brief      Gets the user gesture enable status.
+ * @details This function retrieves the enable status of a given user gesture.
+ * @since_tizen 3.0
+ *
+ * @param[in]  view            The view handle
+ * @param[in]  gesture         The user gesture, one of listed in
+ * #map_gesture_e
+ * @param[out] enabled         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 map_view_create().
+ * @pre @a enabled status set ad default or modified using
+ * map_view_set_gesture_enabled().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_view_h view is created ahead
+
+int error = MAPS_ERROR_NONE;
+bool enabled = false;
+
+// Find out if the long press gesture is enabled
+error = map_view_get_gesture_enabled(view, MAP_GESTURE_PRESS, &enabled);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the error
+}
+ * @endcode
+ *
+ * @see #map_gesture_e
+ * @see map_view_set_gesture_enabled()
+ * @see map_view_set_gesture_action()
+ * @see map_view_get_gesture_action()
+ * @see map_view_create()
+ */
+int map_view_get_gesture_enabled(map_view_h view,
+                                const map_gesture_e gesture,
+                                bool *enabled);
+
+
+/*----------------------------------------------------------------------------*/
+/*
+ * Snapshot Capture Service
+ */
+
+/**
+ * @ingroup    CAPI_MAP_VIEW_MODULE
+ * @defgroup   CAPI_MAP_VIEW_SNAPSHOT_MODULE Snapshot
+ *
+ * @addtogroup CAPI_MAP_VIEW_SNAPSHOT_MODULE
+ * @{
+ * @brief This provides APIs allowing to capture Map Snapshots.
+ *
+ */
+
+/**
+ * @brief      Called when snapshot requested with the
+ * map_view_capture_snapshot().
+ * @details The Map View invokes this callback while retrieving a snapshot of
+ * the current Map View.
+ * \n If snapshot capturing is failed, the value of @a snapshot is NULL.
+ * @since_tizen 3.0
+ * @remarks The @a snapshot must be released using map_snapshot_destroy().
+ *
+ * @param[in]  result          The result of request
+ * @param[in]  snapshot        The snapshot handle
+ * @param[in]  user_data       The pointer to user data passed from
+ * map_view_capture_snapshot()
+ *
+ * @pre map_view_capture_snapshot() will invoke this callback.
+ *
+ * @see map_view_capture_snapshot()
+ * @see #map_snapshot_h
+ */
+typedef void (*map_view_snapshot_cb) (maps_error_e result,
+                                    map_snapshot_h snapshot,
+                                    void *user_data);
+
+/**
+ * @brief      Captures a snapshot of the Map View.
+ * \n The request is synchronous.
+ * @details This function retrieves an image of a map currently represented on
+ * the Map View.
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/mapservice
+ * @remarks To check if Maps Provider is capable of capturing snapshots use
+ * maps_service_provider_is_service_supported() with
+ * #MAPS_SERVICE_CAPTURE_SNAPSHOT passed as @a service parameter.
+ *
+ * @param[in]  view            The Map View handle
+ * @param[in]  capture_overlay The flag indicating if capturing overlay (markers,
+ * polylines, polygons, etc.) needed
+ * @param[in]  callback        The callback which will receive snapshot
+ * @param[in]  user_data       The pointer to user data to be passed to the
+ * callback function
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval     #MAPS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @retval     #MAPS_ERROR_PERMISSION_DENIED Permission Denied
+ * @retval     #MAPS_ERROR_NOT_SUPPORTED Not supported
+ * @retval     #MAPS_ERROR_INVALID_OPERATION Operation is not valid
+ * @retval     #MAPS_ERROR_UNKNOWN Unknown error
+ *
+ * @pre Call maps_service_create() and map_view_create() to issue Maps Service
+ * and Map View handles respectively.
+ * @post It invokes map_view_snapshot_cb() to deliver requested snapshot.
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+static void _snapshot_cb(maps_error_e result, int request_id,
+                        map_snapshot_h snapshot, void *user_data)
+{
+       if (!snapshot || !user_data)
+               return false;
+
+       Evas_Object *map_snapshot = (Evas_Object *)user_data;
+
+       // Get snapshot pixels
+       unsigned int *pixels = NULL;
+       int error = map_snapshot_get_data(snapshot, &pixels);
+       if (error == MAPS_ERROR_NONE) {
+               // Draw snapshot on the canvas
+               evas_object_image_data_set(map_snapshot, pixels);
+       }
+
+       // Optionally it is possible to fetch also the snapshot
+       // - central coordinates and area
+       // - zoom level and factor
+       // - orientation
+       // - Evas color space
+       // - etc.
+
+       map_snapshot_destroy(snapshot);
+}
+
+int main(int argc, char *argv[])
+{
+       maps_service_h maps = NULL;
+       map_view_h view = NULL;
+       maps_coordinates_h center = NULL;
+       Evas_Object *parent = NULL;
+       Evas_Object *map_snapshot = NULL;
+       int error = MAPS_ERROR_NONE;
+       int request_id = 0;
+
+       do {
+
+               // Create an instance of Maps Service
+               error = maps_service_create("MapsProvider", &maps);
+               if (error != MAPS_ERROR_NONE)
+                       break;
+
+               // Set security key
+               maps_service_set_provider_key(maps, "your-security-key");
+
+               // create an instance of Map View and application UI controls
+               // parent = evas_object_box_add ...
+               // map_snapshot = evas_object_image_add(parent_canvas);
+               error = map_view_create(maps, parent, &view);
+               if (error != MAPS_ERROR_NONE)
+                       break;
+
+               // Specify Snapshot center
+               maps_coordinates_create(39.930661, 23.695172, &center);
+
+               error = map_view_set_center(view, center);
+               if (error != MAPS_ERROR_NONE)
+                       break;
+
+               error = map_view_set_zoom_level(view, 12);
+               if (error != MAPS_ERROR_NONE)
+                       break;
+
+               // Capture snapshot
+               error = map_view_capture_snapshot(view,
+                                                 center,
+                                                 false,
+                                                 _snapshot_cb,
+                                                 map_snapshot);
+
+               if (error != MAPS_ERROR_NONE)
+                       break;
+
+       } while(false);
+
+       // Release the Map View, Maps Service and used resources
+       maps_coordinates_destroy(center);
+       map_view_destroy(view);
+       maps_service_destroy(maps);
+       return error;
+}
+ * @endcode
+ *
+ * @see map_view_snapshot_cb()
+ * @see maps_service_capture_snapshot()
+ * @see #map_snapshot_h
+ * @see map_snapshot_destroy()
+ * @see map_view_create()
+ * @see maps_service_create()
+ */
+int map_view_capture_snapshot(const map_view_h view,
+                             bool capture_overlay,
+                             map_view_snapshot_cb callback,
+                             void *user_data);
+
+
+/* ---------------------VISUAL OBJECTS ON THE MAP-----------------------------*/
+
+/**
+ * @brief      Adds a visual object on the map.
+ * @details This function adds a visual object on the map.
+ * @since_tizen 3.0
+ * @remarks The @a object handle will be released automatically when the view is
+ * destroyed in the map_view_destroy().
+ *
+ * @param[in]  view            The view handle
+ * @param[in]  object          The handle of the object to add
+ * @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 map_view_create().
+ * @pre @a object is created using #map_object_create_marker(),
+ * map_object_create_polygon(), map_object_create_polyline() or
+ * map_object_create_group()
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_view_h view is created ahead
+
+int error = MAPS_ERROR_NONE;
+map_object_h marker = NULL;
+maps_coordinates_h coordinates = NULL;
+
+
+// Obtain a geographical position to put a marker
+error = maps_coordinates_create(39.929386, 23.696087, &coordinates);
+if(error != MAPS_ERROR_NONE) {
+       // Handle the create coordinates error
+}
+
+// Create an instance of a marker
+error = map_object_create_marker(coordinates,
+                               "resources/marker_icon.png",
+                               MAP_MARKER_POI,
+                               &marker);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the create marker error
+}
+
+// Add marker on the map
+error = map_view_add_object(maps_view, marker);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the add marker error
+}
+
+// Release coordinates
+maps_coordinates_destroy(coordinates);
+ * @endcode
+ *
+ * @see #map_object_h
+ * @see map_object_create_marker()
+ * @see map_object_create_polygon()
+ * @see map_object_create_polyline()
+ * @see map_object_create_group()
+ * @see map_view_remove_object()
+ * @see map_view_remove_all_objects()
+ * @see map_view_create()
+ */
+int map_view_add_object(map_view_h view, map_object_h object);
+
+
+/**
+ * @brief      Removes a visual object from the map.
+ * @details This function removes a visual object from the map.
+ * @since_tizen 3.0
+ * @remarks The @a object handle will be released automatically by the Map View.
+ *
+ * @param[in]  view            The view handle
+ * @param[in]  object          The object to remove
+ * @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 map_view_create().
+ * @pre @a object is added using map_view_add_object().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_view_h view is created ahead
+// map_object_h marker is created ahead
+
+int error = MAPS_ERROR_NONE;
+
+// Removing a visual object from the map
+error = map_view_remove_object(view, marker);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the add marker error
+}
+ * @endcode
+ *
+ * @see map_view_add_object()
+ * @see map_view_remove_all_objects()
+ * @see #map_object_h
+ * @see map_view_create()
+ */
+int map_view_remove_object(map_view_h view, const map_object_h object);
+
+/**
+ * @brief      Removes all visual objects from the map.
+ * @details This function removes all visual object from the map.
+ * @since_tizen 3.0
+ * @remarks All object handles will be released automatically by the Map View.
+ *
+ * @param[in]  view            The view handle
+ * @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 map_view_create().
+ * @pre objects are added using map_view_add_object().
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_view_h view is created ahead
+
+int error = MAPS_ERROR_NONE;
+
+// Removing a visual object from the map
+error = map_view_remove_all_objects(view);
+if (error != MAPS_ERROR_NONE) {
+       // Handle the add marker error
+}
+ * @endcode
+ *
+ * @see #map_object_h
+ * @see map_view_add_object()
+ * @see map_view_remove_all_objects()
+ * @see map_view_create()
+ */
+int map_view_remove_all_objects(map_view_h view);
+
+
+/**
+ * @brief      Retrieves all visual objects on the map.
+ * @details This function retrieves all visual objects, previously added to the
+ * map.
+ * @since_tizen 3.0
+ * @remarks The objects will be delivered via map_object_cb().
+ *
+ * @param[in]  view            The view handle
+ * @param[in]  callback        The callback function to invoke
+ * @param[in]  user_data       The user data pointer to be passed to the
+ * callback function
+ * @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_FOUND Result not found
+ * @retval     #MAPS_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @pre @a view is created using map_view_create().
+ * @pre objects are added using map_view_add_object().
+ * @post This function invokes map_object_cb() repeatedly to retrieve each
+ * visual object.
+ *
+ * @par Example
+ * @code
+#include <map_view.h>
+
+// map_view_h view is created ahead
+
+static bool draw_map_object_cb(int index, int total,
+                            map_object_h object,
+                            void *user_data)
+{
+       if (!object)
+               return false;
+
+       bool visible = false;
+       map_object_type_e type = MAP_OBJECT_UNKNOWN;
+       int error = MAPS_ERROR_NONE;
+
+       error = map_object_get_visible(object, &visible);
+       if (error != MAPS_ERROR_NONE)
+               return false;
+
+       if (!visible)
+               return true; // This object should not be drawn
+
+       // Extract the type of the object
+       error = map_object_get_type(object, &type);
+       if (error != MAPS_ERROR_NONE)
+               return false;
+
+       // Dispatch the drawing routines
+       switch(type) {
+       case MAP_OBJECT_MARKER:
+               __draw_marker(object);
+               break;
+       case MAP_OBJECT_POLYLINE:
+               __draw_polyline(object);
+               break;
+       case MAP_OBJECT_POLYGON:
+               __draw_polygon(object);
+               break;
+       case MAP_OBJECT_GROUP:
+               __draw_group(object);
+               break;
+       case MAP_OBJECT_UNKNOWN:
+       default:
+               // Handle the error of unsupported Map View Object type
+               break;
+       }
+       return true;
+}
+
+static void iterate_through_objects()
+{
+       const int error = map_view_foreach_object(view,
+                                                 draw_map_object_cb,
+                                                 NULL);
+       if (error != MAPS_ERROR_NONE) {
+               // Handle the error
+       }
+       return error;
+}
+ * @endcode
+ *
+ * @see #map_object_h
+ * @see map_object_cb()
+ * @see map_view_add_object()
+ * @see map_view_remove_object()
+ * @see map_view_remove_all_objects()
+ * @see map_view_create()
+ */
+int map_view_foreach_object(const map_view_h view,
+                           map_object_cb callback,
+                           void *user_data);
+
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif                         /* __MAP_VIEW_H__*/
index 726a7c37cfb73a135b7a9afe22311be8732db374..37bae9aab2c7ecccd49e500e161a60991e0dbcff 100644 (file)
@@ -35,19 +35,19 @@ extern "C" {
 #endif
 
 /**
- * @brief      The Address handle.
- * @details The Address handle can be obtained via call of
- * maps_address_create().
- * @remarks To release the handle use maps_address_destroy().
- * \n To clone the handle use maps_address_clone().
+ * @brief      The address handle.
+ * @details The address handle can be obtained via calling of maps_address_create()
  * @since_tizen 2.4
- *
- * @see maps_address_create()
- * @see maps_address_destroy()
- * @see maps_address_clone()
  */
 typedef void *maps_address_h;
 
+/**
+ * @brief The address list handle
+ * @details The address list handle can be obtained via calling of maps_address_list_create().
+ * @since_tizen 3.0
+ */
+typedef void *maps_address_list_h;
+
 /*----------------------------------------------------------------------------*/
 
 /**
@@ -489,6 +489,111 @@ int maps_address_set_postal_code(maps_address_h address,
  */
 int maps_address_set_freetext(maps_address_h address, const char *freetext);
 
+/**
+ * @brief      Creates a address list having a set of addresses.
+ * @since_tizen 3.0
+ *
+ * @param[out] address_list    The address list handle
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval     #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see maps_address_list_destroy()
+ */
+int maps_address_list_create(maps_address_list_h *address_list);
+
+/**
+ * @brief      Appends an address to an address list.
+ * @since_tizen 3.0
+ *
+ * @param[in]  address_list    The address list handle
+ * @param[in]  address The address handle
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval     #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see maps_address_list_create()
+ * @see maps_address_list_destroy()
+ */
+int maps_address_list_append(maps_address_list_h address_list, maps_address_h address);
+
+/**
+ * @brief      Removes an address from an address list.
+ * @since_tizen 3.0
+ *
+ * @param[in]  address_list    The address list handle
+ * @param[in]  address The address handle
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_address_list_create()
+ * @see maps_address_list_destroy()
+ */
+int maps_address_list_remove(maps_address_list_h address_list, maps_address_h address);
+
+/**
+ * @brief      Gets the number of elements in an address list.
+ * @since_tizen 3.0
+ *
+ * @param[in]  address_list    The address list handle
+ * @param[out] length  The number of elements in the address list
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_address_list_create()
+ * @see maps_address_list_destroy()
+ */
+int maps_address_list_get_length(maps_address_list_h address_list, int *length);
+
+/**
+ * @brief      Called iteratively to get address information.
+ * @since_tizen 3.0
+ *
+ * @param[in]  index   The index of iteration
+ * @param[in]  address The address handle
+ * @param[in]  user_data       The user data passed from the foreach function
+ *
+ * @return @c true to continue with the next iteration of the loop, \n
+ *         @c false to break out of the loop
+ * @see maps_address_list_foreach_address()
+ */
+typedef bool (*maps_address_cb)(int index, maps_address_h address, void *user_data);
+
+/**
+ * @brief Retrieves all addresses by invoking a specific callback for each address of address list.
+ * @since_tizen 3.0
+ *
+ * @param[in]  address_list    The address list handle
+ * @param[in]  callback        The iteration callback
+ * @param[in]  user_data       The user data to be passed to the callback function
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_address_list_create()
+ * @see maps_address_list_destroy()
+ * @see maps_address_list_get_length()
+ */
+int maps_address_list_foreach(maps_address_list_h address_list, maps_address_cb callback, void *user_data);
+
+/**
+ * @brief      Frees all of the memory used by a address list.
+ * @since_tizen 3.0
+ *
+ * @param[in]  address_list    The address list handle
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_address_list_create()
+ */
+int maps_address_list_destroy(maps_address_list_h address_list);
+
+
 #ifdef __cplusplus
 }
 #endif
index f122d84d452abc2778de6ae015d6b595746bb331..840aabb0447e3886ebf5b4841650825f70bb3dfa 100644 (file)
@@ -56,10 +56,7 @@ typedef void *maps_area_h;
  * @brief      Enumeration of supported types of the Geographical Area.
  * @details This enumeration represents allowed geographical type of
  * Geographical Area: rectangular and circular.
- * \n This enumeration is used in #maps_area_s.
  * @since_tizen 2.4
- *
- * @see maps_area_s
  */
 typedef enum {
        MAPS_AREA_NONE = 0, /**< Undefined geographical area type. */
@@ -71,10 +68,9 @@ typedef enum {
  * @brief      Structure of the rectangular Geographical Area.
  * @details This structure represents a rectangular Geographical Area,
  * specified with left top and right bottom coordinates.
- * \n This structure is used in #maps_area_s.
+ * @warning Do not use #maps_area_rectangle_s directly
+ * if you are an application developer.
  * @since_tizen 2.4
- *
- * @see maps_area_s
  */
 typedef struct _maps_area_rectangle_s {
        maps_coordinates_s top_left;            /**< The top left position
@@ -87,13 +83,11 @@ typedef struct _maps_area_rectangle_s {
  * @brief      Structure of the circular Geographical Area, specified with a
  * center coordinates and a radius.
  * @details This structure represents a circular Geographical Area.
- * \n This structure is used in #maps_area_s.
+ * @warning Do not use #maps_area_circle_s directly
+ * if you are an application developer.
  * @since_tizen 2.4
- *
- * @see maps_area_s
  */
 typedef struct _maps_area_circle_s {
-
        maps_coordinates_s center;      /**< The center position of a circle. */
        double radius;                  /**< The radius of a circle. */
 } maps_area_circle_s;
@@ -102,11 +96,10 @@ typedef struct _maps_area_circle_s {
  * @brief      Structure of the Geographical Area.
  * @details This structure represents a Geographical Area, specified with a
  * type, circular or rectangular, and appropriate coordinates and radius.
+ * @warning Do not use #maps_area_s directly
+ * if you are an application developer.
+ * Using #maps_area_h is recommanded.
  * @since_tizen 2.4
- *
- * @see maps_area_type_e
- * @see maps_area_rectangle_s
- * @see maps_area_circle_s
  */
 typedef struct _maps_area_s {
        maps_area_type_e type;  /**< The area type of this information. */
@@ -123,7 +116,7 @@ typedef struct _maps_area_s {
 /**
  * @brief      Creates a rectangular type of new Geographical Area with a
  * specified information.
- * @details This function creates a rectangular type of new #maps_area_s with a
+ * @details This function creates a rectangular type of new #maps_area_h with a
  * specified left top and right bottom coordinates.
  * @since_tizen 2.4
  * @remarks @a area must be released using maps_area_destroy().
@@ -145,7 +138,6 @@ typedef struct _maps_area_s {
  * @see maps_area_clone()
  * @see maps_area_destroy()
  * @see maps_area_create_circle()
- * @see maps_area_s
  * @see maps_coordinates_create()
  * @see maps_coordinates_destroy()
  */
@@ -156,12 +148,14 @@ int maps_area_create_rectangle(const maps_coordinates_h top_left,
 /**
  * @brief      Creates a circular type of new Geographical Area with a
  * specified information.
- * @details This function creates a circular type of new #maps_area_s
+ * @details This function creates a circular type of new #maps_area_h
  * Geographical Area with a specified center coordinates and a radius.
  * @since_tizen 2.4
  * @remarks @a area must be released using maps_area_destroy().
- * \n @a top_left and @a bottom_right must be released using
- * maps_coordinates_destroy().
+ * \n @a center must be released using maps_coordinates_destroy().
+ * \n The @a radius is specified in units, listed in #maps_distance_unit_e.
+ * \n To get and set distance units use maps_preference_get_distance_unit() and
+ * maps_preference_set_distance_unit() respectively.
  *
  * @param[in]  center          The central position of the area
  * @param[in]  radius          The radius of the area
@@ -176,20 +170,21 @@ int maps_area_create_rectangle(const maps_coordinates_h top_left,
  * @see maps_area_clone()
  * @see maps_area_destroy()
  * @see maps_area_create_rectangle()
- * @see maps_area_s
  * @see maps_coordinates_create()
  * @see maps_coordinates_destroy()
+ * @see maps_preference_get_distance_unit()
+ * @see maps_preference_set_distance_unit()
  */
 int maps_area_create_circle(const maps_coordinates_h center,
                            const double radius, maps_area_h *area);
 
 /**
  * @brief      Destroys the Geographical Area and releases all its resources.
- * @details This function destroys the Geographical Area #maps_area_s and
+ * @details This function destroys the Geographical Area #maps_area_h and
  * releases all its resources.
  * @since_tizen 2.4
  *
- * @param[in]  area            The area #maps_area_s
+ * @param[in]  area            The area #maps_area_h
  * @return     0 on success, otherwise a negative error value
  * @retval     #MAPS_ERROR_NONE Successful
  * @retval     #MAPS_ERROR_OUT_OF_MEMORY Out of memory
@@ -206,12 +201,12 @@ int maps_area_destroy(maps_area_h area);
 /**
  * @brief      Clones the Geographical Area.
  * @details This function makes a clone of the @a origin Geographical Area of
- * type #maps_area_s.
+ * type #maps_area_h.
  * @since_tizen 2.4
  * @remarks @a cloned must be released using maps_area_destroy().
  *
- * @param[in]  origin          The area #maps_area_s to be copied
- * @param[out] cloned          The cloned area #maps_area_s handle
+ * @param[in]  origin          The area #maps_area_h to be copied
+ * @param[out] cloned          The cloned area #maps_area_h handle
  * @return     0 on success, otherwise a negative error value
  * @retval     #MAPS_ERROR_NONE Successful
  * @retval     #MAPS_ERROR_OUT_OF_MEMORY Out of memory
@@ -223,7 +218,6 @@ int maps_area_destroy(maps_area_h area);
  * @see maps_area_create_rectangle()
  * @see maps_area_create_circle()
  * @see maps_area_destroy()
- * @see maps_area_s
  */
 int maps_area_clone(const maps_area_h origin, maps_area_h *cloned);
 
index 28b142f7b4157d9fadb959b89e8457f5580b88a7..3ac1b10b129bbc913bf59e6366c62846011df9bc 100644 (file)
@@ -39,10 +39,6 @@ extern "C" {
  * @since_tizen 2.4
  * @remarks To release the handle use maps_coordinates_destroy().
  * \n To clone the handle use maps_coordinates_clone().
- *
- * @see maps_coordinates_create()
- * @see maps_coordinates_destroy()
- * @see maps_coordinates_clone()
  */
 typedef void *maps_coordinates_h;
 
@@ -53,34 +49,40 @@ typedef void *maps_coordinates_h;
  * \n The @a latitude must be in range of [-90.0, 90.0].
  * \n The @a longitude must be in range of [-180.0, 180.0].
  * @since_tizen 2.4
- * @remarks #maps_coordinates_h is a void pointer to the #maps_coordinates_s.
+ * @remarks #maps_coordinates_h is a void pointer to the #maps_coordinates_h.
+ * @warning Do not use #maps_coordinates_s directly if you are an application developer.
+ * Using #maps_coordinates_h is recommanded.
  *
  * @see maps_coordinates_h
- * @see maps_coordinates_create
- * @see maps_coordinates_clone
- * @see maps_coordinates_destroy
  */
 typedef struct _maps_coordinates_s {
        double latitude;        /**< The latitude [-90.0 ~ 90.0] (degrees) */
        double longitude;       /**< The longitude [-180.0 ~ 180.0] (degrees) */
 } maps_coordinates_s;
 
+/**
+ * @brief      The coorinates list handle.
+ * @details The coorindates list handle can be obtained via calling of maps_coordinates_list_create().
+ * @since_tizen 3.0
+ */
+typedef void *maps_coordinates_list_h;
+
 /*----------------------------------------------------------------------------*/
 
 /**
  * @brief      Creates a new instance of Geographical Coordinates and initiates
  * a handle with it.
  * @details This function creates @a coordinates, a new instance of Geographical
- * Coordinates of type #maps_coordinates_s
+ * Coordinates of type #maps_coordinates_h
  * with a specified @a latitude and @a longitude.
  * \n New handle is assigned with this instance.
  * @since_tizen 2.4
  * @remarks @a coordinates must be released using maps_coordinates_destroy().
  * \n @a coordinates may be cloned using maps_coordinates_clone().
  *
- * @param[in]  latitude        Latitude
- * @param[in]  longitude       Longitude
- * @param[out] coordinates     The coordinate handle
+ * @param[in]  latitude        The latitude [-90.0 ~ 90.0] (degrees)
+ * @param[in]  longitude       The longitude [-180.0 ~ 180.0] (degrees)
+ * @param[out] coordinates     The coordinates handle
  * @return     0 on success, otherwise a negative error value
  * @retval     #MAPS_ERROR_NONE Successful
  * @retval     #MAPS_ERROR_OUT_OF_MEMORY Out of memory
@@ -88,7 +90,6 @@ typedef struct _maps_coordinates_s {
  *
  * @see maps_coordinates_clone()
  * @see maps_coordinates_destroy()
- * @see maps_coordinates_s
  */
 int maps_coordinates_create(const double latitude, const double longitude,
                            maps_coordinates_h *coordinates);
@@ -97,7 +98,7 @@ int maps_coordinates_create(const double latitude, const double longitude,
  * @brief      Destroys the Geographical Coordinates and releases all its
  * resources.
  * @details This function destroys the Geographical Coordinates
- * #maps_coordinates_s and releases all its resources.
+ * #maps_coordinates_h and releases all its resources.
  * @since_tizen 2.4
  *
  * @param[in]  coordinates     The coordinate handle to destroy
@@ -115,7 +116,7 @@ int maps_coordinates_destroy(maps_coordinates_h coordinates);
 /**
  * @brief      Clones the Geographical Coordinates.
  * @details This function makes a clone of the @a origin Geographical
- * Coordinates of type #maps_coordinates_s.
+ * Coordinates of type #maps_coordinates_h.
  * @since_tizen 2.4
  * @remarks @a cloned must be released using maps_coordinates_destroy().
  *
@@ -130,7 +131,6 @@ int maps_coordinates_destroy(maps_coordinates_h coordinates);
  *
  * @see maps_coordinates_create()
  * @see maps_coordinates_destroy()
- * @see maps_coordinates_s
  */
 int maps_coordinates_clone(const maps_coordinates_h origin,
                           maps_coordinates_h *cloned);
@@ -175,6 +175,27 @@ int maps_coordinates_get_latitude(const maps_coordinates_h coordinates,
 int maps_coordinates_get_longitude(const maps_coordinates_h coordinates,
                                   double *longitude);
 
+/**
+ * @brief      Gets the latitude and longitude of the coordinates.
+ * @details This function gets the @a longitude and @a longitude value of the
+ * coordinates handle.
+ * @since_tizen 3.0
+ *
+ * @param[in]  coordinates     The coordinate handle
+ * @param[out] latitude        The latitude of the coordinate handle
+ * @param[out] longitude       The longitude of the coordinate handle
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a coordinates are created using maps_coordinates_create().
+ *
+ * @see maps_coordinates_create()
+ * @see maps_coordinates_set_latitude_longitude()
+ */
+int maps_coordinates_get_latitude_longitude(const maps_coordinates_h coordinates,
+                               double *latitude,
+                               double *longitude);
 /*----------------------------------------------------------------------------*/
 
 /**
@@ -215,6 +236,131 @@ int maps_coordinates_set_latitude(maps_coordinates_h coordinates,
 int maps_coordinates_set_longitude(maps_coordinates_h coordinates,
                                   const double longitude);
 
+/**
+ * @brief      Sets the latitude and longitude of the coordinates.
+ * @details This function sets the @a latitude and @a latitude value of the
+ * coordinates handle.
+ * @since_tizen 3.0
+ *
+ * @param[in]  coordinates     The coordinates handle
+ * @param[in]  latitude        The latitude [-90.0 ~ 90.0] (degrees)
+ * @param[in]  longitude       The longitude [-180.0 ~ 180.0] (degrees)
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a coordinates are created using maps_coordinates_create().
+ *
+ * @see maps_coordinates_create()
+ * @see maps_coordinates_get_latitude_longitude()
+ */
+int maps_coordinates_set_latitude_longitude(maps_coordinates_h coordinates,
+                               const double latitude,
+                               const double longitude);
+
+/**
+ * @brief      Creates a coordinates list having a set of coordinates.
+ * @since_tizen 3.0
+ *
+ * @param[out] coordinates_list        The coordinates list handle
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval     #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see maps_coordinates_list_destroy()
+ */
+int maps_coordinates_list_create(maps_coordinates_list_h *coordinates_list);
+
+/**
+ * @brief      Frees all of the memory used by a coordinates list.
+ * @since_tizen 3.0
+ *
+ * @param[in]  coordinates_list        coordinates list handle
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_coordinates_list_create()
+ */
+int maps_coordinates_list_destroy(maps_coordinates_list_h coordinates_list);
+
+/**
+ * @brief      Appends a coordinates to a coordinates list.
+ * @since_tizen 3.0
+ *
+ * @param[in]  coordinates_list        The coordinates list handle
+ * @param[in]  coordinates     The coordinates handle
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval     #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see maps_coordinates_list_create()
+ * @see maps_coordinates_list_destroy()
+ */
+int maps_coordinates_list_append(maps_coordinates_list_h coordinates_list, maps_coordinates_h coordinates);
+
+/**
+ * @brief      Removes a coordinates from a coordinates list.
+ * @since_tizen 3.0
+ *
+ * @param[in]  coordinates_list        The coordinates list handle
+ * @param[in]  coordinates     The coordinates handle
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_coordinates_list_create()
+ * @see maps_coordinates_list_destroy()
+ */
+int maps_coordinates_list_remove(maps_coordinates_list_h coordinates_list, maps_coordinates_h coordinates);
+
+/**
+ * @brief      Gets the number of elements in an coordinates list.
+ * @since_tizen 3.0
+ *
+ * @param[in]  coordinates_list        The coordinates list handle
+ * @param[out] length  The number of elements in the coordinates list
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_coordinates_list_create()
+ * @see maps_coordinates_list_destroy()
+ */
+int maps_coordinates_list_get_length(maps_coordinates_list_h coordinates_list, int *length);
+
+/**
+ * @brief      Called iteratively to get a coordinates information.
+ * @since_tizen 3.0
+ *
+ * @param[in]  index           The index of iteration
+ * @param[in]  coordinates     The handle of coordinates
+ * @param[in]  user_data       The user data passed from the foreach function
+ * @return @c true to continue with the next iteration of the loop, \n
+ *         @c false to break out of the loop
+ *
+ * @see batch_coordinates_foreach_coordinates()
+ */
+typedef bool (*maps_coordinates_cb) (int index, maps_coordinates_h coordinates, void *user_data);
+
+/**
+ * @brief Retrieves all coordinates by invoking a specific callback for each coordinates of coordinates list.
+ * @since_tizen 3.0
+ *
+ * @param[in]  coordinates_list        The coordinates list handle
+ * @param[in]  callback        The iteration callback
+ * @param[in]  user_data       The user data to be passed to the callback function
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_coordinates_list_create()
+ * @see maps_coordinates_list_destroy()
+ * @see maps_coordinates_list_get_length()
+ */
+int maps_coordinates_list_foreach(maps_coordinates_list_h coordinates_list, maps_coordinates_cb callback, void *user_data);
+
+
 #ifdef __cplusplus
 }
 #endif
index 948998c79588e26fd93afbeb9e722ec563e8f4ab..3efec42372b24b666d315287da7e21626ef10c84 100644 (file)
@@ -41,35 +41,48 @@ extern "C" {
  * @since_tizen 2.4
  */
 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 */
+
        MAPS_ERROR_INVALID_PARAMETER =
                TIZEN_ERROR_INVALID_PARAMETER,  /**< Invalid parameter */
+
        MAPS_ERROR_NOT_SUPPORTED =
                TIZEN_ERROR_NOT_SUPPORTED,      /**< Not supported */
+
        MAPS_ERROR_CONNECTION_TIME_OUT =
                TIZEN_ERROR_CONNECTION_TIME_OUT,/**< Timeout error, no answer */
+
        MAPS_ERROR_NETWORK_UNREACHABLE =
                TIZEN_ERROR_NETWORK_UNREACHABLE,/**< Network unavailable*/
+
        MAPS_ERROR_INVALID_OPERATION =
                TIZEN_ERROR_INVALID_OPERATION,  /**< Operation is not valid */
+
        MAPS_ERROR_KEY_NOT_AVAILABLE =
                TIZEN_ERROR_KEY_NOT_AVAILABLE,  /**< Invalid key */
+
        MAPS_ERROR_RESOURCE_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 */
+
        MAPS_ERROR_SERVICE_NOT_AVAILABLE =
-               TIZEN_ERROR_MAPS_SERVICE | 0x01,/**< Service
-                                                          unavailable */
+               TIZEN_ERROR_MAPS_SERVICE | 0x01,/**< Service unavailable */
+
        MAPS_ERROR_NOT_FOUND =
                TIZEN_ERROR_MAPS_SERVICE | 0x02/**< Result not found */
+
 } maps_error_e;
 
 #ifdef __cplusplus
index a709d0e8cc5e07aa73bbdd8dbae50b858ed30b65..0b3caaa75f613eb95544e0c782b941686c47ff41 100644 (file)
  * @defgroup   CAPI_MAPS_CONTAINERS_MODULE Container Data Types
  *
  * @file maps_extra_types.h
- * @brief This file contains definitions and functions of useful data types.
+ * @brief This file contains definitions and functions of several Maps Service
+ * data types, such as lists and hash tables.
  *
  * @addtogroup CAPI_MAPS_CONTAINERS_MODULE
  * @{
- * @brief This provides variable Maps Service data types, such as lists and hash
+ * @brief This provides several Maps Service data types, such as lists and hash
  * tables.
  */
 
@@ -40,11 +41,9 @@ extern "C" {
  * @ingroup    CAPI_MAPS_CONTAINERS_MODULE
  * @defgroup   CAPI_MAPS_CONTAINERS_MODULE_ITEM_LIST Maps Item Lists
  *
- * @file maps_extra_types.h
- * @brief This section contains API for using List of item pointers.
- *
  * @addtogroup CAPI_MAPS_CONTAINERS_MODULE_ITEM_LIST
  * @{
+ * @file maps_extra_types.h
  * @brief This provides API for using List of item pointers.
  */
 
@@ -247,10 +246,39 @@ int maps_item_list_foreach(maps_item_list_h list,
 typedef int (*maps_item_list_free_cb) (void *data);
 
 /**
- * @brief      Removes and destroys all list items
+ * @brief      Removes and destroys list item.
+ * @details This function removes the given items from the @a list and releases
+ * resources, assigned with it.
+ * @since_tizen 2.4
+ * @remarks The @a item is destroyed with #maps_item_list_free_cb. If this
+ * callback is NULL, item will not be destroyed.
+ *
+ * @param[in]  list            The handle of list
+ * @param[in]  item            The to remove
+ * @param[in]  free_func       The callback to be invoked for destroying each
+ * list item
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a list is created using maps_item_list_create().
+ * @post #maps_item_list_free_cb is used to destroy the item of the list.
+ *
+ * @see maps_item_list_free_cb()
+ * @see maps_item_list_create()
+ * @see maps_item_list_remove_all()
+ */
+int maps_item_list_remove(maps_item_list_h list,
+                         void *item,
+                         maps_item_list_free_cb free_func);
+
+/**
+ * @brief      Removes and destroys all list items.
  * @details This function removes all items of the @a list and releases
  * resources, assigned with them.
- * @since_tizen 2.4
+ * If two elements contain the same data, only the first is removed.
+ * If none of the elements contain the data, the GList is unchanged.
+ * @since_tizen 3.0
  * @remarks Each item is destroyed with #maps_item_list_free_cb. If this
  * callback is NULL, items will not be destroyed.
  *
@@ -280,11 +308,9 @@ int maps_item_list_remove_all(maps_item_list_h list,
  * @ingroup    CAPI_MAPS_CONTAINERS_MODULE
  * @defgroup   CAPI_MAPS_CONTAINERS_MODULE_STRING_HASHTABLE Maps String Hash Tables
  *
- * @file maps_extra_types.h
- * @brief This section contains API for using Hash Table of strings.
- *
  * @addtogroup CAPI_MAPS_CONTAINERS_MODULE_STRING_HASHTABLE
  * @{
+ * @file maps_extra_types.h
  * @brief This provides API for using Hash Table of strings.
  */
 
@@ -527,11 +553,9 @@ int maps_string_hashtable_contains(maps_string_hashtable_h table,
  * @ingroup    CAPI_MAPS_CONTAINERS_MODULE
  * @defgroup   CAPI_MAPS_CONTAINERS_MODULE_ITEM_HASHTABLE Maps Item Hash Tables
  *
- * @file maps_extra_types.h
- * @brief This section contains API for using Hash Table of arbitrary items.
- *
  * @addtogroup CAPI_MAPS_CONTAINERS_MODULE_ITEM_HASHTABLE
  * @{
+ * @file maps_extra_types.h
  * @brief This provides API for using Hash Table of arbitrary items.
  */
 
@@ -1186,6 +1210,55 @@ int maps_item_hashtable_contains(maps_item_hashtable_h table, const char *key,
  * @}
  */
 
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @ingroup    CAPI_MAPS_CONTAINERS_MODULE
+ * @defgroup   CAPI_MAPS_CONTAINERS_MODULE_UTILITY Maps Container Utilities
+ *
+ * @addtogroup CAPI_MAPS_CONTAINERS_MODULE_UTILITY
+ * @{
+ * @file maps_extra_types.h
+ * @brief This provides API for helping usage of container types, such as
+ * maps_item_list_h and maps_item_hashtable_h.
+ */
+
+
+/**
+* @brief       Copies the table item of arbitrary type type without cloning.
+ * @details This is a helper function of type #maps_item_no_clone,
+ * which is useful while adding to the table or list an item of arbitrary type
+ * without cloning it. It allows to add to the container the given object
+ * instead of its clone and, consequently, reduce the memory consumption.
+ * This function is intended to be passed as the @a
+ * clone_func argument in functions, such as the maps_item_hashtable_set() ot
+ * maps_item_list_append().
+ * @since_tizen 3.0
+ * @remarks This function will be called implicitly in the
+ * maps_item_hashtable_clone(), maps_item_list_append() or similar procedure.
+ *
+ * @param[in]  origin          The pointer of the item to be cloned
+ * @param[out] cloned          The pointer of the clone
+ * @return     void pointer of a copy floating point number
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre maps_item_hashtable_clone() will invoke this callback.
+ * @pre maps_item_list_append() will invoke this callback.
+ *
+ * @see maps_item_list_append()
+ * @see maps_item_hashtable_clone_cb()
+ * @see maps_item_hashtable_set()
+ * @see maps_item_hashtable_free_float()
+ */
+int maps_item_no_clone(void *origin, void **cloned);
+
+/**
+ * @}
+ */
+
 /*----------------------------------------------------------------------------*/
 
 #ifdef __cplusplus
index 13f9ec6d4d5cfbfb8a6d640655e5d174f23e1d2b..bfba64106e33db32b04d441b15670af21a01c72c 100644 (file)
@@ -63,6 +63,12 @@ typedef void *maps_place_h;
 /**
  * @brief      Called when requesting the list of Place Properties.
  * @details This callback is invoked while iterating through the list of Place
+ *
+ *
+ * TODO: it would be greate to add such a detailed message to all callbacks
+ * /n This callback is synchronous.
+ *
+ *
  * Properties.
  * @since_tizen 2.4
  * @remarks @a key and @a value must be released using free() and corresponding
index e43961318a731ce415a9abdf34af6d4fa7fd4ce2..c06b0e9aaa5852948160c51d790a0331e22cc130 100644 (file)
@@ -19,7 +19,9 @@
 
 #include <maps_service.h>
 #include <maps_plugin_info.h>
+#include <map_view.h>
 #include <maps_extra_types.h>
+#include <maps_plugin_types.h>
 
 /**
  *
@@ -111,8 +113,6 @@ int maps_plugin_get_info(maps_plugin_info_h *info);
  * @since_tizen 2.4
  * @remarks To obtain the @a provider_key refer to corresponding Maps Provider
  * documentation.
- * \n For MapQuest refer to http://developer.mapquest.com/,
- * http://open.mapquestapi.com.
  * \n For HERE Maps refer to https://developer.here.com/,
  * https://developer.here.com/rest-apis.
  *
@@ -414,6 +414,47 @@ int maps_plugin_reverse_geocode(double latitude, double longitude,
                                maps_service_reverse_geocode_cb callback,
                                void *user_data, int *request_id);
 
+/**
+ * @brief      Gets the address list for a given position coordinates list.
+ * @details This function obtains structured address information for a given
+ * position coordinates.
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/mapservice
+ * @remarks This function requires network access.
+ * \n To cancel the request use maps_plugin_cancel_request().
+ * \n To check if Maps Provider is capable of Reverse Geocoding and which
+ * Reverse Geocode preferences are supported see the lists of capacities and
+ * preferences above.
+ *
+ * @param[in]  geocode_list    The position coordinates list
+ * @param[in]  preference              The set of preferences for processing Reverse Geocode
+ * @param[in]  callback                The callback which will receive address informations
+ * @param[in]  user_data               The user data to be passed to the callback function
+ * @param[out] request_id              The id of request
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval     #MAPS_ERROR_NETWORK_UNREACHABLE Network connection failed
+ * @retval     #MAPS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @retval     #MAPS_ERROR_PERMISSION_DENIED Permission Denied
+ * @retval     #MAPS_ERROR_NOT_SUPPORTED Not supported
+ * @retval     #MAPS_ERROR_CONNECTION_TIME_OUT Timeout error, no answer
+ * @retval     #MAPS_ERROR_INVALID_OPERATION Operation is not valid
+ * @retval     #MAPS_ERROR_NOT_FOUND Result not found
+ * @retval     #MAPS_ERROR_KEY_NOT_AVAILABLE Invalid key
+ * @retval     #MAPS_ERROR_UNKNOWN Unknown error
+ *
+ * @post This function invokes maps_service_multi_reverse_geocode_cb().
+ *
+ * @see maps_service_multi_reverse_geocode_cb()
+ * @see maps_plugin_cancel_request()
+ */
+int maps_plugin_multi_reverse_geocode(const maps_coordinates_list_h geocode_list,
+               const maps_preference_h preference, maps_service_multi_reverse_geocode_cb callback,
+               void *user_data, int *request_id);
+
+
 /*----------------------------------------------------------------------------*/
 /*
  * Place
@@ -717,6 +758,250 @@ int maps_plugin_search_route_waypoints(const maps_coordinates_h *waypoint_list,
  */
 int maps_plugin_cancel_request(int request_id);
 
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief      Set a maps view.
+ * @details This function sets a maps view to the plugin.
+ * @since_tizen 3.0
+ * @remarks When the Maps View is being destroying, the parameter @a view is set
+ * to NULL.
+ *
+ * @param[in]  view            The maps view
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see #map_view_h
+ */
+int maps_plugin_set_map_view(const map_view_h view);
+
+/**
+ * @brief      Called when the map rendering is finished.
+ * @details The Plugin invokes this callback when the rendering of the requested
+ * part of map is finished.
+ * @since_tizen 3.0
+ * @remarks The parameter @a center must be released using
+ * maps_coordinates_destroy().
+ * \n To use the @a center outside of this function, copy the handle using
+ * maps_coordinates_clone() function.
+ * \n The parameter @a area must be released using maps_area_destroy()
+ * \n To use the @a area outside of this function, copy the handle using
+ * maps_area_clone() function.
+ *
+ * @param[in]  result          The result of request
+ * @param[in]  request_id      The id of request, start from 0
+ * @param[in]  centes          The coordinates of the center of requested map
+ * area
+ * @param[in]  area            The requested map area
+ * @param[in]  user_data       The user data passed from
+ * maps_plugin_render_map()
+ * @return     @c true to continue with the next iteration of the loop, \n @c
+ * false to break out of the loop
+ *
+ * @pre maps_plugin_render_map() will invoke this callback.
+ *
+ * @see maps_plugin_render_map()
+ */
+typedef void(*maps_plugin_render_map_cb) (maps_error_e result, int request_id,
+                                         maps_coordinates_h center,
+                                         maps_area_h area,
+                                         void* user_data);
+
+/**
+ * @brief      Request a map rendering.
+ * @details This function request a draw routine of the map location with a
+ * specified zoom factor and rotation angle.
+ * @since_tizen 3.0
+ *
+ * @param[in]  coordinates     The coordinates of location to draw
+ * @param[in]  zoom_factor     The zoom factor
+ * @param[in]  rotation_angle  The rotation factor
+ * @param[in]  callback        The callback to notify that the rendering is
+ * finished
+ * @param[in]  user_data       The user data to be passed to the callback
+ * @param[out] request_id      The id of request
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre the maps view is set with maps_plugin_set_map_view().
+ * @post It invokes maps_plugin_render_map_cb() to notify that the rendering is
+ * finished
+ *
+ * @see maps_plugin_set_view()
+ * @see maps_plugin_render_map_cb()
+ * @see maps_plugin_draw_map()
+ */
+int maps_plugin_render_map(const maps_coordinates_h coordinates,
+                         const double zoom_factor,
+                         const double rotation_angle,
+                         maps_plugin_render_map_cb callback,
+                         void* user_data,
+                         int* request_id);
+
+/**
+ * @brief      Request the Plugin to move a map on a given delta.
+ * @details This function request the Plugin to move a map on a given delta
+ * screen coordinates. The current values of zoom or orientation are
+ * remaining same.
+ * @since_tizen 3.0
+ *
+ * @param[in]  delta_x         The delta x
+ * @param[in]  delta_y         The delta y
+ * @param[in]  callback        The callback to notify that the rendering is
+ * finished
+ * @param[in]  user_data       The user data to be passed to the callback
+ * @param[out] request_id      The id of request
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre the maps view is set with maps_plugin_set_map_view().
+ * @post It invokes maps_plugin_render_map_cb() to notify that the rendering is
+ * finished
+ *
+ * @see maps_plugin_set_view()
+ * @see maps_plugin_render_map_cb()
+ * @see maps_plugin_render_map()
+ * @see maps_plugin_draw_map()
+ */
+int maps_plugin_move_center(const int delta_x,
+                           const int delta_y,
+                           maps_plugin_render_map_cb callback,
+                           void* user_data,
+                           int* request_id);
+
+/**
+ * @brief      Draw a map on the maps view panel.
+ * @details This function draws the map, requested previously on the maps view
+ * panel in accordance with the current maps settings.
+ * @since_tizen 3.0
+ *
+ * @param[in]  canvas          The canvas to draw on
+ * @param[in]  x               The x coordinate on the canvas top left
+ * @param[in]  y               The y coordinate on the canvas top left
+ * @param[in]  width           The width of the cancas
+ * @param[in]  height          The height of the cancas
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre the draing routine is requested with preliminary call of
+ * maps_plugin_render_map().
+ *
+ * @see maps_plugin_set_view()
+ * @see maps_plugin_render_map()
+ */
+int maps_plugin_draw_map(Evas* canvas,
+                        const int x,
+                        const int y,
+                        const int width,
+                        const int height);
+
+/**
+ * @brief      Notifyes that the visual object is changed.
+ * @details This function notifyes the Plugin that the visual object is
+ * changed. The possible causes of changes are enumerated in
+ * #map_object_operation_e ind nclude object adding, moving, removing,
+ * visibility modificating or editing object specific properties.
+ * @since_tizen 3.0
+ *
+ * @param[in]  object          The object handle
+ * @param[in]  operation       The operation over the object
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_plugin_create()
+ */
+int maps_plugin_on_object(const map_object_h object,
+                              const map_object_operation_e operation);
+
+/**
+ * @brief      Converts screen coordinates to the geographical coordinates.
+ * @details This function converts screen coordinates to the geographical
+ * coordinates accordingly to the current maps settings.
+ * @since_tizen 3.0
+ *
+ * @param[in]  x               The x coordinate on the screen
+ * @param[in]  y               The y coordinate on the screen
+ * @param[out] coordinates     The corresponding geographical coordinates
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_plugin_create()
+ * @see maps_plugin_geography_to_screen()
+ * @see #maps_coordinates_h
+ */
+int maps_plugin_screen_to_geography(const int x, const int y,
+                                   maps_coordinates_h* coordinates);
+
+/**
+ * @brief      Converts geographical coordinates to the screen coordinates.
+ * @details This function converts geographical coordinates to the screen
+ * coordinates accordingly to the current maps settings.
+ * @since_tizen 3.0
+ * @privlevel public
+ *
+ * @param[in]  coordinates     The geographical coordinates
+ * @param[out] x               The corresponding x coordinate on the screen
+ * @param[out] y               The corresponding y coordinate on the screen
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_plugin_create()
+ * @see maps_plugin_screen_to_geography()
+ * @see #maps_coordinates_h
+ */
+int maps_plugin_geography_to_screen(const maps_coordinates_h coordinates,
+                                   int* x, int* y);
+
+/**
+ * @brief      Gets the minimal zooms level of the Map.
+ * @details This function gets the minimally available zoom level of the Map.
+ * @since_tizen 3.0
+ *
+ * @param[out] min_zoom_level  The minimally available zoom level
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_plugin_get_min_zoom_level(int *min_zoom_level);
+
+/**
+ * @brief      Gets the maximal zooms level of the Map.
+ * @details This function gets the maximally available zoom level of the Map.
+ * @since_tizen 3.0
+ *
+ * @param[out] max_zoom_level  The maximally available zoom level
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_plugin_get_max_zoom_level(int *max_zoom_level);
+
+/**
+ * @brief      Get the central coordinates of a Map.
+ * @details This function gets the central coordinates of a Map.
+ * @since_tizen 3.0
+ * @remarks @a coordinates must be released using maps_coordinates_destroy().
+ *
+ * @param[out] coordinates     The pointer to #maps_coordinates_h in which to
+ * store the geographical coordinates of the central position of the Map
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_plugin_get_min_zoom_level()
+ * @see maps_plugin_get_max_zoom_level
+ */
+int maps_plugin_get_center(maps_coordinates_h *coordinates);
+
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/include/maps_plugin_types.h b/include/maps_plugin_types.h
new file mode 100755 (executable)
index 0000000..5b2ff1d
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MAPS_PLUGIN_TYPES_H__
+#define __MAPS_PLUGIN_TYPES_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <glib.h>
+
+/**
+ * @brief      Structure of the coordinates list.
+ * @since_tizen 2.4
+ * @remarks #maps_coordinates_list_h is a void pointer to the #maps_coordinates_list_s.
+ */
+typedef GList maps_coordinates_list_s;
+
+/**
+ * @brief      Structure of the address list.
+ * @since_tizen 2.4
+ * @remarks #maps_address_list_h is a void pointer to the #maps_address_list_s.
+ */
+typedef GList maps_address_list_s;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif                         /* __MAPS_PLUGIN_TYPES_H__ */
+
+
index 6876915c9f9daa6350706d7bc58e70766093b011..591a19f61079996071a33cef6fee16870e2b9009 100644 (file)
@@ -171,10 +171,10 @@ typedef void *maps_preference_h;
  * @see #maps_preference_h
  */
 typedef enum _maps_distance_unit_e {
-    MAPS_DISTANCE_UNIT_M,      /**< for Meter */
-    MAPS_DISTANCE_UNIT_KM,     /**< for Kilometer */
-    MAPS_DISTANCE_UNIT_FT,     /**< for Foot */
-    MAPS_DISTANCE_UNIT_YD      /**< for Yard */
+       MAPS_DISTANCE_UNIT_M,   /**< for Meter */
+       MAPS_DISTANCE_UNIT_KM,  /**< for Kilometer */
+       MAPS_DISTANCE_UNIT_FT,  /**< for Foot */
+       MAPS_DISTANCE_UNIT_YD   /**< for Yard */
 } maps_distance_unit_e;
 
 /**
@@ -189,14 +189,21 @@ typedef enum _maps_distance_unit_e {
  * @see #_maps_route_request_feature_e
  */
 typedef enum _maps_route_optimization_e {
-    MAPS_ROUTE_TYPE_FASTEST,   /**< Indicates the fastest route */
-    MAPS_ROUTE_TYPE_SHORTEST,  /**< Indicates the shortest route
-                                 (car mode only) */
-    MAPS_ROUTE_TYPE_ECONOMIC,  /**< Indicates the most economic route
-                                 (car mode only) */
-    MAPS_ROUTE_TYPE_SCENIC,    /**< Indicates the most scenic route */
-    MAPS_ROUTE_TYPE_FASTESTNOW,        /**< Indicates the most fastest route now */
-    MAPS_ROUTE_TYPE_DIRECTDRIVE,/**< Indicates direct drive */
+
+       MAPS_ROUTE_TYPE_FASTEST, /**< Indicates the fastest route */
+
+       MAPS_ROUTE_TYPE_SHORTEST, /**< Indicates the shortest route
+                                   (car mode only) */
+
+       MAPS_ROUTE_TYPE_ECONOMIC, /**< Indicates the most economic route
+                                   (car mode only) */
+
+       MAPS_ROUTE_TYPE_SCENIC, /**< Indicates the most scenic route */
+
+       MAPS_ROUTE_TYPE_FASTESTNOW, /**< Indicates the most fastest route now */
+
+       MAPS_ROUTE_TYPE_DIRECTDRIVE /**< Indicates direct drive */
+
 } maps_route_optimization_e;
 
 /**
@@ -211,17 +218,22 @@ typedef enum _maps_route_optimization_e {
  * @see #_maps_route_request_feature_e
  */
 typedef enum _maps_route_transport_mode_e {
-    MAPS_ROUTE_TRANSPORT_MODE_CAR,             /**< Indicates that the route is
-                                                 to be traveled by car. */
-    MAPS_ROUTE_TRANSPORT_MODE_PEDESTRIAN,      /**< Indicates that the route is
-                                                 for a pedestrian. */
-    MAPS_ROUTE_TRANSPORT_MODE_BICYCLE,         /**< Indicates that the route is
-                                                 for a cyclist. */
-    MAPS_ROUTE_TRANSPORT_MODE_PUBLICTRANSIT,   /**< Indicates that the route is
-                                                 to be traveled  using public
-                                                 transport. */
-    MAPS_ROUTE_TRANSPORT_MODE_TRUCK            /**< Indicates that the route is
-                                                 for a truck. */
+
+       MAPS_ROUTE_TRANSPORT_MODE_CAR, /**< Indicates that the route is to be
+                                        traveled by car. */
+
+       MAPS_ROUTE_TRANSPORT_MODE_PEDESTRIAN, /**< Indicates that the route is
+                                               for a pedestrian. */
+
+       MAPS_ROUTE_TRANSPORT_MODE_BICYCLE, /**< Indicates that the route is for
+                                            a cyclist. */
+
+       MAPS_ROUTE_TRANSPORT_MODE_PUBLICTRANSIT, /**< Indicates that the route
+                                                  is to be traveled  using
+                                                  public transport. */
+
+       MAPS_ROUTE_TRANSPORT_MODE_TRUCK /**< Indicates that the route is for a
+                                         truck. */
 } maps_route_transport_mode_e;
 
 /**
@@ -236,15 +248,19 @@ typedef enum _maps_route_transport_mode_e {
  * @see #_maps_route_request_feature_e
  */
 typedef enum _maps_route_feature_weight_e {
-    MAPS_ROUTE_FEATURE_WEIGHT_NORMAL,          /**< Indicates normal
-                                                 weighting. */
-    MAPS_ROUTE_FEATURE_WEIGHT_PREFER,          /**< Indicates that a feature is
-                                                 preferred. */
-    MAPS_ROUTE_FEATURE_WEIGHT_AVOID,           /**< Indicates that a feature is
-                                                 to be avoided. */
-    MAPS_ROUTE_FEATURE_WEIGHT_SOFTEXCLUDE,     /**< Indicates that soft-exclude
-                                                 applies to the feature. */
-    MAPS_ROUTE_FEATURE_WEIGHT_STRICTEXCLUDE,   /**< Indicates that the feature
+
+       MAPS_ROUTE_FEATURE_WEIGHT_NORMAL, /**< Indicates normal weighting. */
+
+       MAPS_ROUTE_FEATURE_WEIGHT_PREFER, /**< Indicates that a feature is
+                                           preferred. */
+
+       MAPS_ROUTE_FEATURE_WEIGHT_AVOID, /**< Indicates that a feature is to be
+                                          avoided. */
+
+       MAPS_ROUTE_FEATURE_WEIGHT_SOFTEXCLUDE, /**< Indicates that soft-exclude
+                                                applies to the feature. */
+
+       MAPS_ROUTE_FEATURE_WEIGHT_STRICTEXCLUDE /**< Indicates that the feature
                                                  is to be strictly excluded. */
 } maps_route_feature_weight_e;
 
@@ -260,22 +276,31 @@ typedef enum _maps_route_feature_weight_e {
  * @see #_maps_route_feature_weight_e
  */
 typedef enum _maps_route_request_feature_e {
-    MAPS_ROUTE_FEATURE_NO,                     /**< Indicates no route features
-                                                 (are selected). */
-    MAPS_ROUTE_FEATURE_TOLL,                   /**< Indicates toll roads
-                                                 (toll gates/booths). */
-    MAPS_ROUTE_FEATURE_MOTORWAY,               /**< Indicates motorway. */
-    MAPS_ROUTE_FEATURE_BOATFERRY,              /**< Indicates a boat ferry. */
-    MAPS_ROUTE_FEATURE_RAILFERRY,              /**< Indicates rail (train)
-                                                 ferry. */
-    MAPS_ROUTE_FEATURE_PUBLICTTRANSIT,         /**< Indicates public
-                                                 transport. */
-    MAPS_ROUTE_FEATURE_TUNNEL,                 /**< Indicates tunnel. */
-    MAPS_ROUTE_FEATURE_DIRTROAD,               /**< Indicates dirt road. */
-    MAPS_ROUTE_FEATURE_PARKS,                  /**< Indicates park. */
-    MAPS_ROUTE_FEATURE_HOVLANE,                        /**< Indicates a high-occupancy
-                                                 vehicle lane. */
-    MAPS_ROUTE_FEATURE_STAIRS                  /**< Indicates stairs. */
+
+       MAPS_ROUTE_FEATURE_NO, /**< Indicates no route features
+                                 (are selected). */
+
+       MAPS_ROUTE_FEATURE_TOLL, /**< Indicates toll roads
+                                  (toll gates/booths). */
+
+       MAPS_ROUTE_FEATURE_MOTORWAY, /**< Indicates motorway. */
+
+       MAPS_ROUTE_FEATURE_BOATFERRY, /**< Indicates a boat ferry. */
+
+       MAPS_ROUTE_FEATURE_RAILFERRY, /**< Indicates rail (train) ferry. */
+
+       MAPS_ROUTE_FEATURE_PUBLICTTRANSIT, /**< Indicates public transport. */
+
+       MAPS_ROUTE_FEATURE_TUNNEL, /**< Indicates tunnel. */
+
+       MAPS_ROUTE_FEATURE_DIRTROAD, /**< Indicates dirt road. */
+
+       MAPS_ROUTE_FEATURE_PARKS, /**< Indicates park. */
+
+       MAPS_ROUTE_FEATURE_HOVLANE, /**< Indicates a high-occupancy vehicle
+                                     lane. */
+
+       MAPS_ROUTE_FEATURE_STAIRS /**< Indicates stairs. */
 } maps_route_feature_e;
 
 /*----------------------------------------------------------------------------*/
@@ -701,6 +726,7 @@ int maps_preference_set_route_feature(maps_preference_h preference,
 int maps_preference_set_property(maps_preference_h preference,
                                 const char *key, const char *value);
 
+
 #ifdef __cplusplus
 }
 #endif
index 7285686ba1c914636d5febf2ad910dfeaffd2dda..6cf21fd1d9314c5b54c8531a94508e1e5b2697d9 100755 (executable)
@@ -53,15 +53,25 @@ typedef void *maps_route_maneuver_h;
  * @since_tizen 2.4
  */
 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;
 
 /**
@@ -69,31 +79,47 @@ typedef enum {
  * @since_tizen 2.4
  */
 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
+
+       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_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;
 
 /*----------------------------------------------------------------------------*/
index ff7bf0e0e359e6148eb4745965c393cf17701ab2..7d9b2cda95df9b958621a0f63dd781bd833c860a 100644 (file)
 #include <maps_place.h>
 #include <maps_place_filter.h>
 #include <maps_route.h>
+#include <map_snapshot.h>
+
+// temporal features
+#define IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+#define IMPROVEMENT_OF_VISUAL_OBJECTS
 
 /**
  *
@@ -57,26 +62,43 @@ extern "C" {
  * @since_tizen 2.4
  */
 typedef enum _maps_service_e {
-       MAPS_SERVICE_GEOCODE,                           /** Indicates that
-                               maps_service_geocode() service is allowed */
-       MAPS_SERVICE_GEOCODE_INSIDE_AREA,               /** Indicates that
-               maps_service_geocode_iside_area() service is allowed */
-       MAPS_SERVICE_GEOCODE_BY_STRUCTURED_ADDRESS,     /** Indicates that
-       maps_service_geocode_by_structured_address() service is allowed */
-       MAPS_SERVICE_REVERSE_GEOCODE,                   /** Indicates that
-                       maps_service_reverse_geocode() service is allowed */
-       MAPS_SERVICE_SEARCH_PLACE,                      /** Indicates that
-                               maps_service_place() service is allowed */
-       MAPS_SERVICE_SEARCH_PLACE_BY_AREA,              /** Indicates that
+
+       MAPS_SERVICE_GEOCODE, /**< Indicates that maps_service_geocode()
+               service is allowed */
+
+       MAPS_SERVICE_GEOCODE_INSIDE_AREA, /**< Indicates that
+               maps_service_geocode_inside_area() service is allowed */
+
+       MAPS_SERVICE_GEOCODE_BY_STRUCTURED_ADDRESS, /**< Indicates that
+               maps_service_geocode_by_structured_address() service is
+               allowed */
+
+       MAPS_SERVICE_REVERSE_GEOCODE, /**< Indicates that
+               maps_service_reverse_geocode() service is allowed */
+
+       MAPS_SERVICE_SEARCH_PLACE, /**< Indicates that
+               maps_service_search_place() service is allowed */
+
+       MAPS_SERVICE_SEARCH_PLACE_BY_AREA, /**< Indicates that
                maps_service_search_place_by_area() service is allowed */
-       MAPS_SERVICE_SEARCH_PLACE_BY_ADDRESS,           /** Indicates that
+
+       MAPS_SERVICE_SEARCH_PLACE_BY_ADDRESS, /**< Indicates that
                maps_service_search_place_by_address() service is allowed */
-       MAPS_SERVICE_SEARCH_ROUTE,                      /** Indicates that
-                       maps_service_search_route() service is allowed */
-       MAPS_SERVICE_SEARCH_ROUTE_WAYPOINTS,            /** Indicates that
+
+       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,                    /**< 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_CAPTURE_SNAPSHOT           /**< Indicates that
+                       maps_service_capture_snapshot() and
+                       map_view_capture_snapshot()
+                       services are allowed (Since 3.0) */
 } maps_service_e;
 
 /**
@@ -84,34 +106,48 @@ typedef enum _maps_service_e {
  * @since_tizen 2.4
  */
 typedef enum _maps_service_data_e {
-       MAPS_PLACE_ADDRESS,             /**< Indicates the address value in the
-                                         Place data*/
-       MAPS_PLACE_RATING,              /**< Indicates the rating value in the
-                                         Place data*/
-       MAPS_PLACE_CATEGORIES,          /**< Indicates the place category list
-                                         in the Place data*/
-       MAPS_PLACE_ATTRIBUTES,          /**< Indicates the place attribute
-                                         list in the Place data*/
-       MAPS_PLACE_CONTACTS,            /**< Indicates the place contact list in
-                                         the Place data*/
-       MAPS_PLACE_EDITORIALS,          /**< Indicates the place editorial list
-                                         in the Place data*/
-       MAPS_PLACE_REVIEWS,             /**< Indicates the place review list in
-                                         the Place data*/
-       MAPS_PLACE_IMAGE,               /**< Indicates the place image in Place
-                                         the data*/
-       MAPS_PLACE_SUPPLIER,            /**< Indicates the place supplier link
-                                         value in the Place data*/
-       MAPS_PLACE_RELATED,             /**< Indicates the 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_PLACE_ADDRESS, /**< Indicates the availability of address value
+               in the Place data */
+
+       MAPS_PLACE_RATING, /**< Indicates the availability of rating value in
+               the Place data */
+
+       MAPS_PLACE_CATEGORIES, /**< Indicates the availability of place category
+               list in the Place data */
+
+       MAPS_PLACE_ATTRIBUTES, /**< Indicates the availability of place
+               attribute list in the Place data */
+
+       MAPS_PLACE_CONTACTS, /**< Indicates the availability of place contact
+               list in the Place data */
+
+       MAPS_PLACE_EDITORIALS, /**< Indicates the availability of place
+               editorial list in the Place data */
+
+       MAPS_PLACE_REVIEWS, /**< Indicates the availability of place review list
+               in the Place data */
+
+       MAPS_PLACE_IMAGE, /**< Indicates the availability of place image in
+               Place the data */
+
+       MAPS_PLACE_SUPPLIER, /**< Indicates the availability of place supplier
+               link value in the Place data */
+
+       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_service_data_e;
 
 /**
@@ -119,14 +155,13 @@ typedef enum _maps_service_data_e {
  * @details The Maps Service handle can be created by calling of maps_service_create().
  * \n To release the handle use maps_service_destroy().
  * @since_tizen 2.4
- * @privlevel public
- * @privilege %http://tizen.org/privilege/mapservice
  *
  * @see maps_service_create()
  * @see maps_service_destroy()
  */
 typedef void *maps_service_h;
 
+
 /**
  * @brief      Called when requesting available Maps Providers.
  * @details A Maps Service invokes this callback iteratively as long as available Maps Providers exist.
@@ -179,13 +214,18 @@ int maps_service_foreach_provider(maps_service_provider_info_cb callback,
  * such as Geocoding, Searching Places and Routing.
  * @since_tizen 2.4
  * @privlevel public
- * @privilege %http://tizen.org/privilege/mapservice
- * @remarks @a maps service handle must be released using maps_service_destroy().
+ * @privilege %http://tizen.org/privilege/mapservice \n
+ *            %http://tizen.org/privilege/network.get
+ *
+ * @remarks @a maps service handle must be released using
+ * maps_service_destroy().
  * \n use maps_service_foreach_provider() to choose one of available Providers.
  * \n use maps_service_set_provider_key() to set provider's key.
- * \n use use maps_service_set_preference() to set various options of Maps Provider.
- * \n use maps_service_provider_is_service_supported() and maps_service_provider_is_data_supported()
- * to check the Maps Provider's capabilities
+ * \n use use maps_service_set_preference() to set various options of Maps
+ * Provider.
+ * \n use maps_service_provider_is_service_supported() and
+ * maps_service_provider_is_data_supported() to check the Maps Provider's
+ * capabilities
  *
  * @param[in]  maps_provider   The name of Maps Provider
  * @param[out] maps            A handle of the new Maps Service on success
@@ -237,14 +277,14 @@ int maps_service_destroy(maps_service_h maps);
 
 /**
  * @brief      Sets the Maps Key to be used in the requests of Maps Service.
- * @details This function sets the Maps Provider's Key which will be used in each Maps
- * Service request to Maps Provider.
+ * @details This function sets the Maps Provider's Key which will be used in
+ * each Maps Service request to Maps Provider.
  * \n Maps key can be obtained with maps_service_get_provider_key().
  * @since_tizen 2.4
  * @remarks To get the @a provider_key, refer to corresponding Maps Provider
  * documentation.
- * \n To get app_id and app_code of HERE, visit https://developer.here.com/, https://developer.here.com/rest-apis.
- * \n To get a MapQuest AppKey, visit http://developer.mapquest.com/, http://open.mapquestapi.com.
+ * \n To get app_id and app_code of HERE, visit https://developer.here.com/,
+ * https://developer.here.com/rest-apis.
  *
  * @param[in]  maps            The Maps Service handle
  * @param[in]  provider_key    The Maps Key to be used
@@ -336,7 +376,8 @@ int maps_service_get_preference(maps_service_h maps,
 
 /**
  * @brief      Checks if the Maps Service supports a request.
- * @details This function checks if the Maps Service supports a specified request.
+ * @details This function checks if the Maps Service supports a specified
+ * request.
  * @since_tizen 2.4
  * @remarks @a maps_service_provider_is_service_supported is always synchronous
  * function.
@@ -388,12 +429,11 @@ int maps_service_provider_is_data_supported(const maps_service_h maps,
 
 /**
  * @brief      Cancels the service request.
- * @details This function cancels the service request initiated by geocode,
+ * @details This function cancels the service request initiated by geocoder,
  * route or place search.
  * @since_tizen 2.4
  * @privlevel public
  * @privilege %http://tizen.org/privilege/mapservice
- * @remarks This function requires network access.
  *
  * @param[in]  maps            The Maps Service handle
  * @param[in]  request_id      The id of request
@@ -452,12 +492,12 @@ int maps_service_cancel_request(const maps_service_h maps, int request_id);
  * @addtogroup CAPI_MAPS_GEOCODER_MODULE
  * @{
  * @brief This provides APIs for Geocoder Service
- * @details The Maps Geocoding API allows mapping an address to its geographical
- * location defined in terms of latitude and longitude; the input can be a
- * qualified, structured address or a free form single search text with full
- * or partial address information.
- * \n The Maps Reverse Geocoding API allows to inverse mapping a geographical
- * location (longitude, latitude) to an address;
+ * @details The Maps Geocoding API allows translating an address to its
+ * geographical location defined in terms of latitude and longitude;
+ * the input can be a qualified, structured address or a free form single search
+ * text with full or partial address information.
+ * \n The Maps Reverse Geocoding API allows to inverse translating a
+ * geographical location (longitude, latitude) to an address;
  * it can be used to answer the question "Where am I?".
  *
  */
@@ -526,17 +566,20 @@ typedef void (*maps_service_reverse_geocode_cb) (maps_error_e result,
                                                 void *user_data);
 
 /**
- * @brief      Gets the position coordinates for a given address. The request
- * is asynchronous.
+ * @brief      Gets the position coordinates for a given address.
+ * \n The request is asynchronous.
  * @details This function obtains position coordinates for a given free-formed
  * address string.
  * @since_tizen 2.4
  * @privlevel public
- * @privilege %http://tizen.org/privilege/mapservice
+ * @privilege %http://tizen.org/privilege/mapservice \n
+ *            %http://tizen.org/privilege/internet \n
+ *            %http://tizen.org/privilege/network.get
  * @remarks %http://tizen.org/privilege/internet is needed to access internet.
  * \n To cancel the request use maps_service_cancel_request().
- * \n To check if Maps Provider is capable of Geocoding and which Geocode
- * preferences are supported, see the lists of capacities and preferences above.
+ * \n To check if Maps Provider is capable of Geocoding use
+ * maps_service_provider_is_service_supported() with
+ * #MAPS_SERVICE_GEOCODE passed as @a service parameter.
  *
  * @param[in]  maps            The Maps Service handle
  * @param[in]  address         The free-formed address
@@ -558,8 +601,6 @@ typedef void (*maps_service_reverse_geocode_cb) (maps_error_e result,
  * @retval     #MAPS_ERROR_NOT_FOUND Result not found
  * @retval     #MAPS_ERROR_KEY_NOT_AVAILABLE Invalid key
  * @retval     #MAPS_ERROR_UNKNOWN Unknown error
-
- #MAPS_ERROR_UNKNOWN Unknown error
  *
  * @pre Call maps_service_create() to create Maps Service and obtain its handle.
  * @post It invokes maps_service_geocode_cb() to deliver obtained position
@@ -569,6 +610,7 @@ typedef void (*maps_service_reverse_geocode_cb) (maps_error_e result,
  * @see maps_service_geocode_cb()
  * @see maps_service_cancel_request()
  * @see maps_service_reverse_geocode()
+ * @see maps_service_provider_is_service_supported()
  */
 int maps_service_geocode(const maps_service_h maps, const char *address,
                         const maps_preference_h preference,
@@ -577,17 +619,21 @@ int maps_service_geocode(const maps_service_h maps, const char *address,
 
 /**
  * @brief      Gets the position for a given address, within the specified
- * bounding box. The request is asynchronous.
+ * bounding box.
+ * \n The request is asynchronous.
  * @details This function obtains position coordinates for a given free-formed
  * address string within the specified bounding box.
  * @since_tizen 2.4
  * @privlevel public
- * @privilege %http://tizen.org/privilege/mapservice
+ * @privilege %http://tizen.org/privilege/mapservice \n
+ *            %http://tizen.org/privilege/internet \n
+ *            %http://tizen.org/privilege/network.get
  * @remarks %http://tizen.org/privilege/internet is needed to access internet.
  * \n Polygonal bounding box is not supported.
  * \n To cancel the request use maps_service_cancel_request().
- * \n To check if Maps Provider is capable of Geocoding and which Geocode
- * preferences are supported, see the lists of capacities and preferences above.
+ * \n To check if Maps Provider is capable of Geocoding Inside Area use
+ * maps_service_provider_is_service_supported() with
+ * #MAPS_SERVICE_GEOCODE_INSIDE_AREA passed as @a service parameter.
  *
  * @param[in]  maps            The Maps Service handle
  * @param[in]  address         The free-formed address
@@ -623,6 +669,7 @@ int maps_service_geocode(const maps_service_h maps, const char *address,
  * @see maps_service_geocode()
  * @see maps_service_cancel_request()
  * @see maps_service_reverse_geocode()
+ * @see maps_service_provider_is_service_supported()
  */
 int maps_service_geocode_inside_area(const maps_service_h maps,
                                     const char *address,
@@ -632,17 +679,20 @@ int maps_service_geocode_inside_area(const maps_service_h maps,
                                     void *user_data, int *request_id);
 
 /**
- * @brief      Gets the position coordinates for a given address. The request
- * is asynchronous.
+ * @brief      Gets the position coordinates for a given address.
+ * \n The request is asynchronous.
  * @details This function obtains position coordinates for a given structured
  * address.
  * @since_tizen 2.4
  * @privlevel public
- * @privilege %http://tizen.org/privilege/mapservice
+ * @privilege %http://tizen.org/privilege/mapservice \n
+ *            %http://tizen.org/privilege/internet \n
+ *            %http://tizen.org/privilege/network.get
  * @remarks %http://tizen.org/privilege/internet is needed to access internet.
  * \n To cancel the request use maps_service_cancel_request().
- * \n To check if Maps Provider is capable of Geocoding and which Geocode
- * preferences are supported see the lists of capacities and preferences above.
+ * \n To check if Maps Provider is capable of Geocoding by Structured Address use
+ * maps_service_provider_is_service_supported() with
+ * #MAPS_SERVICE_GEOCODE_BY_STRUCTURED_ADDRESS passed as @a service parameter.
  *
  * @param[in]  maps            The Maps Service handle
  * @param[in]  address         The structured address
@@ -674,6 +724,7 @@ int maps_service_geocode_inside_area(const maps_service_h maps,
  * @see maps_service_geocode_cb()
  * @see maps_service_cancel_request()
  * @see maps_service_reverse_geocode()
+ * @see maps_service_provider_is_service_supported()
  */
 int maps_service_geocode_by_structured_address(const maps_service_h maps,
                                               const maps_address_h address,
@@ -684,18 +735,20 @@ int maps_service_geocode_by_structured_address(const maps_service_h maps,
                                               int *request_id);
 
 /**
- * @brief      Gets the address for a given position coordinates. The request
- * is asynchronous.
+ * @brief      Gets the address for a given position coordinates.
+ * \n The request is asynchronous.
  * @details This function obtains structured address information for a given
  * position coordinates.
  * @since_tizen 2.4
  * @privlevel public
- * @privilege %http://tizen.org/privilege/mapservice
+ * @privilege %http://tizen.org/privilege/mapservice \n
+ *            %http://tizen.org/privilege/internet \n
+ *            %http://tizen.org/privilege/network.get
  * @remarks %http://tizen.org/privilege/internet is needed to access internet.
  * \n To cancel the request use maps_service_cancel_request().
- * \n To check if Maps Provider is capable of Reverse Geocoding and which
- * Reverse Geocode preferences are supported, see the lists of capacities and
- * preferences above.
+ * \n To check if Maps Provider is capable of Reverse Geocoding use
+ * maps_service_provider_is_service_supported() with
+ * #MAPS_SERVICE_REVERSE_GEOCODE passed as @a service parameter.
  *
  * @param[in]  maps            The Maps Service handle
  * @param[in]  latitude        The latitude [-90.0 ~ 90.0] (degrees)
@@ -726,6 +779,7 @@ int maps_service_geocode_by_structured_address(const maps_service_h maps,
  * @see maps_service_reverse_geocode_cb()
  * @see maps_service_cancel_request()
  * @see maps_service_geocode()
+ * @see maps_service_provider_is_service_supported()
  */
 int maps_service_reverse_geocode(const maps_service_h maps, double latitude,
                                 double longitude,
@@ -733,6 +787,88 @@ int maps_service_reverse_geocode(const maps_service_h maps, double latitude,
                                 maps_service_reverse_geocode_cb callback,
                                 void *user_data, int *request_id);
 
+
+/**
+ * @brief      Called when responsed the request of multi reverse geocoding.
+ * @details The Maps Service invokes this callback once when gets the response
+ * from map service provider.
+ * \n The value of @a total is same with requested coordinates list size.
+ * Even though one of address is not provided valid address handle is retrieved.
+ * @since_tizen 3.0
+ * @remarks    You can get the respective address information of @a address_list
+ * using maps_address_list_foreach().
+ *
+ * @param[in]  result                  The result of request
+ * @param[in]  request_id              The id of request
+ * @param[in]  total                   The total number of results
+ * @param[in]  address_list            The converted address list from the
+ * requested coordinates list
+ * @param[in]  user_data               The user data pointer passed from
+ * maps_service_multi_reverse_geocode()
+ * @return     @c true to continue with the next iteration of the loop, \n @c
+ * false to break out of the loop
+ *
+ * @pre maps_service_multi_reverse_geocode() will invoke this callback.
+ *
+ * @see maps_service_multi_reverse_geocode()
+ * @see maps_address_list_foreach()
+ * @see maps_service_cancel_request()
+ */
+typedef bool (*maps_service_multi_reverse_geocode_cb) (maps_error_e result,
+                                       int request_id,
+                                       int total,
+                                       maps_address_list_h address_list,
+                                       void *user_data);
+
+/**
+ * @brief      Gets the address list for a given position coordinates list.
+ * \n The request is asynchronous.
+ * @details This function obtains structured address information.
+ * @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 %http://tizen.org/privilege/internet is needed to access internet.
+ * \n To cancel the request use maps_service_cancel_request().
+ * \n To check if Maps Provider is capable of Multi Reverse Geocoding use
+ * maps_service_provider_is_service_supported() with
+ * #MAPS_SERVICE_MULTI_REVERSE_GEOCODE passed as @a service parameter.
+ *
+ * @param[in]  maps            The Maps Service handle
+ * @param[in]  coordinates_list The coordinates list [2 ~ 100] (a set of coordinates)
+ * @param[in]  preference      The set of preferences for processing Reverse
+ * Geocode
+ * @param[in]  callback        The callback which will retrieve address list
+ * @param[in]  user_data       The user data pointer to be passed to the
+ * callback
+ * @param[out] request_id      The id of request
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval     #MAPS_ERROR_NETWORK_UNREACHABLE Network connection failed
+ * @retval     #MAPS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @retval     #MAPS_ERROR_PERMISSION_DENIED Permission Denied
+ * @retval     #MAPS_ERROR_NOT_SUPPORTED Not supported
+ * @retval     #MAPS_ERROR_CONNECTION_TIME_OUT Timeout error, no answer
+ * @retval     #MAPS_ERROR_INVALID_OPERATION Operation is not valid
+ * @retval     #MAPS_ERROR_NOT_FOUND Result not found
+ * @retval     #MAPS_ERROR_KEY_NOT_AVAILABLE Invalid key
+ * @retval     #MAPS_ERROR_UNKNOWN Unknown error
+ *
+ * @pre Call maps_service_create() to create Maps Service and obtain its handle.
+ * @post This function invokes maps_service_multi_reverse_geocode_cb().
+ *
+ * @see maps_service_multi_reverse_geocode_cb()
+ * @see maps_service_cancel_request()
+ * @see maps_service_reverse_geocode()
+ * @see maps_service_provider_is_service_supported()
+ */
+int maps_service_multi_reverse_geocode(const maps_service_h maps,
+                               maps_coordinates_list_h coordinates_list,
+                               const maps_preference_h preference,
+                               maps_service_multi_reverse_geocode_cb callback,
+                               void *user_data, int *request_id);
 /**
  * @}
  */
@@ -788,16 +924,23 @@ typedef bool(*maps_service_search_place_cb) (maps_error_e error,
 
 /**
  * @brief      Queries a Place information by a coordinates position and a
- * distance. The request is asynchronous.
+ * distance.
+ * \n The request is asynchronous.
  * @details This function obtains the Place information for a specified distance
  * around a given coordinates position.
  * @since_tizen 2.4
  * @privlevel public
- * @privilege %http://tizen.org/privilege/mapservice
+ * @privilege %http://tizen.org/privilege/mapservice \n
+ *            %http://tizen.org/privilege/internet \n
+ *            %http://tizen.org/privilege/network.get
  * @remarks %http://tizen.org/privilege/internet is needed to access internet.
  * \n To cancel the search request use maps_service_cancel_request().
- * \n To check if Maps Provider is capable of Place Search and which Place
- * preferences are supported, see the lists of capacities and preferences above.
+ * \n To check if Maps Provider is capable of Place Search use
+ * maps_service_provider_is_service_supported() with
+ * #MAPS_SERVICE_SEARCH_PLACE passed as @a service parameter.
+ * \n Check available data features in the search result using
+ * maps_service_provider_is_data_supported() with values, listed in
+ * #maps_service_data_e passed as @a data parameter.
  *
  * @param[in]  maps            The Maps Service handle
  * @param[in]  position        The interested position
@@ -832,6 +975,8 @@ typedef bool(*maps_service_search_place_cb) (maps_error_e error,
  * @see maps_service_search_place_by_address()
  * @see maps_service_cancel_request()
  * @see maps_service_search_place_cb()
+ * @see maps_service_provider_is_service_supported()
+ * @see maps_service_provider_is_data_supported()
  */
 int maps_service_search_place(const maps_service_h maps,
                              const maps_coordinates_h position, int distance,
@@ -841,18 +986,24 @@ int maps_service_search_place(const maps_service_h maps,
                              void *user_data, int *request_id);
 
 /**
- * @brief      Queries a Place information by a coordinates boundary. The
- * request is asynchronous.
+ * @brief      Queries a Place information by a coordinates boundary.
+ * \n The request is asynchronous.
  * @details This function obtains the Place information for a specified
  * coordinates boundary.
  * @since_tizen 2.4
  * @privlevel public
- * @privilege %http://tizen.org/privilege/mapservice
+ * @privilege %http://tizen.org/privilege/mapservice \n
+ *            %http://tizen.org/privilege/internet \n
+ *            %http://tizen.org/privilege/network.get
  * @remarks %http://tizen.org/privilege/internet is needed to access internet.
  * \n @a boundary is supporting only circle type bounds for search.
  * \n To cancel the search request use maps_service_cancel_request().
- * \n To check if Maps Provider is capable of Place Search and which Place
- * preferences are supported, see the lists of capacities and preferences above.
+ * \n To check if Maps Provider is capable of Place Search by coordinates
+ * boundaries, use maps_service_provider_is_service_supported() with
+ * #MAPS_SERVICE_SEARCH_PLACE_BY_AREA  passed as @a service parameter.
+ * \n Check available data features in the search result using
+ * maps_service_provider_is_data_supported() with values, listed in
+ * #maps_service_data_e passed as @a data parameter.
  *
  * @param[in]  maps            The Maps Service handle
  * @param[in]  boundary        The interested area
@@ -887,6 +1038,8 @@ int maps_service_search_place(const maps_service_h maps,
  * @see maps_service_search_place_by_address()
  * @see maps_service_cancel_request()
  * @see maps_service_search_place_cb()
+ * @see maps_service_provider_is_service_supported()
+ * @see maps_service_provider_is_data_supported()
  */
 int maps_service_search_place_by_area(const maps_service_h maps,
                                      const maps_area_h boundary,
@@ -897,17 +1050,23 @@ int maps_service_search_place_by_area(const maps_service_h maps,
 
 /**
  * @brief      Queries a Place information by a free-formed address string.
- * The request is asynchronous.
- * @details This function obtains the Place information for a specified free-
- * formed address string.
+ * \n The request is asynchronous.
+ * @details This function obtains the Place information for a specified
+ * free-formed address string.
  * @since_tizen 2.4
  * @privlevel public
- * @privilege %http://tizen.org/privilege/mapservice
+ * @privilege %http://tizen.org/privilege/mapservice \n
+ *            %http://tizen.org/privilege/internet \n
+ *            %http://tizen.org/privilege/network.get
  * @remarks %http://tizen.org/privilege/internet is needed to access internet.
  * \n @a boundary is supporting only circle type bounds for search.
  * \n To cancel the search request use maps_service_cancel_request().
- * \n To check if Maps Provider is capable of Place Search and which Place
- * preferences are supported, see the lists of capacities and preferences above.
+ * \n To check if Maps Provider is capable of Place Search by free-formed
+ * address use maps_service_provider_is_service_supported() with
+ * #MAPS_SERVICE_SEARCH_PLACE_BY_ADDRESS passed as @a service parameter.
+ * \n Check available data features in the search result using
+ * maps_service_provider_is_data_supported() with values, listed in
+ * #maps_service_data_e passed as @a data parameter.
  *
  * @param[in]  maps            The Maps Service handle
  * @param[in]  address         The interested address
@@ -942,6 +1101,8 @@ int maps_service_search_place_by_area(const maps_service_h maps,
  * @see maps_service_search_place_by_area()
  * @see maps_service_cancel_request()
  * @see maps_service_search_place_cb()
+ * @see maps_service_provider_is_service_supported()
+ * @see maps_service_provider_is_data_supported()
  */
 int maps_service_search_place_by_address(const maps_service_h maps,
                                         const char *address,
@@ -967,10 +1128,10 @@ int maps_service_search_place_by_address(const maps_service_h maps,
  *
  * @addtogroup CAPI_MAPS_ROUTE_MODULE
  * @{
- * @brief This provides APIs for Rote Service
- * @details The Maps Route API provides ways to calculate a route that defines a
- * path between a start and a destination and may,
- * optionally, pass through specific intermediate locations.
+ * @brief This provides APIs for Route Service
+ * @details The Maps Route API provides functions to calculate a route that
+ * defines a path between a start and a destination and may, optionally, pass
+ * through specific intermediate locations.
  *
  */
 
@@ -1006,17 +1167,23 @@ typedef bool(*maps_service_search_route_cb) (maps_error_e error,
                                             void *user_data);
 
 /**
- * @brief      Queries the Route from origin coordinate to a destination.
- * The request is asynchronous.
+ * @brief      Queries the Route from origin coordinates to destination.
+ * \n The request is asynchronous.
  * @details This function gets the Route information for a specified origin and
  * destination coordinates.
  * @since_tizen 2.4
  * @privlevel public
- * @privilege %http://tizen.org/privilege/mapservice
+ * @privilege %http://tizen.org/privilege/mapservice \n
+ *            %http://tizen.org/privilege/internet \n
+ *            %http://tizen.org/privilege/network.get
  * @remarks %http://tizen.org/privilege/internet is needed to access internet.
  * \n To cancel the search request use maps_service_cancel_request().
- * \n To check if Maps Provider is capable of Route Search and which Route
- * preferences are supported, see the lists of capacities and preferences above.
+ * \n To check if Maps Provider is capable of Route Search use
+ * maps_service_provider_is_service_supported() with
+ * #MAPS_SERVICE_SEARCH_ROUTE passed as @a service parameter.
+ * \n Check available data features in the search result using
+ * maps_service_provider_is_data_supported() with values, listed in
+ * #maps_service_data_e passed as @a data parameter.
  *
  * @param[in]  maps            The Maps Service handle
  * @param[in]  origin          The starting point
@@ -1045,6 +1212,8 @@ typedef bool(*maps_service_search_route_cb) (maps_error_e error,
  * @see maps_service_search_route_waypoints()
  * @see maps_service_cancel_request()
  * @see maps_service_search_route_cb()
+ * @see maps_service_provider_is_service_supported()
+ * @see maps_service_provider_is_data_supported()
  */
 int maps_service_search_route(const maps_service_h maps,
                              const maps_coordinates_h origin,
@@ -1054,17 +1223,24 @@ int maps_service_search_route(const maps_service_h maps,
                              void *user_data, int *request_id);
 
 /**
- * @brief      Queries the Route, passing through a specified way points. The
- * request is asynchronous.
+ * @brief      Queries the Route, passing through a specified way points.
+ * \n The request is asynchronous.
  * @details This function gets the Route information for the Route, passing
  * through a specified set of way points.
  * @since_tizen 2.4
  * @privlevel public
- * @privilege %http://tizen.org/privilege/mapservice
+ * @privilege %http://tizen.org/privilege/mapservice \n
+ *            %http://tizen.org/privilege/internet \n
+ *            %http://tizen.org/privilege/network.get
  * @remarks %http://tizen.org/privilege/internet is needed to access internet.
  * \n To cancel the search request use maps_service_cancel_request().
- * \n To check if Maps Provider is capable of Route Search and which Route
- * preferences are supported, see the lists of capacities and preferences above.
+ * \n To check if Maps Provider is capable of searching the route, passing
+ * through the specified way points, use
+ * maps_service_provider_is_service_supported() with
+ * #MAPS_SERVICE_SEARCH_ROUTE_WAYPOINTS passed as @a service parameter.
+ * \n Check available data features in the search result using
+ * maps_service_provider_is_data_supported() with values, listed in
+ * #maps_service_data_e passed as @a data parameter.
  *
  * @param[in]  maps            The Maps Service handle
  * @param[in]  waypoint_list   The list of way points to go through
@@ -1093,6 +1269,8 @@ int maps_service_search_route(const maps_service_h maps,
  * @see maps_service_search_route()
  * @see maps_service_cancel_request()
  * @see maps_service_search_route_cb()
+ * @see maps_service_provider_is_service_supported()
+ * @see maps_service_provider_is_data_supported()
  */
 int maps_service_search_route_waypoints(const maps_service_h maps,
                                        const maps_coordinates_h *
@@ -1101,6 +1279,208 @@ int maps_service_search_route_waypoints(const maps_service_h maps,
                                        maps_service_search_route_cb callback,
                                        void *user_data, int *request_id);
 
+/**
+ * @}
+ */
+
+
+/*----------------------------------------------------------------------------*/
+/*
+ * Snapshot Capture Service
+ */
+
+/**
+ * @ingroup    CAPI_MAPS_SERVICE_MODULE
+ * @defgroup   CAPI_MAP_SNAPSHOT_MODULE Snapshot
+ *
+ * @addtogroup CAPI_MAP_SNAPSHOT_MODULE
+ * @{
+ * @brief This provides APIs allowing to capture Map Snapshots.
+ *
+ */
+
+/**
+ * @brief      Called when snapshot requested with the
+ * maps_service_capture_snapshot().
+ * @details The Maps Service invokes this callback while retrieving a snapshot
+ * of the map, centered on  specified geographical coordinates with specified
+ * zoom level and orientation.
+ * \n If snapshot capturing is failed, the value of @a snapshot is NULL.
+ * @since_tizen 3.0
+ * @remarks The parameter @a snapshot must be released using
+ * map_snapshot_destroy().
+ *
+ * @param[in]  result          The result of request
+ * @param[in]  request_id      The id of request
+ * @param[in]  snapshot        The snapshot
+ * @param[in]  user_data       The pointer to user data passed from
+ * maps_service_capture_snapshot()
+ *
+ * @pre maps_service_capture_snapshot() will invoke this callback.
+ *
+ * @see maps_service_capture_snapshot()
+ * @see #map_snapshot_h
+ */
+typedef void (*maps_service_snapshot_cb) (maps_error_e result,
+                                        int request_id,
+                                        map_snapshot_h snapshot,
+                                        void *user_data);
+
+/**
+ * @brief      Gets the snapshot of a Map.
+ * \n The request is asynchronous.
+ * @details This function retrieves a snapshot of a map, centered on a specified
+ * geographical coordinates with specified zoom level, orientation, expected
+ * snapshot size on the screen and other
+ * preferences.
+ * @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 capturing snapshots use
+ * maps_service_provider_is_service_supported() with
+ * #MAPS_SERVICE_CAPTURE_SNAPSHOT passed as @a service parameter.
+ *
+ * @param[in]  maps            The Maps Service handle
+ * @param[in]  center          The geographical coordinates of map center on
+ * the snapshot
+ * @param[in]  zoom_level      The zoom level of the map on the snapshot
+ * @param[in]  rotation_angle  The orientation of the map on the snapshot
+ * @param[in]  width           The width of the snapshot on the screen
+ * @param[in]  height          The height of the snapshot on the screen
+ * @param[in]  preference      The set of preferences for snapshot capturing
+ * @param[in]  callback        The callback which will receive the snapshot
+ * @param[in]  user_data       The pointer to user data to be passed to the
+ * callback function
+ * @param[out] request_id      The id of request
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval     #MAPS_ERROR_NETWORK_UNREACHABLE Network connection failed
+ * @retval     #MAPS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @retval     #MAPS_ERROR_PERMISSION_DENIED Permission Denied
+ * @retval     #MAPS_ERROR_NOT_SUPPORTED Not supported
+ * @retval     #MAPS_ERROR_CONNECTION_TIME_OUT Timeout error, no answer
+ * @retval     #MAPS_ERROR_INVALID_OPERATION Operation is not valid
+ * @retval     #MAPS_ERROR_NOT_FOUND Result not found
+ * @retval     #MAPS_ERROR_KEY_NOT_AVAILABLE Invalid key
+ * @retval     #MAPS_ERROR_UNKNOWN Unknown error
+ *
+ * @pre Call maps_service_create() to create Maps Service and obtain its handle.
+ * @pre Optionally, call maps_preference_create() to create Map Preference
+ * holder and obtain its handle.
+ * @post It invokes maps_service_snapshot_cb() to deliver requested snapshot.
+ *
+ * @par Example
+ * @code
+#include <maps_service.h>
+
+static void _snapshot_cb(maps_error_e result, int request_id,
+                        map_snapshot_h snapshot, void *user_data)
+{
+       if (!snapshot || !user_data)
+               return false;
+
+       unsigned int *pixels = NULL;
+       Evas *canvas = (Evas *)user_data;
+       Evas_Object *map_snapshot = NULL;
+       int width = 0;
+       int height = 0;
+
+       // Get snapshot pixels
+       unsigned int *pixels = NULL;
+       int error = map_snapshot_get_data(snapshot, &pixels);
+       if (error == MAPS_ERROR_NONE) {
+
+               // Create an image on the canvas
+               map_snapshot = evas_object_image_add(canvas);
+               map_snapshot_get_size(snapshot, &width, &height);
+               evas_object_image_size_set (map_snapshot, width, height);
+
+               // Draw snapshot on the canvas
+               evas_object_image_data_set(map_snapshot, pixels);
+               evas_object_show(map_snapshot);
+       }
+
+       // Optionally it is possible to fetch also the snapshot
+       // - central coordinates and area
+       // - zoom level and factor
+       // - orientation
+       // - Evas color space
+       // - etc.
+
+       map_snapshot_destroy(snapshot);
+}
+
+int main(int argc, char *argv[])
+{
+       maps_service_h maps = NULL;
+       int error = MAPS_ERROR_NONE;
+       int request_id = 0;
+       Evas *canvas = NULL;
+
+       do {
+
+               // Create an instance of Maps Service
+               error = maps_service_create("MapsProvider", &maps);
+               if (error != MAPS_ERROR_NONE)
+                       break;
+
+               // Set security key
+               maps_service_set_provider_key(maps, "your-security-key");
+
+               // Create a canvas
+               //canvas = ...
+
+               // Specify Snapshot center
+               maps_coordinates_h center = NULL;
+               maps_coordinates_create(center, 39.930661, 23.695172);
+
+               // Capture snapshot
+               error = maps_service_capture_snapshot(maps,
+                             center,
+                             12,       // zoom level
+                             0,        // rotation angle
+                             320,      // width on the screen
+                             240,      // height on the screen
+                             NULL,     // no extra preference
+                             _snapshot_cb,
+                             canvas,   // user_data,
+                             &request_id);
+
+               maps_coordinates_destroy(center);
+
+               if (error != MAPS_ERROR_NONE)
+                       break;
+
+       } while(false);
+
+       // Release the Maps Service and used resources
+       maps_service_destroy(maps);
+       return error;
+}
+ * @endcode
+ *
+ * @see maps_service_snapshot_cb()
+ * @see map_view_capture_snapshot()
+ * @see #map_snapshot_h
+ * @see map_snapshot_destroy()
+ * @see maps_service_create()
+ * @see maps_preference_create()
+ */
+int maps_service_capture_snapshot(const maps_service_h maps,
+                                 const maps_coordinates_h center,
+                                 const int zoom_level,
+                                 const double rotation_angle,
+                                 const int width,
+                                 const int height,
+                                 const maps_preference_h preference,
+                                 maps_service_snapshot_cb callback,
+                                 void *user_data,
+                                 int *request_id);
+
+
 /**
  * @}
  */
index 25e4bfa6ea820de301af179637d957d48f34b908..a05f4cf8850b8c8501ed91cad82a4d1eba3d3b83 100644 (file)
@@ -1,18 +1,33 @@
 Name:       capi-maps-service
 Summary:    Tizen Maps Service API
-Version:    0.4.2
-Release:    1
+Version:    0.5.4
+Release:    11
 Group:      Location/API
 License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
 
 BuildRequires:  cmake
+
+# Maps API dependencies
 BuildRequires:  pkgconfig(glib-2.0)
 BuildRequires:  pkgconfig(gmodule-2.0)
 BuildRequires:  pkgconfig(capi-base-common)
 BuildRequires:  pkgconfig(dlog)
+BuildRequires:  pkgconfig(capi-appfw-app-manager)
+BuildRequires:  pkgconfig(capi-appfw-package-manager)
 BuildRequires:  pkgconfig(pkgmgr-info)
 BuildRequires:  pkgconfig(privacy-manager-client)
+BuildRequires:  pkgconfig(capi-system-info)
+
+# Mapping API dependencies
+BuildRequires:  pkgconfig(eina)
+BuildRequires:  pkgconfig(evas)
+BuildRequires:  pkgconfig(ecore)
+#BuildRequires:  pkgconfig(capi-appfw-application)
+BuildRequires:  pkgconfig(evas)
+#BuildRequires:  pkgconfig(ecore-evas)
+#BuildRequires:  pkgconfig(elementary)
+
 Requires(post):  /sbin/ldconfig
 Requires(postun):  /sbin/ldconfig
 Provides: capi-maps-service-plugin-devel
@@ -45,8 +60,6 @@ rm -rf %{buildroot}
 mkdir -p %{buildroot}/usr/share/license
 cp LICENSE %{buildroot}/usr/share/license/%{name}
 
-mkdir -p %{buildroot}%{_prefix}/lib/maps/plugins
-
 %post
 /sbin/ldconfig
 
@@ -58,7 +71,6 @@ mkdir -p %{buildroot}%{_prefix}/lib/maps/plugins
 %defattr(-,root,root,-)
 /usr/share/license/capi-maps-service
 %{_libdir}/libcapi-maps-service.so.*
-%{_prefix}/lib/maps/plugins/libmaps-plugin-test.so*
 
 
 %package devel
@@ -77,7 +89,7 @@ This provides the Tizen Maps Service Library to access and handle the map data.
 
 %files devel
 %defattr(-,root,root,-)
-%{_includedir}/maps/maps_*.h
+%{_includedir}/maps/map*_*.h
 %{_libdir}/pkgconfig/capi-maps-service.pc
 %{_libdir}/libcapi-maps-service.so
 %exclude %{_includedir}/maps/maps_plugin*.h
@@ -106,6 +118,11 @@ This provides the Tizen Map Service APIs to access and handle map data for the M
 %{_includedir}/maps/maps_extra_types.h
 
 
+# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+# WARNING! FOR TESTING PURPOSES ONLY
+# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+#if you want to tesst code, please change %if 0 to %if 1
+%if 0
 %package test
 Summary:    Tizen Maps Service Library Test (Internal Dev)
 Group:      Location/Testing
@@ -114,22 +131,37 @@ Requires:   capi-maps-service = %{version}-%{release}
 %description test
 This is a program to test the Tizen Maps Service Library internally.
 
+==================================================================================
+READ ME
+-------
+1. How to build
+   1) Change %if 0 to %if 1
+   2) Release SET(CMAKE_CXX_FLAGS, ~) and ADD_SUBDIRECTORY(test) in CMakeLists.txt
+
+2. How to install
+   # pkgcmd -i -t rpm -p capi-maps-service-test-%{version}-%{release}.rpm
+==================================================================================
+
 %files test
+%defattr(-,root,root,-)
 %manifest test/capi-maps-service-test.manifest
 /opt/usr/devel/capi-maps-service-test
+/etc/smack/accesses.d/capi-maps-service-test.efl
+/usr/share/packages/capi-maps-service-test.xml
 
 #################################################################################
 # Test plugin library
 
-#%package -n maps-plugin-test
-#Summary:    Tizen Maps Service Plug-in Test (Internal Dev)
-#Group:      Location/Testing
-#Requires:   %{name} = %{version}-%{release}
+%package -n maps-plugin-test
+Summary:    Tizen Maps Service Plug-in Test (Internal Dev)
+Group:      Location/Testing
+Requires:   %{name} = %{version}-%{release}
 
-#%description -n maps-plugin-test
-#This is a program to test the Tizen Maps Service for Plug-in internally.
+%description -n maps-plugin-test
+This is a program to test the Tizen Maps Service for Plug-in internally.
 
-#%files -n maps-plugin-test
-#%manifest test/dummy_plugin/maps-plugin-test.manifest
-#%defattr(-,root,root,-)
-#%{_libdir}/maps/plugins/libmaps-plugin-test.so*
+%files -n maps-plugin-test
+%manifest test/dummy_plugin/maps-plugin-test.manifest
+%defattr(-,root,root,-)
+%{_libdir}/maps/plugins/libmaps-plugin-test.so*
+%endif
diff --git a/src/api/map_event_data.cpp b/src/api/map_event_data.cpp
new file mode 100755 (executable)
index 0000000..3331153
--- /dev/null
@@ -0,0 +1,465 @@
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <glib.h>
+#include "maps_error.h"
+#include "map_event_data.h"
+#include "maps_util.h"
+
+/*
+ * This represents visual event object information
+ */
+typedef struct _map_event_data_s {
+
+       map_event_type_e event_type;
+
+       /* Applicable for set_center action */
+       maps_coordinates_h center;
+
+       /* Applicable for gesture */
+       int x;
+       int y;
+
+       /* Applicable for center move */
+       int delta_x;
+       int delta_y;
+
+       /* Applicable for gestures */
+       int fingers;
+
+       /* Applicable for gestures, object */
+       map_gesture_e gesture_type;
+
+       /* Applicable for action */
+       map_action_e action_type;
+
+       /* Applicable for zoom */
+       double zoom_factor;
+
+       /* Applicable for rotation */
+       double rotation_angle;
+
+       /* Applicable for object event */
+       map_object_h object;
+
+} map_event_data_s;
+
+/*----------------------------------------------------------------------------*/
+
+int _map_event_data_set_type(map_event_data_h event,
+                            map_event_type_e event_type);
+
+int _map_event_data_set_gesture_type(map_event_data_h event,
+                                    const map_gesture_e gesture_type);
+
+int _map_event_data_set_action_type(map_event_data_h event,
+                                   const map_action_e action_type);
+
+int _map_event_data_set_center(map_event_data_h event,
+                              const maps_coordinates_h center);
+
+int _map_event_data_set_delta(map_event_data_h event,
+                             const int delta_x, const int delta_y);
+
+int _map_event_data_set_xy(map_event_data_h event,
+                          const int x, const int y);
+
+int _map_event_data_set_fingers(map_event_data_h event,
+                               const int fingers);
+
+int _map_event_data_set_zoom_factor(map_event_data_h event,
+                                   const double zoom_factor);
+
+int _map_event_data_set_rotation_angle(map_event_data_h event,
+                                      const double rotation_angle);
+
+int _map_event_data_set_object(map_event_data_h event,
+                              map_object_h object);
+
+
+/*----------------------------------------------------------------------------*/
+
+int _map_event_data_create(map_event_data_h *event)
+{
+       MAPS_LOG_API;
+       if (!event)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       map_event_data_s *e = g_slice_new0(map_event_data_s);
+       if (!e) {
+               MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
+               return MAPS_ERROR_OUT_OF_MEMORY;
+       }
+
+       e->event_type = MAP_EVENT_GESTURE;
+       e->gesture_type = MAP_GESTURE_SCROLL;
+       e->action_type = MAP_ACTION_NONE;
+
+       *event = (map_event_data_h) e;
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int map_event_data_destroy(map_event_data_h event)
+{
+       MAPS_LOG_API;
+       if (!event)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       map_event_data_s *e = (map_event_data_s *) event;
+
+       if(e->center)
+               maps_coordinates_destroy(e->center);
+
+       g_slice_free(map_event_data_s, e);
+
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_view_event_data_clone(const map_event_data_h origin,
+                                         map_event_data_h *cloned)
+{
+       MAPS_LOG_API;
+       if (!cloned || !origin)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       int error = MAPS_ERROR_NONE;
+       do {
+               error = _map_event_data_create(cloned);
+               if (!(*cloned) || (error != MAPS_ERROR_NONE))
+                       break;
+
+               map_event_data_s *e = (map_event_data_s *) origin;
+
+               error = _map_event_data_set_type(*cloned, e->event_type);
+               if (error != MAPS_ERROR_NONE)
+                       break;
+
+               _map_event_data_set_gesture_type(*cloned, e->gesture_type);
+               _map_event_data_set_action_type(*cloned, e->action_type);
+               _map_event_data_set_center(*cloned, e->center);
+               _map_event_data_set_xy(*cloned, e->x, e->y);
+               _map_event_data_set_fingers(*cloned, e->fingers);
+               _map_event_data_set_zoom_factor(*cloned, e->zoom_factor);
+               _map_event_data_set_rotation_angle(*cloned, e->rotation_angle);
+               _map_event_data_set_object(*cloned, e->object);
+
+               return MAPS_ERROR_NONE;
+       } while (false);
+
+       map_event_data_destroy(*cloned);
+       *cloned = NULL;
+       return error;
+}
+
+/*----------------------------------------------------------------------------*/
+
+int _map_event_data_set_type(map_event_data_h event,
+                                 map_event_type_e event_type)
+{
+       if (!event)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_event_data_s *e = (map_event_data_s *) event;
+       e->event_type = event_type;
+       return MAPS_ERROR_NONE;
+}
+
+int _map_event_data_set_center(map_event_data_h event,
+                                   const maps_coordinates_h center)
+{
+       if (!event || !center)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_event_data_s *e = (map_event_data_s *) event;
+       return maps_coordinates_clone(center, &e->center);
+}
+
+int _map_event_data_set_delta(map_event_data_h event,
+                                  const int delta_x, const int delta_y)
+{
+       if (!event)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_event_data_s *e = (map_event_data_s *) event;
+       e->delta_x = delta_x;
+       e->delta_y = delta_y;
+       return MAPS_ERROR_NONE;
+}
+
+int _map_event_data_set_xy(map_event_data_h event,
+                               const int x, const int y)
+{
+       if (!event)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_event_data_s *e = (map_event_data_s *) event;
+       e->x = x;
+       e->y = y;
+       return MAPS_ERROR_NONE;
+}
+
+int _map_event_data_set_fingers(map_event_data_h event,
+                                    const int fingers)
+{
+       if (!event)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_event_data_s *e = (map_event_data_s *) event;
+       e->fingers = fingers;
+       return MAPS_ERROR_NONE;
+}
+
+int _map_event_data_set_gesture_type(map_event_data_h event,
+                                         const map_gesture_e gesture_type)
+{
+       if (!event)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       if((gesture_type < MAP_GESTURE_SCROLL)
+          || (gesture_type > MAP_GESTURE_NONE))
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_event_data_s *e = (map_event_data_s *) event;
+       e->gesture_type = gesture_type;
+       return MAPS_ERROR_NONE;
+}
+
+int _map_event_data_set_action_type(map_event_data_h event,
+                                        const map_action_e action_type)
+{
+       if (!event)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       if((action_type < MAP_ACTION_SCROLL)
+          || (action_type > MAP_ACTION_NONE))
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_event_data_s *e = (map_event_data_s *) event;
+       e->action_type = action_type;
+       return MAPS_ERROR_NONE;
+}
+
+int _map_event_data_set_zoom_factor(map_event_data_h event,
+                                        const double zoom_factor)
+{
+       if (!event)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_event_data_s *e = (map_event_data_s *) event;
+       e->zoom_factor = zoom_factor;
+       return MAPS_ERROR_NONE;
+}
+
+int _map_event_data_set_rotation_angle(map_event_data_h event,
+                                           const double rotation_angle)
+{
+       if (!event)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_event_data_s *e = (map_event_data_s *) event;
+       e->rotation_angle = rotation_angle;
+       return MAPS_ERROR_NONE;
+}
+
+int _map_event_data_set_object(map_event_data_h event,
+                                   map_object_h object)
+{
+       if (!event)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_event_data_s *e = (map_event_data_s *) event;
+       e->object = object;
+       return MAPS_ERROR_NONE;
+}
+
+
+/*----------------------------------------------------------------------------*/
+
+
+EXPORT_API int map_event_data_clone(const map_event_data_h origin,
+                                   map_event_data_h *cloned)
+{
+       MAPS_LOG_API;
+       if (!origin || !cloned)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       int error = MAPS_ERROR_NONE;
+       do {
+               error = _map_event_data_create(cloned);
+               if (!(*cloned) || (error != MAPS_ERROR_NONE))
+                       break;
+
+               map_event_data_s *e = (map_event_data_s *) origin;
+
+
+               error = _map_event_data_set_type(*cloned, e->event_type);
+               if (error != MAPS_ERROR_NONE)
+                       break;
+
+               error = _map_event_data_set_gesture_type(*cloned,
+                                                        e->gesture_type);
+
+               error = _map_event_data_set_action_type(*cloned,
+                                                       e->action_type);
+
+               error = _map_event_data_set_center(*cloned, e->center);
+
+               error = _map_event_data_set_delta(*cloned,
+                                                 e->delta_x,
+                                                 e->delta_y);
+
+               error = _map_event_data_set_xy(*cloned, e->x, e->y);
+
+               error = _map_event_data_set_fingers(*cloned, e->fingers);
+
+               error = _map_event_data_set_zoom_factor(*cloned,
+                                                       e->zoom_factor);
+
+               error = _map_event_data_set_rotation_angle(*cloned,
+                                                          e->rotation_angle);
+
+               error = _map_event_data_set_object(*cloned, e->object);
+
+               return MAPS_ERROR_NONE;
+       } while (false);
+
+       map_event_data_destroy(*cloned);
+       *cloned = NULL;
+       return error;
+
+}
+
+EXPORT_API int map_event_data_get_type(const map_event_data_h event,
+                                           map_event_type_e *event_type)
+{
+       MAPS_LOG_API;
+       if (!event || !event_type)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_event_data_s *e = (map_event_data_s *) event;
+       *event_type = e->event_type;
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int map_event_data_get_gesture_type(map_event_data_h event,
+                                       map_gesture_e *gesture_type)
+{
+       MAPS_LOG_API;
+       if (!event || !gesture_type)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_event_data_s *e = (map_event_data_s *) event;
+       if((e->event_type != MAP_EVENT_GESTURE)
+          && (e->event_type != MAP_EVENT_OBJECT))
+               return MAPS_ERROR_NOT_SUPPORTED;
+       *gesture_type = e->gesture_type;
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int map_event_data_get_action_type(map_event_data_h event,
+                                               map_action_e *action_type)
+{
+       MAPS_LOG_API;
+       if (!event || !action_type)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_event_data_s *e = (map_event_data_s *) event;
+       if(e->event_type != MAP_EVENT_ACTION)
+               return MAPS_ERROR_NOT_SUPPORTED;
+       *action_type = e->action_type;
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int map_event_data_get_center(map_event_data_h event,
+                                              maps_coordinates_h *center)
+{
+       MAPS_LOG_API;
+       if (!event || !center)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_event_data_s *e = (map_event_data_s *) event;
+       if((e->event_type != MAP_EVENT_ACTION)
+          && (e->event_type != MAP_EVENT_GESTURE))
+               return MAPS_ERROR_NOT_SUPPORTED;
+       return maps_coordinates_clone(e->center, center);
+}
+
+EXPORT_API int map_event_data_get_delta(map_event_data_h event,
+                                            int *delta_x, int *delta_y)
+{
+       MAPS_LOG_API;
+       if (!event || !delta_x || !delta_y)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_event_data_s *e = (map_event_data_s *) event;
+       if(e->event_type != MAP_EVENT_ACTION)
+               return MAPS_ERROR_NOT_SUPPORTED;
+       *delta_x = e->delta_x;
+       *delta_y = e->delta_y;
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int map_event_data_get_xy(map_event_data_h event,
+                                         int *x, int* y)
+{
+       MAPS_LOG_API;
+       if (!event || !x || !y)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_event_data_s *e = (map_event_data_s *) event;
+       if(e->event_type != MAP_EVENT_GESTURE)
+               return MAPS_ERROR_NOT_SUPPORTED;
+       *x = e->x;
+       *y = e->y;
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int map_event_data_get_fingers(map_event_data_h event,
+                                              int *fingers)
+{
+       MAPS_LOG_API;
+       if (!event || !fingers)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_event_data_s *e = (map_event_data_s *) event;
+       if(e->event_type != MAP_EVENT_GESTURE)
+               return MAPS_ERROR_NOT_SUPPORTED;
+       *fingers = e->fingers;
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int map_event_data_get_zoom_factor(map_event_data_h event,
+                                                  double *zoom_factor)
+{
+       MAPS_LOG_API;
+       if (!event || !zoom_factor)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_event_data_s *e = (map_event_data_s *) event;
+       if((e->event_type != MAP_EVENT_GESTURE)
+          && (e->event_type != MAP_EVENT_ACTION))
+               return MAPS_ERROR_NOT_SUPPORTED;
+       *zoom_factor = e->zoom_factor;
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int map_event_data_get_rotation_angle(map_event_data_h
+                                                     event,
+                                                     double *rotation_angle)
+{
+       MAPS_LOG_API;
+       if (!event || !rotation_angle)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_event_data_s *e = (map_event_data_s *) event;
+       if((e->event_type != MAP_EVENT_GESTURE)
+          && (e->event_type != MAP_EVENT_ACTION))
+               return MAPS_ERROR_NOT_SUPPORTED;
+       *rotation_angle = e->rotation_angle;
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int map_event_data_get_object(map_event_data_h event,
+                                             map_object_h *object)
+{
+       MAPS_LOG_API;
+       if (!event || !object)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_event_data_s *e = (map_event_data_s *) event;
+       if(e->event_type != MAP_EVENT_OBJECT)
+               return MAPS_ERROR_NOT_SUPPORTED;
+       *object = e->object;
+       return MAPS_ERROR_NONE;
+}
diff --git a/src/api/map_object.cpp b/src/api/map_object.cpp
new file mode 100644 (file)
index 0000000..d30f1e8
--- /dev/null
@@ -0,0 +1,1401 @@
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+*
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+ */
+
+#include <glib.h>
+#include "map_object.h"
+#include "maps_error.h"
+#include "maps_util.h"
+#include "map_view.h"
+#include "maps_extra_types.h"
+#include "marker_constructor.h"
+#include "polyline_constructor.h"
+#include "polygon_constructor.h"
+#include "route_constructor.h"
+
+/*
+* This represents visual marker object information
+ */
+typedef struct _map_view_group_data_s {
+       maps_item_list_h view_objects;
+} map_view_group_data_s;
+
+/*
+* This represents marker visual object information
+ */
+typedef struct _map_view_marker_data_s {
+       maps_coordinates_h coordinates;
+       int screen_width;
+       int screen_height;
+       char *file_path;
+       map_marker_type_e type;
+       char *text;
+} map_view_marker_data_s;
+
+const gsize _MAP_MARKER_FILE_PATH_MAX_LENGTH = 128;
+const gsize _MAP_MARKER_TEXT_MAX_LENGTH = 128;
+
+/*
+* This represents polyline visual object information
+ */
+typedef struct _map_view_polyline_data_s {
+       /* The list of maps_coordinates_h points, comprising the polyline */
+       maps_coordinates_list_h points;
+
+       /* Line color */
+       unsigned char r;
+       unsigned char g;
+       unsigned char b;
+       unsigned char a;
+
+       /* Line width */
+       int width;
+} map_view_polyline_data_s;
+
+/*
+* This represents polygon visual object information
+ */
+typedef struct _map_view_polygon_data_s {
+       /* The list of maps_coordinates_h points, comprising the polygon */
+       maps_coordinates_list_h points;
+
+       /* The polygon backgraund color */
+       unsigned char r;
+       unsigned char g;
+       unsigned char b;
+       unsigned char a;
+} map_view_polygon_data_s;
+
+#ifdef TIZEN_3_0_NEXT_MS
+/*
+* This represents visual route object information
+ */
+typedef struct _map_view_route_data_s {
+       maps_route_h content;
+} map_view_route_data_s;
+#endif /* TIZEN_3_0_NEXT_MS */
+
+/*
+* This represents visual object information
+ */
+typedef struct _map_object_s {
+       map_object_type_e type; /* marker, polyline, polygon, group */
+
+       void *shape_data;       /* Pointer to the visual object data, such as
+                                  map_view_marker_data_s or
+                                  map_view_polyline_data_s */
+
+       bool visible;
+
+       map_object_h parent_group; /* The group, owning the object */
+
+       map_view_h view;        /* Link with the parent Map View */
+
+} map_object_s;
+
+
+extern int  _map_view_on_object_operation(map_view_h view,
+                                         const map_object_h object,
+                                         map_object_operation_e operation);
+
+static map_view_h __get_view(const map_object_h object);
+static map_view_group_data_s *__get_group_data(const map_object_h
+                                              object);
+static map_view_polyline_data_s *__get_polyline_data(const map_object_h
+                                                    object);
+static map_view_polygon_data_s *__get_polygon_data(const map_object_h
+                                                  object);
+static map_view_marker_data_s *__get_marker_data(const map_object_h
+                                                object);
+#ifdef TIZEN_3_0_NEXT_MS
+static map_view_route_data_s *__get_route_data(const map_object_h
+                                              object);
+#endif /* TIZEN_3_0_NEXT_MS */
+
+static int __map_view_group_data_create(void **group);
+static int __map_view_polyline_data_create(void **polyline);
+static int __map_view_polygon_data_create(void **polygon);
+static int __map_view_marker_data_create(void **marker);
+
+#ifdef TIZEN_3_0_NEXT_MS
+static int __map_view_route_data_create(void **route);
+#endif /* TIZEN_3_0_NEXT_MS */
+
+static int __map_view_group_data_destroy(void *group);
+static int __map_view_polyline_data_destroy(void *polyline);
+static int __map_view_polygon_data_destroy(void *polygon);
+static int __map_view_marker_data_destroy(void *marker);
+
+#ifdef TIZEN_3_0_NEXT_MS
+static int __map_view_route_data_destroy(void *route);
+#endif /* TIZEN_3_0_NEXT_MS */
+
+
+static map_view_h __get_view(const map_object_h object)
+{
+       if(!object)
+               return NULL;
+       map_object_s *o = (map_object_s *)object;
+       return o->view;
+}
+
+static map_view_group_data_s *__get_group_data(const map_object_h object)
+{
+       map_object_s *o = (map_object_s *)object;
+       if(!o || (o->type != MAP_OBJECT_GROUP))
+               return NULL;
+       return (map_view_group_data_s *)o->shape_data;
+}
+
+static int __map_view_group_data_create(void **group)
+{
+       if (!group)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       int error = MAPS_ERROR_NONE;
+       map_view_group_data_s *l = NULL;
+
+       do {
+               l = g_slice_new0(map_view_group_data_s);
+               if (!l) {
+                       MAPS_LOGE("OUT_OF_MEMORY(0x%08x)",
+                                 MAPS_ERROR_OUT_OF_MEMORY);
+                       return MAPS_ERROR_OUT_OF_MEMORY;
+               }
+
+               error = maps_item_list_create(&l->view_objects);
+               if (error != MAPS_ERROR_NONE)
+                       break;
+
+               *group = (map_view_group_data_s *) l;
+               return MAPS_ERROR_NONE;
+       } while(false);
+
+       __map_view_group_data_destroy(l);
+       return error;
+}
+
+static int __map_view_group_data_destroy(void *group)
+{
+       if (!group)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       map_view_group_data_s *l = (map_view_group_data_s *)group;
+       if (l->view_objects) {
+               maps_item_list_remove_all(l->view_objects, map_object_destroy);
+               maps_item_list_destroy(l->view_objects);
+       }
+
+       g_slice_free(map_view_group_data_s, l);
+
+       return MAPS_ERROR_NONE;
+}
+
+#ifdef TIZEN_3_0_NEXT_MS
+static int __map_view_route_data_create(void **route)
+{
+       if (!route)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       int error = MAPS_ERROR_NONE;
+       map_view_route_data_s *r = NULL;
+
+       do {
+               r = g_slice_new0(map_view_route_data_s);
+               if (!r) {
+                       MAPS_LOGE("OUT_OF_MEMORY(0x%08x)",
+                                 MAPS_ERROR_OUT_OF_MEMORY);
+                       return MAPS_ERROR_OUT_OF_MEMORY;
+               }
+
+               *route = (map_view_route_data_s *) r;
+               return MAPS_ERROR_NONE;
+       } while(false);
+
+       __map_view_route_data_destroy(r);
+       return error;
+}
+
+static int __map_view_route_data_destroy(void *route)
+{
+       if (!route)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       map_view_route_data_s *r = (map_view_route_data_s *)route;
+
+       if(r->content)
+               maps_route_destroy(r->content);
+
+       g_slice_free(map_view_route_data_s, r);
+
+       return MAPS_ERROR_NONE;
+}
+#endif /* TIZEN_3_0_NEXT_MS */
+
+static map_view_polyline_data_s *__get_polyline_data(const map_object_h
+                                                    object)
+{
+       map_object_s *o = (map_object_s *)object;
+       if(!o || (o->type != MAP_OBJECT_POLYLINE))
+               return NULL;
+       return (map_view_polyline_data_s *)o->shape_data;
+}
+
+static int __map_view_polyline_data_create(void **polyline)
+{
+       if (!polyline)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       int error = MAPS_ERROR_NONE;
+       map_view_polyline_data_s *p = NULL;
+
+       do {
+               p = g_slice_new0(map_view_polyline_data_s);
+               if (!p) {
+                       MAPS_LOGE("OUT_OF_MEMORY(0x%08x)",
+                                 MAPS_ERROR_OUT_OF_MEMORY);
+                       return MAPS_ERROR_OUT_OF_MEMORY;
+               }
+
+               error = maps_coordinates_list_create(&p->points);
+               if (error != MAPS_ERROR_NONE)
+                       break;
+
+               *polyline = (map_view_polyline_data_s *) p;
+               return MAPS_ERROR_NONE;
+       } while(false);
+
+       __map_view_polyline_data_destroy(p);
+       return error;
+}
+
+static int __map_view_polyline_data_destroy(void *polyline)
+{
+       if (!polyline)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       map_view_polyline_data_s *p = (map_view_polyline_data_s *)polyline;
+       if (p->points)
+               maps_coordinates_list_destroy(p->points);
+
+       g_slice_free(map_view_polyline_data_s, p);
+
+       return MAPS_ERROR_NONE;
+}
+
+static map_view_polygon_data_s *__get_polygon_data(const map_object_h
+                                                  object)
+{
+       map_object_s *o = (map_object_s *)object;
+       if(!o || (o->type != MAP_OBJECT_POLYGON))
+               return NULL;
+       return (map_view_polygon_data_s *)o->shape_data;
+}
+
+static int __map_view_polygon_data_create(void **polygon)
+{
+       if (!polygon)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       int error = MAPS_ERROR_NONE;
+       map_view_polygon_data_s *p = NULL;
+
+       do {
+               p = g_slice_new0(map_view_polygon_data_s);
+               if (!p) {
+                       MAPS_LOGE("OUT_OF_MEMORY(0x%08x)",
+                                 MAPS_ERROR_OUT_OF_MEMORY);
+                       return MAPS_ERROR_OUT_OF_MEMORY;
+               }
+
+               error = maps_coordinates_list_create(&p->points);
+               if (error != MAPS_ERROR_NONE)
+                       break;
+
+               *polygon = (map_view_polygon_data_s *) p;
+               return MAPS_ERROR_NONE;
+       } while(false);
+
+       __map_view_polygon_data_destroy(p);
+       return error;
+}
+
+static int __map_view_polygon_data_destroy(void *polygon)
+{
+       if (!polygon)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       map_view_polygon_data_s *p = (map_view_polygon_data_s *)polygon;
+       if (p->points)
+               maps_coordinates_list_destroy(p->points);
+
+       g_slice_free(map_view_polygon_data_s, p);
+
+       return MAPS_ERROR_NONE;
+}
+
+static map_view_marker_data_s *__get_marker_data(const map_object_h object)
+{
+       map_object_s *o = (map_object_s *)object;
+       if(!o || (o->type != MAP_OBJECT_MARKER))
+               return NULL;
+       return (map_view_marker_data_s *)o->shape_data;
+}
+
+#ifdef TIZEN_3_0_NEXT_MS
+static map_view_route_data_s *__get_route_data(const map_object_h object)
+{
+       map_object_s *o = (map_object_s *)object;
+       if(!o || (o->type != MAP_OBJECT_ROUTE))
+               return NULL;
+       return (map_view_route_data_s *)o->shape_data;
+}
+#endif /* TIZEN_3_0_NEXT_MS */
+
+static int __map_view_marker_data_create(void **marker)
+{
+       if (!marker)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+
+       int error = MAPS_ERROR_NONE;
+       map_view_marker_data_s *m = NULL;
+
+       do {
+               m = g_slice_new0(map_view_marker_data_s);
+               if (!m) {
+                       MAPS_LOGE("OUT_OF_MEMORY(0x%08x)",
+                                 MAPS_ERROR_OUT_OF_MEMORY);
+                       return MAPS_ERROR_OUT_OF_MEMORY;
+               }
+
+               error = maps_coordinates_create(.0, .0, &m->coordinates);
+               if (error != MAPS_ERROR_NONE)
+                       break;
+
+               m->type = MAP_MARKER_NONE;
+
+               *marker = (map_view_marker_data_s *) m;
+               return MAPS_ERROR_NONE;
+       } while(false);
+
+       __map_view_marker_data_destroy(m);
+       return error;
+}
+
+static int __map_view_marker_data_destroy(void *marker)
+{
+       if (!marker)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       map_view_marker_data_s *m = (map_view_marker_data_s *)marker;
+       if (m->coordinates)
+               maps_coordinates_destroy(m->coordinates);
+
+       if (m->file_path)
+               g_free(m->file_path);
+       if (m->text)
+               g_free(m->text);
+
+       g_slice_free(map_view_marker_data_s, m);
+
+       return MAPS_ERROR_NONE;
+}
+
+int _map_object_create(const map_object_type_e type, map_object_h *object)
+{
+       if (!object)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       if ((type < MAP_OBJECT_GROUP) || (type > MAP_OBJECT_UNKNOWN))
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       int error = MAPS_ERROR_NONE;
+       map_object_s *o = NULL;
+
+       do {
+               o = g_slice_new0(map_object_s);
+               if (!o) {
+                       MAPS_LOGE("OUT_OF_MEMORY(0x%08x)",
+                                 MAPS_ERROR_OUT_OF_MEMORY);
+                       return MAPS_ERROR_OUT_OF_MEMORY;
+               }
+
+               o->type = type;
+               o->view = NULL;
+
+               int error = MAPS_ERROR_NONE;
+               switch(o->type) {
+               case MAP_OBJECT_GROUP:
+                       error = __map_view_group_data_create(&o->shape_data);
+                       break;
+               case MAP_OBJECT_POLYLINE:
+                       error = __map_view_polyline_data_create(&o->shape_data);
+                       break;
+               case MAP_OBJECT_POLYGON:
+                       error = __map_view_polygon_data_create(&o->shape_data);
+                       break;
+               case MAP_OBJECT_MARKER:
+                       error = __map_view_marker_data_create(&o->shape_data);
+                       break;
+#ifdef TIZEN_3_0_NEXT_MS
+               case MAP_OBJECT_ROUTE:
+                       error = __map_view_route_data_create(&o->shape_data);
+                       break;
+#endif /* TIZEN_3_0_NEXT_MS */
+               default:
+                       break;
+               }
+
+               if((!o->shape_data) || (error != MAPS_ERROR_NONE))
+                       break;
+
+               /* Notify view, that the object was constructed */
+               /*if(view)
+                 _map_view_on_object_operation(view,
+                 o,
+                 MAP_OBJECT_ADD);*/
+
+               *object = (map_object_h) o;
+               return MAPS_ERROR_NONE;
+       } while(false);
+       map_object_destroy(o);
+       return error;
+}
+
+#ifdef IMPROVEMENT_OF_VISUAL_OBJECTS
+static bool __map_object_group_object_set_view_cb(int index, int total, map_object_h object, void *user_data)
+{
+       if (!object || !user_data) return false;
+
+       map_view_h view = (map_view_h)user_data;
+       map_object_s *o = (map_object_s *) object;
+       o->view = view;
+       return true;
+}
+#endif
+
+int _map_object_set_view(map_object_h object, map_view_h view)
+{
+       if (!object || !view)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+#ifdef IMPROVEMENT_OF_VISUAL_OBJECTS
+       map_object_type_e type = MAP_OBJECT_UNKNOWN;
+       map_object_get_type(object, &type);
+       if (type == MAP_OBJECT_GROUP)
+               map_object_group_foreach_object(object, __map_object_group_object_set_view_cb, view);
+#endif
+
+       map_object_s *o = (map_object_s *) object;
+       o->view = view;
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int map_object_create_marker(const maps_coordinates_h coordinates,
+                                       const char *image_file_path,
+                                       const map_marker_type_e type,
+                                       map_object_h *marker)
+{
+       MAPS_LOG_API;
+       if (!coordinates || !marker)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       if((type < MAP_MARKER_POI) || (type > MAP_MARKER_NONE))
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Create a Marker Visual Object */
+       view::marker_constructor mc;
+       *marker = mc.construct(coordinates, image_file_path, type);
+       if(mc.get_error() == MAPS_ERROR_NONE)
+               return mc.get_error();
+
+       /* Marker create failure */
+       map_object_destroy(*marker);
+       *marker = NULL;
+       return mc.get_error();
+}
+
+#ifdef TIZEN_3_0_NEXT_MS
+EXPORT_API int map_object_create_route(const maps_route_h route,
+                                      map_object_h *route_object)
+{
+       MAPS_LOG_API;
+       if (!route|| !route_object)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Create a Route Visual Object */
+       view::route_constructor rc;
+       *route_object = rc.construct(route);
+       if(error != MAPS_ERROR_NONE)
+               return rc.get_error();
+
+       if(rc.get_error() == MAPS_ERROR_NONE)
+               return MAPS_ERROR_NONE;
+
+       /* Route create failure */
+       map_object_destroy(*route_object);
+       *route_object = NULL;
+       return rc.get_error();
+}
+#endif /* TIZEN_3_0_NEXT_MS */
+
+EXPORT_API int map_object_create_polyline(const maps_coordinates_list_h coordinates,
+                                         const unsigned char r,
+                                         const unsigned char g,
+                                         const unsigned char b,
+                                         const unsigned char a,
+                                         const int width,
+                                         map_object_h *polyline)
+{
+       MAPS_LOG_API;
+       if (!coordinates || !polyline)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Create a Polyline Visual Object */
+       view::polyline_constructor pc;
+       *polyline = pc.construct(coordinates, r, g, b, a, width);
+       if(pc.get_error() == MAPS_ERROR_NONE)
+               return pc.get_error();
+
+       /* Polyline create failure */
+       map_object_destroy(*polyline);
+       *polyline = NULL;
+       return pc.get_error();
+}
+
+EXPORT_API int map_object_create_polygon(const maps_coordinates_list_h coordinates,
+                                        const unsigned char r,
+                                        const unsigned char g,
+                                        const unsigned char b,
+                                        const unsigned char a,
+                                        map_object_h *polygon)
+{
+       MAPS_LOG_API;
+       if (!coordinates || !polygon)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Create a Polygon Visual Object */
+       view::polygon_constructor pc;
+       *polygon = pc.construct(coordinates, r, g, b, a);
+       if(pc.get_error() == MAPS_ERROR_NONE)
+               return pc.get_error();
+
+       /* Polygon create failure */
+       map_object_destroy(*polygon);
+       *polygon = NULL;
+       return pc.get_error();
+}
+
+EXPORT_API int map_object_create_group(map_object_h *group)
+{
+       MAPS_LOG_API;
+       if (!group)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Create a Group Visual Object */
+       int error = _map_object_create(MAP_OBJECT_GROUP, group);
+       if(error != MAPS_ERROR_NONE)
+               return error;
+
+       return map_object_set_visible(*group, true);
+}
+
+EXPORT_API int map_object_destroy(map_object_h object)
+{
+       if (!object)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       map_object_s *o = (map_object_s *) object;
+
+       /* Notify view, that the object is to be destroyed shortly */
+       _map_view_on_object_operation(o->view, o, MAP_OBJECT_REMOVE);
+
+       int error = MAPS_ERROR_NONE;
+       switch(o->type) {
+       case MAP_OBJECT_GROUP:
+               error = __map_view_group_data_destroy(o->shape_data);
+               break;
+       case MAP_OBJECT_POLYLINE:
+               error = __map_view_polyline_data_destroy(o->shape_data);
+               break;
+       case MAP_OBJECT_POLYGON:
+               error = __map_view_polygon_data_destroy(o->shape_data);
+               break;
+       case MAP_OBJECT_MARKER:
+               error = __map_view_marker_data_destroy(o->shape_data);
+               break;
+
+#ifdef TIZEN_3_0_NEXT_MS
+       case MAP_OBJECT_ROUTE:
+               error = __map_view_route_data_destroy(o->shape_data);
+               break;
+#endif /* TIZEN_3_0_NEXT_MS */
+
+       default:
+               break;
+       }
+       g_slice_free(map_object_s, object);
+       return error;
+}
+
+EXPORT_API int map_object_get_type(const map_object_h object,
+                                  map_object_type_e *type)
+{
+       MAPS_LOG_API;
+       if (!object || !type)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       *type = ((map_object_s *)object)->type;
+       return MAPS_ERROR_NONE;
+}
+
+
+/**
+* Visual Object Operations
+ */
+
+EXPORT_API int map_object_move(map_object_h object,
+                              const maps_coordinates_h coordinates)
+{
+       MAPS_LOG_API;
+       if (!object || !coordinates)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_object_s *o = (map_object_s *)object;
+
+       switch(o->type) {
+       case MAP_OBJECT_GROUP: {
+               g_print("TODO: implement moving of group\n");
+               break;
+       }
+       case MAP_OBJECT_POLYLINE: {
+               g_print("TODO: implement moving of polyline\n");
+               break;
+       }
+       case MAP_OBJECT_POLYGON: {
+               g_print("TODO: implement moving of polygon\n");
+               break;
+       }
+       case MAP_OBJECT_MARKER: {
+               g_print("TODO: implement moving of polygon\n");
+               break;
+               /*map_object_h marker_data =
+                 (map_object_h)o->shape_data;
+                 return map_object_marker_set_coordinates(marker_data,
+                 coordinates);*/
+       }
+
+#ifdef TIZEN_3_0_NEXT_MS
+       case MAP_OBJECT_ROUTE: {
+               g_print("TODO: implement moving of route\n");
+               break;
+       }
+#endif /* TIZEN_3_0_NEXT_MS */
+
+       case MAP_OBJECT_UNKNOWN:
+       default:
+               return MAPS_ERROR_INVALID_PARAMETER;
+       }
+
+       /* Notify view, that the object is to be moved */
+       _map_view_on_object_operation(o->view, o, MAP_OBJECT_MOVE);
+
+       /* TODO: if the object has parent group, it is neede to check
+       * if its geometry was affected by this object movement */
+
+       return MAPS_ERROR_NONE;
+}
+
+#ifndef IMPROVEMENT_OF_VISUAL_OBJECTS
+static bool __set_object_visible_cb(int index, int total,
+                                   map_object_h object,
+                                   void* user_data)
+{
+       if (!user_data)
+               return false;
+       bool *visible = (bool *)user_data;
+       return (map_object_set_visible(object, *visible) ==
+               MAPS_ERROR_NONE);
+}
+#endif
+
+EXPORT_API int map_object_set_visible(map_object_h object,
+                                     const bool visible)
+{
+       MAPS_LOG_API;
+       if (!object)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_object_s *o = (map_object_s *)object;
+       o->visible = visible;
+
+#ifndef IMPROVEMENT_OF_VISUAL_OBJECTS
+       if (o->type == MAP_OBJECT_GROUP) {
+               bool visible_flag = visible;
+               map_object_group_foreach_object(object,
+                                               __set_object_visible_cb,
+                                               &visible_flag);
+       }
+#endif
+
+       /* Notify view, that the object visibility is changed */
+       _map_view_on_object_operation(o->view, o, MAP_OBJECT_SET_VISIBLE);
+
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int map_object_get_visible(map_object_h object,
+                                     bool *visible)
+{
+       MAPS_LOG_API;
+       if (!object || !visible)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_object_s *o = (map_object_s *)object;
+       *visible = o->visible;
+       return MAPS_ERROR_NONE;
+}
+
+/*----------------------------------------------------------------------------*/
+/*
+* Layer
+ */
+EXPORT_API int map_object_group_add_object(map_object_h group,
+                                          const map_object_h object)
+{
+       MAPS_LOG_API;
+       if (!group || !object)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_view_group_data_s *l = __get_group_data(group);
+       if (!l)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       if (!l->view_objects)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       const int error = maps_item_list_append(l->view_objects,
+                                               object,
+                                               maps_item_no_clone);
+
+       /* Notify view, that the object specific preferences is changed */
+       if(error == MAPS_ERROR_NONE)
+               _map_view_on_object_operation(__get_view(group),
+                                             group,
+                                             MAP_OBJECT_CHANGE);
+
+       return error;
+}
+
+#if 0
+/* TO BE REMOVED */
+int map_object_group_set_objects(map_object_h group,
+                                const maps_item_list_h objects)
+{
+       if (!group || !objects)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_view_group_data_s *l = __get_group_data(group);
+       if (!l)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       if (!l->view_objects)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       maps_item_list_remove_all(l->view_objects, map_object_destroy);
+       maps_item_list_destroy(l->view_objects);
+
+       const int error =  maps_item_list_clone(objects,
+                                               maps_item_no_clone,
+                                               &l->view_objects);
+
+       /* Notify view, that the object specific preferences is changed */
+       if(error == MAPS_ERROR_NONE)
+               _map_view_on_object_operation(__get_view(group),
+                                             group,
+                                             MAP_OBJECT_CHANGE);
+
+       return error;
+}
+#endif
+
+EXPORT_API int map_object_group_remove_object(map_object_h group,
+                                             map_object_h object)
+{
+       MAPS_LOG_API;
+       if (!group || !object)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_view_group_data_s *l = __get_group_data(group);
+       if (!l)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       if (!l->view_objects)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       const int error = maps_item_list_remove(l->view_objects,
+                                               object,
+                                               map_object_destroy);
+
+       /* Notify view, that the object specific preferences is changed */
+       if(error == MAPS_ERROR_NONE)
+               _map_view_on_object_operation(__get_view(group),
+                                             group,
+                                             MAP_OBJECT_CHANGE);
+
+       return error;
+}
+
+
+EXPORT_API int map_object_group_foreach_object(const map_object_h
+                                              group,
+                                              map_object_group_object_cb
+                                              callback,
+                                              void* user_data)
+{
+       MAPS_LOG_API;
+       if (!group || !callback)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_view_group_data_s *l = __get_group_data(group);
+       if (!l)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       return maps_item_list_foreach(l->view_objects,
+                                     maps_item_no_clone,
+                                     callback,
+                                     user_data);
+}
+
+
+/*----------------------------------------------------------------------------*/
+/*
+* Polyline
+ */
+
+EXPORT_API int map_object_polyline_add_point(map_object_h polyline,
+                                        const maps_coordinates_h point)
+{
+       MAPS_LOG_API;
+       if (!polyline || !point)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Get the polyline data pointer */
+       map_view_polyline_data_s *p = __get_polyline_data(polyline);
+       if(!p)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Append a point to the polyline */
+       const int error = maps_coordinates_list_append(p->points, point);
+
+       /* Notify view, that the object specific preferences is changed */
+       if(error == MAPS_ERROR_NONE)
+               _map_view_on_object_operation(__get_view(polyline),
+                                             polyline,
+                                             MAP_OBJECT_CHANGE);
+
+       return error;
+}
+
+EXPORT_API int map_object_polyline_set_polyline(map_object_h polyline,
+                                         const maps_coordinates_list_h points)
+{
+       MAPS_LOG_API;
+       if (!polyline || !points)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Get the polyline data pointer */
+       map_view_polyline_data_s *p = __get_polyline_data(polyline);
+       if(!p)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Set new polyline trajectory */
+       maps_coordinates_list_destroy(p->points);
+       //const int error = maps_coordinates_list_clone(points, &p->points);
+       const int error = MAPS_ERROR_INVALID_OPERATION;
+       MAPS_LOGE("ERROR!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
+
+       /* Notify view, that the object specific preferences is changed */
+       if(error == MAPS_ERROR_NONE)
+               _map_view_on_object_operation(__get_view(polyline),
+                                             polyline,
+                                             MAP_OBJECT_CHANGE);
+
+       return error;
+}
+
+EXPORT_API int map_object_polyline_foreach_point(map_object_h polyline,
+                                                maps_coordinates_cb callback,
+                                                void *user_data)
+{
+       MAPS_LOG_API;
+       if (!polyline || !callback)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Get the polyline data pointer */
+       map_view_polyline_data_s *p = __get_polyline_data(polyline);
+       if(!p)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Iterate over polyline trajectory */
+       return maps_coordinates_list_foreach(p->points, callback, user_data);
+}
+
+
+EXPORT_API int map_object_polyline_set_color(map_object_h polyline,
+                                            const unsigned char r,
+                                            const unsigned char g,
+                                            const unsigned char b,
+                                            const unsigned char a)
+{
+       MAPS_LOG_API;
+       if (!polyline)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Get the polyline data pointer */
+       map_view_polyline_data_s *p = __get_polyline_data(polyline);
+       if(!p)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Set new color */
+       p->r = r;
+       p->g = g;
+       p->b = b;
+       p->a = a;
+
+       /* Notify view, that the object specific preferences is changed */
+       _map_view_on_object_operation(__get_view(polyline),
+                                     polyline,
+                                     MAP_OBJECT_CHANGE);
+
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int map_object_polyline_get_color(const map_object_h polyline,
+                                            unsigned char *r,
+                                            unsigned char *g,
+                                            unsigned char *b,
+                                            unsigned char *a)
+{
+       MAPS_LOG_API;
+       if (!polyline || !r || !g || !b || !a)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Get the polyline data pointer */
+       map_view_polyline_data_s *p = __get_polyline_data(polyline);
+       if(!p)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Retrieve the color */
+       *r = p->r;
+       *g = p->g;
+       *b = p->b;
+       *a = p->a;
+       return MAPS_ERROR_NONE;
+}
+
+
+EXPORT_API int map_object_polyline_set_width(map_object_h polyline,
+                                            const int width)
+{
+       MAPS_LOG_API;
+       if (!polyline)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       if(width < 0)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Get the polyline data pointer */
+       map_view_polyline_data_s *p = __get_polyline_data(polyline);
+       if(!p)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Update the width of polyline */
+       p->width = width;
+
+       /* Notify view, that the object specific preferences is changed */
+       _map_view_on_object_operation(__get_view(polyline),
+                                     polyline,
+                                     MAP_OBJECT_CHANGE);
+
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int map_object_polyline_get_width(const map_object_h polyline,
+                                            int *width)
+{
+       MAPS_LOG_API;
+       if (!polyline || !width)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Get the polyline data pointer */
+       map_view_polyline_data_s *p = __get_polyline_data(polyline);
+       if(!p)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Retrieve the width of the polyline */
+       *width = p->width;
+       return MAPS_ERROR_NONE;
+}
+
+/*----------------------------------------------------------------------------*/
+/*
+* Polygon
+ */
+
+EXPORT_API int map_object_polygon_add_point(map_object_h polygon,
+                                           const maps_coordinates_h point)
+{
+       MAPS_LOG_API;
+       if (!polygon || !point)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Get the polygon data pointer */
+       map_view_polygon_data_s *p = __get_polygon_data(polygon);
+       if(!p)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Add the point to the polygon */
+       const int error = maps_coordinates_list_append(p->points, point);
+
+       /* Notify view, that the object specific preferences is changed */
+       if(error == MAPS_ERROR_NONE)
+               _map_view_on_object_operation(__get_view(polygon),
+                                             polygon,
+                                             MAP_OBJECT_CHANGE);
+
+       return error;
+}
+
+EXPORT_API int map_object_polygon_set_polygon(map_object_h polygon,
+                                             const maps_coordinates_list_h points)
+{
+       MAPS_LOG_API;
+       if (!polygon || !points)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Get the polygon data pointer */
+       map_view_polygon_data_s *p = __get_polygon_data(polygon);
+       if(!p)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Set new polygon border */
+       maps_coordinates_list_destroy(p->points);
+       //const int error = maps_coordinates_list_clone(points, &p->points);
+       const int error = MAPS_ERROR_INVALID_OPERATION;
+       MAPS_LOGE("ERROR!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
+
+       /* Notify view, that the object specific preferences is changed */
+       if(error == MAPS_ERROR_NONE)
+               _map_view_on_object_operation(__get_view(polygon),
+                                             polygon,
+                                             MAP_OBJECT_CHANGE);
+
+       return error;
+}
+
+EXPORT_API int map_object_polygon_foreach_point(map_object_h polygon,
+                                               maps_coordinates_cb callback,
+                                               void *user_data)
+{
+       MAPS_LOG_API;
+       if (!polygon || !callback)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Get the polygon data pointer */
+       map_view_polygon_data_s *p = __get_polygon_data(polygon);
+       if(!p)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Iterate over polygon border */
+       return maps_coordinates_list_foreach(p->points, callback, user_data);
+}
+
+
+EXPORT_API int map_object_polygon_set_fill_color(map_object_h polygon,
+                                                const unsigned char r,
+                                                const unsigned char g,
+                                                const unsigned char b,
+                                                const unsigned char a)
+{
+       MAPS_LOG_API;
+       if (!polygon)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Get the polygon data pointer */
+       map_view_polygon_data_s *p = __get_polygon_data(polygon);
+       if(!p)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Set new background color */
+       p->r = r;
+       p->g = g;
+       p->b = b;
+       p->a = a;
+
+       /* Notify view, that the object specific preferences is changed */
+       _map_view_on_object_operation(__get_view(polygon),
+                                     polygon,
+                                     MAP_OBJECT_CHANGE);
+
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int map_object_polygon_get_fill_color(const map_object_h polygon,
+                                                unsigned char *r,
+                                                unsigned char *g,
+                                                unsigned char *b,
+                                                unsigned char *a)
+{
+       MAPS_LOG_API;
+       if (!polygon)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Get the polygon data pointer */
+       map_view_polygon_data_s *p = __get_polygon_data(polygon);
+       if(!p)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Retrieve the background color */
+       if (r)
+               *r = p->r;
+       if (g)
+               *g = p->g;
+       if (b)
+               *b = p->b;
+       if (a)
+               *a = p->a;
+       return MAPS_ERROR_NONE;
+}
+
+
+/*----------------------------------------------------------------------------*/
+/*
+* Marker
+ */
+
+
+EXPORT_API int map_object_marker_set_coordinates(map_object_h marker,
+                                                const maps_coordinates_h
+                                                coordinates)
+{
+       MAPS_LOG_API;
+       if (!marker || !coordinates)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_view_marker_data_s *m = __get_marker_data(marker);
+       if (!m)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       if (m->coordinates)
+               maps_coordinates_destroy(m->coordinates);
+       const int error = maps_coordinates_clone(coordinates, &m->coordinates);
+
+       /* Notify view, that the object specific preferences is changed */
+       if(error == MAPS_ERROR_NONE)
+               _map_view_on_object_operation(__get_view(marker),
+                                             marker,
+                                             MAP_OBJECT_CHANGE);
+
+       return error;
+
+}
+
+EXPORT_API int map_object_marker_resize(map_object_h
+                                       marker,
+                                       const int screen_width,
+                                       const int screen_height)
+{
+       MAPS_LOG_API;
+       if (!marker)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       if ((screen_width <= 0) || (screen_height <= 0))
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_view_marker_data_s *m = __get_marker_data(marker);
+       if (!m)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       m->screen_width = screen_width;
+       m->screen_height = screen_height;
+
+       /* Notify view, that the object specific preferences is changed */
+       _map_view_on_object_operation(__get_view(marker),
+                                     marker,
+                                     MAP_OBJECT_CHANGE);
+
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int map_object_marker_set_image_file(map_object_h
+                                               marker,
+                                               const char *file_path)
+{
+       MAPS_LOG_API;
+       if (!marker || !file_path)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_view_marker_data_s *m = __get_marker_data(marker);
+       if (!m)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       const int error = maps_set_string(file_path,
+                                         _MAP_MARKER_FILE_PATH_MAX_LENGTH,
+                                         &m->file_path);
+
+       /* Notify view, that the object specific preferences is changed */
+       if(error == MAPS_ERROR_NONE)
+               _map_view_on_object_operation(__get_view(marker),
+                                             marker,
+                                             MAP_OBJECT_CHANGE);
+
+       return error;
+
+}
+
+EXPORT_API int map_object_marker_set_text(map_object_h marker,
+                                         const char *text)
+{
+       MAPS_LOG_API;
+       if (!marker || !text)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_view_marker_data_s *m = __get_marker_data(marker);
+       if (!m)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       const int error = maps_set_string(text,
+                                         _MAP_MARKER_TEXT_MAX_LENGTH,
+                                         &m->text);
+
+       /* Notify view, that the object specific preferences is changed */
+       if(error == MAPS_ERROR_NONE)
+               _map_view_on_object_operation(__get_view(marker),
+                                             marker,
+                                             MAP_OBJECT_CHANGE);
+
+       return error;
+}
+
+int _map_object_marker_set_type(map_object_h marker,
+                               const map_marker_type_e type)
+{
+       /* MAPS_LOG_API; */
+       if (!marker)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       if ((type < MAP_MARKER_POI) || (type > MAP_MARKER_NONE))
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_view_marker_data_s *m = __get_marker_data(marker);
+       if (!m)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       m->type = type;
+
+       /* Notify view, that the object specific preferences is changed */
+       /*_map_view_on_object_operation(__get_view(marker),
+         marker,
+         MAP_OBJECT_CHANGE);*/
+
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int map_object_marker_get_coordinates(const map_object_h marker,
+                                               maps_coordinates_h *coordinates)
+{
+       MAPS_LOG_API;
+       if (!marker || !coordinates)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_view_marker_data_s *m = __get_marker_data(marker);
+       if (!m)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       return maps_coordinates_clone(m->coordinates, coordinates);
+}
+
+EXPORT_API int map_object_marker_get_size(map_object_h
+                                         marker,
+                                         int *screen_width,
+                                         int *screen_height)
+{
+       MAPS_LOG_API;
+       if (!marker)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_view_marker_data_s *m = __get_marker_data(marker);
+       if (!m)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       if (screen_width)
+               *screen_width = m->screen_width;
+       if (screen_height)
+               *screen_height = m->screen_height;
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int map_object_marker_get_image_file(const map_object_h marker,
+                                               char **file_path)
+{
+       MAPS_LOG_API;
+       if (!marker || !file_path)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_view_marker_data_s *m = __get_marker_data(marker);
+       if (!m)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       return maps_get_string(m->file_path,
+                              _MAP_MARKER_FILE_PATH_MAX_LENGTH,
+                              file_path);
+}
+
+EXPORT_API int map_object_marker_get_type(const map_object_h
+                                         marker,
+                                         map_marker_type_e *type)
+{
+       MAPS_LOG_API;
+       if (!marker || !type)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_view_marker_data_s *m = __get_marker_data(marker);
+       if (!m)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       *type = m->type;
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int map_object_marker_get_text(const map_object_h
+                                         marker,
+                                         char **text)
+{
+       MAPS_LOG_API;
+       if (!marker || !text)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_view_marker_data_s *m = __get_marker_data(marker);
+       if (!m)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       return maps_get_string(m->text, _MAP_MARKER_TEXT_MAX_LENGTH, text);
+}
+
+
+/*----------------------------------------------------------------------------*/
+/*
+* Route
+ */
+
+#ifdef TIZEN_3_0_NEXT_MS
+int _map_object_route_set_content(map_object_h route,
+                                 const maps_route_h content)
+{
+       if (!route|| !content)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_view_route_data_s *r = __get_route_data(route);
+       if (!r)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       const int error = maps_route_clone(content, &r->content);
+
+       /* Notify view, that the object specific preferences is changed */
+       if(error == MAPS_ERROR_NONE)
+               _map_view_on_object_operation(__get_view(route),
+                                             route,
+                                             MAP_OBJECT_CHANGE);
+
+       return error;
+}
+
+EXPORT_API int map_object_route_get_content(const map_object_h route,
+                                           maps_route_h *content)
+{
+       if (!route|| !content)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_view_route_data_s *r = __get_route_data(route);
+       if (!r)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* TODO: discuss if we need cloning or is it enough to return existing
+       *  handle */
+       return maps_route_clone(r->content, content);
+}
+#endif /* TIZEN_3_0_NEXT_MS */
diff --git a/src/api/map_view.cpp b/src/api/map_view.cpp
new file mode 100755 (executable)
index 0000000..1945ab7
--- /dev/null
@@ -0,0 +1,1855 @@
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <tizen.h>
+#include <Ecore.h>
+#include <Evas.h>
+#include <unistd.h>
+#include <glib.h>
+
+#include "map_view.h"
+#include "maps_util.h"
+#include "module.h"
+#include "empty_module.h"
+#include "commands.h"
+#include "command_queue.h"
+#include "poly_shape_hit_test.h"
+#include "gesture_processor.h"
+#include "inertial_camera.h"
+#include "inertial_gesture.h"
+#include "gesture_detector_statemachine.h"
+
+
+/* TODO: remove useless or duplicative includes */
+
+
+/*
+ * The structure of callbacks info, Maps View is invoking during events
+ */
+typedef struct _map_view_callback_info_s {
+       map_view_on_event_cb callback;
+       void *user_data;
+} map_view_callback_info_s;
+
+/*
+ * The structure of map view idle listener callbacks info
+ */
+typedef struct _map_view_idle_listener_info_s {
+       void (*callback)(void *user_data);
+       void *user_data;
+} map_view_idle_listener_info_s;
+
+
+
+/*
+ * The structure of Maps View internal data
+ */
+typedef struct _map_view_s {
+
+       /* Map Coordinates and Area */
+       maps_area_h area;
+       maps_coordinates_h center;
+
+       /* Run-time scale values */
+       double zoom_factor;
+       double rotation_angle; /* in graduses */
+       int zoom_level;
+
+       /* Camera inertial transition data */
+       view::inertial_camera *inertial_camera;
+       map_view_idle_listener_info_s idle_listener;
+
+       /* We'd better to store that values in order to easily limit zoom level
+        * and factor in the run time without accessing the plugin frequently */
+       int min_zoom_level;
+       int max_zoom_level;
+
+       /* The handle of Maps Service, used by Map View */
+       maps_service_h maps;
+
+       /* List of Visual Objects on the View */
+       maps_item_list_h view_objects;
+
+       /* Evas basis */
+       Evas *canvas;
+       Evas_Object *panel;
+
+       /* Gesture Support */
+       map_action_e gesture_actions[MAP_GESTURE_NONE + 1];
+       bool gesture_available[MAP_GESTURE_NONE + 1];
+
+       /* Continuous gesture info */
+       view::finger_event_stream *finger_stream;
+
+       /* Map View callbacks */
+       map_view_callback_info_s event_callbacks[MAP_EVENT_READY + 1];
+
+       /* Evas Queue support */
+       Ecore_Idler *idler;
+       Ecore_Animator *animator;
+       volatile bool ready_to_draw;
+
+       /* Map View Preferences */
+       map_view_type_e type;
+       char *language;
+
+} map_view_s;
+
+
+/* ---------------------------------------------------------------------------*/
+
+
+const gsize _MAPS_VIEW_LANGUAGE_MAX_LENGTH = 16;
+
+
+/* ---------------------------------------------------------------------------*/
+
+
+extern plugin::plugin_s *__extract_plugin(maps_service_h maps);
+
+
+extern int _map_event_data_set_type(map_event_data_h event,
+                                   map_event_type_e event_type);
+
+extern int _map_event_data_set_gesture_type(map_event_data_h event,
+                                           const map_gesture_e
+                                           gesture_type);
+
+extern int _map_event_data_set_action_type(map_event_data_h event,
+                                          const map_action_e action_type);
+
+extern int _map_event_data_set_center(map_event_data_h event,
+                                     const maps_coordinates_h center);
+
+extern int _map_event_data_set_delta(map_event_data_h event,
+                                    const int delta_x, const int delta_y);
+
+extern int _map_event_data_set_xy(map_event_data_h event,
+                                 const int x, const int y);
+
+extern int _map_event_data_set_fingers(map_event_data_h event,
+                                      const int fingers);
+
+extern int _map_event_data_set_zoom_factor(map_event_data_h event,
+                                          const double zoom_factor);
+
+extern int _map_event_data_set_rotation_angle(map_event_data_h event,
+                                             const double rotation_angle);
+
+extern int _map_event_data_set_object(map_event_data_h event,
+                                     map_object_h object);
+
+extern int _map_event_data_create(map_event_data_h *event);
+
+extern int _map_object_set_view(map_object_h object, map_view_h view);
+
+map_event_data_h _map_view_create_event_data(map_event_type_e type);
+
+void _map_view_invoke_event_callback(map_view_h view,
+                                    map_event_data_h event_data);
+
+
+/* ---------------------------------------------------------------------------*/
+
+
+/* TODO: Apply this approach for other cases, particularly, in maps_service.h*/
+static const plugin::interface_s *__get_plugin_interface(map_view_h view)
+{
+       const plugin::plugin_s *p =
+               __extract_plugin(((map_view_s *)view)->maps);
+       return (p) ? (&p->interface) : plugin::get_empty_interface_ptr();
+}
+
+
+/* ---------------------------------------------------------------------------*/
+
+
+static void __map_view_on_event_empty_cb(maps_error_e result,
+                                        const map_event_type_e type,
+                                        map_event_data_h event_data,
+                                        void *user_data)
+{
+       /* empty */
+}
+
+
+session::command_queue *__map_view_select_q()
+{
+       /*
+        *  This is a draw-enforcing mode, when the rendering and drawing
+        *  of the map is happening as fast as it possible.
+        *  This mode is good when the Map View is a single active widget
+        *  of the App.
+        *  In this mode we are relying on the ecore main loop and the
+        *  assumption, that loop steps will apear continuously, not
+        *  simultaneously.
+        *  https://docs.enlightenment.org/efl/1.15.0/Ecore_Main_Loop_Page.html
+        */
+       return session::command_queue_sync::interface();
+
+       /*
+        * This is an analogy of previous mode, but with thread safety
+        * implemented
+        */
+       /*return session::command_queue_async::interface();*/
+
+       /*
+        *  This is a thread-friendly mode, when all heavy computations
+        *  are performed in the "idle" mode.
+        *  This mode is good for apps, which has other active widgets in
+        *  addition to Map View.
+        *  This approach allows compression of repeating commands as well
+        */
+       /* return session::command_queue_view::interface(); */
+}
+
+static session::command_queue *q()
+{
+       /* Obsolete approach */
+       /*return session::command_queue_view::interface();*/
+
+       return __map_view_select_q();
+}
+
+bool _map_view_is_gesture_available(map_view_h view,
+                                   map_gesture_e gesture)
+{
+       if(!view)
+               return false;
+       map_view_s *v = (map_view_s *)view;
+       return v->gesture_available[gesture];
+}
+
+map_action_e _map_view_get_gesture_action(map_view_h view,
+                                              map_gesture_e gesture)
+{
+       if(!view)
+               return MAP_ACTION_NONE;
+       map_view_s *v = (map_view_s *)view;
+       return v->gesture_actions[gesture];
+}
+
+void *_map_view_get_maps_service_ptr(map_view_h view)
+{
+       if(!view)
+               return NULL;
+       map_view_s *v = (map_view_s *)view;
+       return v->maps;
+}
+
+int _map_view_on_object_operation(map_view_h view,
+                                 const map_object_h object,
+                                 map_object_operation_e operation)
+{
+       if(!view)
+               return  MAPS_ERROR_INVALID_PARAMETER;
+
+       if(!__get_plugin_interface(view)->maps_plugin_on_object)
+               return  MAPS_ERROR_INVALID_PARAMETER;
+
+       return __get_plugin_interface(view)->maps_plugin_on_object(object,
+                                                               operation);
+}
+
+#if 0
+/* DEBUG: for mesuring FPS */
+#include <sys/timeb.h>
+static int __get_milli_count()
+{
+       timeb tb;
+       ftime(&tb);
+       int nCount = tb.millitm + (tb.time & 0xfffff) * 1000;
+       return nCount;
+}
+#endif
+
+
+static void __on_canvas_tap(void *data,
+                           Evas *e,
+                           Evas_Object *obj,
+                           void *event_info)
+{
+       MAPS_LOGI("__on_canvas_tap");
+       if(!event_info || !data)
+               return;
+
+       /* Extract the view ptr */
+       map_view_s *v = (map_view_s *)data;
+       if(!v->finger_stream)
+               return;
+
+       /* Detect & Process the gesture */
+       v->finger_stream->tap((Evas_Event_Mouse_Down *)event_info);
+}
+
+static void __on_canvas_up(void *data,
+                          Evas *e,
+                          Evas_Object *obj,
+                          void *event_info)
+{
+       MAPS_LOGI("__on_canvas_up");
+       if(!event_info || !data)
+               return;
+
+       /* Extract the view ptr */
+       map_view_s *v = (map_view_s *)data;
+       if(!v->finger_stream)
+               return;
+
+       /* Detect & Process the gesture */
+       v->finger_stream->up((Evas_Event_Mouse_Up *)event_info);
+}
+
+
+static void __on_canvas_line(void *data,
+                            Evas *e,
+                            Evas_Object *obj,
+                            void *event_info)
+{
+       MAPS_LOGI("__on_canvas_line");
+       if(!event_info || !data)
+               return;
+
+       /*  Extract view ptr */
+       map_view_s *v = (map_view_s *)data;
+       if(!v->finger_stream)
+               return;
+
+       /* Detect & Process the gesture */
+       v->finger_stream->move((Evas_Event_Mouse_Move *)event_info);
+}
+
+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)
+               return;
+
+       /*  Extract view ptr */
+       map_view_s *v = (map_view_s *)data;
+       if(!v->finger_stream)
+               return;
+
+       /* Detect & Process the gesture */
+       v->finger_stream->multi_tap((Evas_Event_Multi_Down *)event_info);
+}
+
+
+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)
+               return;
+
+       /*  Extract view ptr */
+       map_view_s *v = (map_view_s *)data;
+       if(!v->finger_stream)
+               return;
+
+       /* Detect & Process the gesture */
+       v->finger_stream->multi_up((Evas_Event_Multi_Up *)event_info);
+}
+
+static void __maps_plugin_render_map_cb(maps_error_e result, int request_id,
+                                maps_coordinates_h center,
+                                maps_area_h area,
+                                void *user_data)
+{
+       if ((result != MAPS_ERROR_NONE) || !center || !area || !user_data)
+               return;
+
+       /* Here we know that the Plugin has the rendered maps.
+       *  We should mark the view as "invalid"  and request the view update.
+       *  In the view update or idle handle we should do the following.
+       *  There are three types of idlers: Enterers, Idlers(proper) and Exiters
+       */
+
+       map_view_h view = (map_view_h)user_data;
+       if (!view)
+               return;
+
+       /* Get the view pointer */
+       map_view_s *v = (map_view_s *) view;
+
+       /* Signal to the animator, that we are ready to draw */
+       v->ready_to_draw = true;
+
+       maps_coordinates_destroy(center);
+       maps_area_destroy(area);
+
+}
+
+static int __maps_plugin_render_map(map_view_h view,
+                                   const maps_coordinates_h coordinates,
+                                   const double zoom_factor,
+                                   const double rotation_angle)
+{
+       if (!view || !coordinates)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       int request_id = 0;
+       return __get_plugin_interface(view)->maps_plugin_render_map(
+                                            coordinates,
+                                            zoom_factor,
+                                            rotation_angle,
+                                            __maps_plugin_render_map_cb,
+                                            view,
+                                            &request_id);
+
+}
+
+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)
+               return;
+
+       /*  Extract view ptr */
+       map_view_s *v = (map_view_s *)data;
+       if(!v->finger_stream)
+               return;
+
+       /* Detect & Process the gesture */
+       v->finger_stream->multi_move((Evas_Event_Multi_Move *)event_info);
+}
+
+/*gesture_detector *__map_view_gesture_detector_factory()
+{
+}*/
+
+void _map_view_set_idle_listener(map_view_h view,
+                                void (*callback)(void *user_data),
+                                void *user_data)
+{
+
+       if(!view)
+               return;
+       map_view_s *v = (map_view_s *)view;
+       v->idle_listener.callback = callback;
+       v->idle_listener.user_data = user_data;
+}
+
+void _map_view_halt_inertial_camera(map_view_h view)
+{
+       map_view_s *v = (map_view_s *)view;
+       if(v && v->inertial_camera && v->inertial_camera->is_transiting()) {
+               v->inertial_camera->set_transiting(false);
+               g_usleep(0);
+       }
+}
+
+static Eina_Bool __map_view_on_idle_cb(void *data)
+{
+       if (!data)
+               return ECORE_CALLBACK_RENEW;
+
+       map_view_s *v = (map_view_s *)data;
+       if(!v)
+               return ECORE_CALLBACK_RENEW; // same as EINA_TRUE
+
+       view::inertial_camera *ic = v->inertial_camera;
+       if(!ic)
+               return ECORE_CALLBACK_RENEW; // same as EINA_TRUE
+
+       if(v->idle_listener.callback)
+               v->idle_listener.callback(v->idle_listener.user_data);
+
+       if(ic->is_transiting()) {
+               ic->next_transition_step();
+               __maps_plugin_render_map(v,
+                                        ic->get_cur_center(),
+                                        ic->get_cur_zoom_factor(),
+                                        ic->get_cur_rotation_angle());
+               g_usleep(10*1000);
+       }
+
+#if 0
+       /* Extract and run the on-going command */
+       q()->process(__extract_plugin(v->maps));
+#endif
+
+       return ECORE_CALLBACK_RENEW; // same as EINA_TRUE
+}
+
+static Eina_Bool __map_view_animator_cb(void *data)
+{
+       map_view_s *v = (map_view_s *) data;
+       if (!v)
+               return ECORE_CALLBACK_CANCEL;
+
+       if (!v->ready_to_draw)
+               return ECORE_CALLBACK_RENEW;
+
+       v->ready_to_draw = false;
+
+       /* draw routin: use the plugin function */
+       int width = 0;
+       int height = 0;
+       map_view_get_geometry(v, NULL, NULL, &width, &height);
+
+       /* The Plugin should draw a map. */
+       __get_plugin_interface(v)->
+               maps_plugin_draw_map(v->canvas, 0, 0, width, height);
+
+       q()->push(new session::command_view_ready(v->maps, v));
+
+       return ECORE_CALLBACK_RENEW;
+}
+
+int __map_view_ready(map_view_h view)
+{
+       map_view_s *v = (map_view_s *) view;
+       if (!v)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Invoke user registered event callback */
+       _map_view_invoke_event_callback(v,
+                       _map_view_create_event_data(MAP_EVENT_READY));
+
+       return MAPS_ERROR_NONE;
+}
+
+
+
+
+/* ----------------------CREATE AND DESTROY-----------------------------------*/
+
+static void __map_view_panel_resize_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+       map_view_s *v = (map_view_s*)data;
+
+       int w, h;
+       evas_object_geometry_get(v->panel, NULL, NULL, &w, &h);
+       map_view_resize(v, w, h);
+}
+
+/* Create the panel and link it to the instance of Maps Service */
+EXPORT_API int map_view_create(const maps_service_h maps,
+                               Evas_Image *obj,
+                               map_view_h *view)
+{
+       MAPS_LOG_API;
+       if (!maps || !obj || !view)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       map_view_s *v = g_slice_new0(map_view_s);
+       if (!v) {
+               MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
+               return MAPS_ERROR_OUT_OF_MEMORY;
+       }
+
+       /* Initialize the list with visual objects */
+       maps_item_list_create(&v->view_objects);
+
+       v->panel = obj;
+
+       evas_object_event_callback_add(v->panel, EVAS_CALLBACK_RESIZE, __map_view_panel_resize_cb, v);
+
+       /* Set up event callbacks by default */
+       const int event_callback_cnt =
+               sizeof(v->event_callbacks) / sizeof(v->event_callbacks[0]);
+       for(int i = 0; i < event_callback_cnt; i ++) {
+               v->event_callbacks[i].callback = __map_view_on_event_empty_cb;
+               v->event_callbacks[i].user_data = NULL;
+       }
+
+#ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+       /*
+       Gestures                        | Available actions
+       --------------------------------+------------------------------------------------------
+       MAP_GESTURE_SCROLL              | MAP_ACTION_NONE
+                                        |
+       MAP_GESTURE_ZOOM,               | MAP_ACTION_ZOOM
+                                        |
+       MAP_GESTURE_TAP,                | MAP_ACTION_SCROLL, MAP_ACTION_ZOOM_IN, MAP_ACTION_ZOOM_OUT,
+                                        |
+       MAP_GESTURE_DOUBLE_TAP,         | MAP_ACTION_SCROLL, MAP_ACTION_ZOOM_IN, MAP_ACTION_ZOOM_OUT,
+                                       | MAP_ACTION_ZOOM_AND_SCROLL
+                                        |
+       MAP_GESTURE_2_FINGER_TAP,       | MAP_ACTION_SCROLL, MAP_ACTION_ZOOM_IN, MAP_ACTION_ZOOM_OUT,
+                                       | MAP_ACTION_ZOOM_AND_SCROLL
+                                        |
+       MAP_GESTURE_SINGLE_FINGER_ZOOM, | MAP_ACTION_ZOOM, MAP_ACTION_ZOOM_AND_SCROLL
+                                        |
+       MAP_GESTURE_LONG_PRESS,         | MAP_ACTION_SCROLL, MAP_ACTION_ZOOM_IN, MAP_ACTION_ZOOM_OUT
+       */
+
+       /* Assign gestures to actions */
+       v->gesture_actions[MAP_GESTURE_SCROLL] = MAP_ACTION_NONE;
+       v->gesture_actions[MAP_GESTURE_ZOOM] = MAP_ACTION_ZOOM;
+       v->gesture_actions[MAP_GESTURE_FLICK] = MAP_ACTION_SCROLL;
+       v->gesture_actions[MAP_GESTURE_TAP] = MAP_ACTION_SCROLL;
+       v->gesture_actions[MAP_GESTURE_DOUBLE_TAP] = MAP_ACTION_ZOOM_AND_SCROLL;
+       v->gesture_actions[MAP_GESTURE_2_FINGER_TAP] = MAP_ACTION_ZOOM_OUT;
+       v->gesture_actions[MAP_GESTURE_SINGLE_FINGER_ZOOM] = MAP_ACTION_ZOOM;
+       v->gesture_actions[MAP_GESTURE_LONG_PRESS] = MAP_ACTION_SCROLL;
+       v->gesture_actions[MAP_GESTURE_NONE] = MAP_ACTION_NONE;
+
+       /* Set up gesture availability */
+       v->gesture_available[MAP_GESTURE_SCROLL] = true;
+       v->gesture_available[MAP_GESTURE_ZOOM] = true;
+       v->gesture_available[MAP_GESTURE_FLICK] = true;
+       v->gesture_available[MAP_GESTURE_TAP] = true;
+       v->gesture_available[MAP_GESTURE_DOUBLE_TAP] = true;
+       v->gesture_available[MAP_GESTURE_2_FINGER_TAP] = true;
+       v->gesture_available[MAP_GESTURE_SINGLE_FINGER_ZOOM] = true;
+       v->gesture_available[MAP_GESTURE_LONG_PRESS] = true;
+       v->gesture_available[MAP_GESTURE_NONE] = false;
+#else
+       /* Assign gestures to actions */
+       v->gesture_actions[MAP_GESTURE_SCROLL] = MAP_ACTION_SCROLL;
+       v->gesture_actions[MAP_GESTURE_FLICK] = MAP_ACTION_SCROLL;
+       v->gesture_actions[MAP_GESTURE_PINCH] = MAP_ACTION_SCROLL;
+       v->gesture_actions[MAP_GESTURE_TAP] = MAP_ACTION_NONE;
+       v->gesture_actions[MAP_GESTURE_DOUBLE_TAP] = MAP_ACTION_ZOOM;
+       v->gesture_actions[MAP_GESTURE_2_FINGER_TAP] = MAP_ACTION_ZOOM;
+       v->gesture_actions[MAP_GESTURE_ZOOM] = MAP_ACTION_ZOOM;
+       v->gesture_actions[MAP_GESTURE_SINGLE_FINGER_ZOOM] = MAP_ACTION_ZOOM;
+       v->gesture_actions[MAP_GESTURE_ROTATE] = MAP_ACTION_ROTATE;
+       v->gesture_actions[MAP_GESTURE_LONG_PRESS] = MAP_ACTION_NONE;
+       v->gesture_actions[MAP_GESTURE_NONE] = MAP_ACTION_NONE;
+
+       /* Set up gesture availability */
+       v->gesture_available[MAP_GESTURE_SCROLL] = true;
+       v->gesture_available[MAP_GESTURE_FLICK] = true;
+       v->gesture_available[MAP_GESTURE_PINCH] = true;
+       v->gesture_available[MAP_GESTURE_TAP] = true;
+       v->gesture_available[MAP_GESTURE_DOUBLE_TAP] = true;
+       v->gesture_available[MAP_GESTURE_2_FINGER_TAP] = true;
+       v->gesture_available[MAP_GESTURE_ZOOM] = true; /* pinch zoom */
+       v->gesture_available[MAP_GESTURE_SINGLE_FINGER_ZOOM] = true;
+       v->gesture_available[MAP_GESTURE_ROTATE] = true;
+       v->gesture_available[MAP_GESTURE_LONG_PRESS] = true;
+       v->gesture_available[MAP_GESTURE_NONE] = false;
+#endif
+
+       /* Gesture Processing */
+       v->finger_stream = new view::finger_event_stream(v);
+       if (!v->finger_stream) {
+               MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
+               return MAPS_ERROR_OUT_OF_MEMORY;
+       }
+       evas_object_event_callback_add(v->panel,
+                                      EVAS_CALLBACK_MOUSE_DOWN,
+                                      __on_canvas_tap,
+                                      v);
+       evas_object_event_callback_add(v->panel,
+                                      EVAS_CALLBACK_MOUSE_UP,
+                                      __on_canvas_up,
+                                      v);
+       evas_object_event_callback_add(v->panel,
+                                      EVAS_CALLBACK_MOUSE_MOVE,
+                                      __on_canvas_line,
+                                      v);
+
+       evas_object_event_callback_add(v->panel,
+                                      EVAS_CALLBACK_MULTI_DOWN,
+                                      __on_canvas_multi_tap,
+                                      v);
+       evas_object_event_callback_add(v->panel,
+                                      EVAS_CALLBACK_MULTI_UP,
+                                      __on_canvas_multi_up,
+                                      v);
+       evas_object_event_callback_add(v->panel,
+                                      EVAS_CALLBACK_MULTI_MOVE,
+                                      __on_canvas_multi_line,
+                                      v);
+
+       /* Set up canvas and Ecore */
+       v->canvas = evas_object_evas_get(v->panel);
+       /*v->ee = ecore_evas_ecore_evas_get(v->canvas);*/
+
+       /* Link with Maps Service */
+       v->maps = maps;
+
+       /* Add an idle handler */
+       v->idler = ecore_idler_add(__map_view_on_idle_cb, v);
+
+       /* Set up the animation frame rate */
+       /*ecore_animator_frametime_set(0.1);*/
+
+       /* Create the animator and assign the drawing task */
+       v->animator = ecore_animator_add(__map_view_animator_cb, v);
+
+       /* Set up the output pointer to the Maps View */
+       *view = (map_view_h) v;
+
+       /* Notify the Plugin, that the view is created */
+       __get_plugin_interface(*view)->maps_plugin_set_map_view(*view);
+
+       /* Set up zoom and rotation */
+       __get_plugin_interface(v)->maps_plugin_get_min_zoom_level(
+                                                         &v->min_zoom_level);
+       __get_plugin_interface(v)->maps_plugin_get_max_zoom_level(
+                                                                 &v->max_zoom_level);
+
+       if(v->min_zoom_level <= 0)
+               v->min_zoom_level = 2;
+       if(v->max_zoom_level <= 0)
+               v->max_zoom_level = 2;
+
+       v->zoom_level = v->min_zoom_level;
+       v->zoom_factor = double(v->zoom_level);
+       v->rotation_angle = 0.;
+
+       maps_coordinates_create(.0, .0, &v->center);
+
+       map_view_set_inertia_enabled(v, true);
+
+       return MAPS_ERROR_NONE;
+}
+
+/* Destroy the panel and unlink it from the instance of Maps Service */
+EXPORT_API int map_view_destroy(map_view_h view)
+{
+       MAPS_LOG_API;
+       if (!view)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       map_view_s *v = (map_view_s *) view;
+
+       /* Unregister gesture processing */
+       if(v->finger_stream)
+               delete v->finger_stream;
+       v->finger_stream = NULL;
+
+       evas_object_event_callback_del(v->panel,
+                                      EVAS_CALLBACK_MOUSE_DOWN,
+                                      __on_canvas_tap);
+       evas_object_event_callback_del(v->panel,
+                                      EVAS_CALLBACK_MOUSE_UP,
+                                      __on_canvas_up);
+       evas_object_event_callback_del(v->panel,
+                                      EVAS_CALLBACK_MOUSE_MOVE,
+                                      __on_canvas_line);
+
+       evas_object_event_callback_del(v->panel,
+                                      EVAS_CALLBACK_MULTI_DOWN,
+                                      __on_canvas_multi_tap);
+       evas_object_event_callback_del(v->panel,
+                                      EVAS_CALLBACK_MULTI_UP,
+                                      __on_canvas_multi_up);
+       evas_object_event_callback_del(v->panel,
+                                      EVAS_CALLBACK_MULTI_MOVE,
+                                      __on_canvas_multi_line);
+
+
+
+       /* Unregister idle handler */
+       if (v->idler)
+               ecore_idler_del(v->idler);
+
+       view::inertial_camera *inertial_camera = v->inertial_camera;
+       v->inertial_camera = NULL;
+       v->idle_listener.callback = NULL;
+
+       /* Delete the animator */
+       if (v->animator)
+               ecore_animator_del(v->animator);
+
+       /* Notify the Plugin, that the view is to be destroyed */
+       __get_plugin_interface(view)->maps_plugin_set_map_view(NULL);
+
+       /* Destroy a visual panel */
+       if (v->panel)
+               evas_object_del(v->panel);
+
+       if (v->center)
+               maps_coordinates_destroy(v->center);
+
+       if (v->area)
+               maps_area_destroy(v->area);
+
+       /* Destroy the list with visual objects */
+       maps_item_list_remove_all(v->view_objects, map_object_destroy);
+       maps_item_list_destroy(v->view_objects);
+
+       if (v->language)
+               g_free(v->language);
+
+       g_slice_free(map_view_s, v);
+
+       if(inertial_camera)
+               delete inertial_camera;
+
+
+       return MAPS_ERROR_NONE;
+}
+
+
+int _map_view_set_center_directly(const map_view_h view,
+                                 const maps_coordinates_h coordinates)
+{
+       if (!view || !coordinates)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       map_view_s *v = (map_view_s *) view;
+       if(v->center != coordinates) {
+               if (v->center)
+                       maps_coordinates_destroy(v->center);
+               maps_coordinates_clone(coordinates, &v->center);
+       }
+       return MAPS_ERROR_NONE;
+}
+
+int _map_view_get_plugin_center(const map_view_h view,
+                               maps_coordinates_h *center)
+{
+       if (!view || !center)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       return __get_plugin_interface(view)->maps_plugin_get_center(center);
+}
+
+/*----------------------MAP ZOOM, ROTATE, SET CENTER--------------------------*/
+
+/* Show the map with a given position centered using current zoom level and
+ * rotation angle */
+EXPORT_API int map_view_set_center(const map_view_h view,
+                                  const maps_coordinates_h coordinates)
+{
+       MAPS_LOG_API;
+       if (!view || !coordinates)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       double zoom_factor = 1.;
+       int error = map_view_get_zoom_factor(view, &zoom_factor);
+       if (error != MAPS_ERROR_NONE)
+               return error;
+
+       double rotation_angle = 0.;
+       error = map_view_get_orientation(view, &rotation_angle);
+       if (error != MAPS_ERROR_NONE)
+               return error;
+
+       #ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+       map_view_s *v = (map_view_s *) view;
+
+       /* Set up the target for camera inertial movement */
+       if(v->inertial_camera)
+               v->inertial_camera->set_targets(coordinates,
+                                               zoom_factor,
+                                               rotation_angle);
+       else
+               /* Rund rendering in the plugin */
+               error = __maps_plugin_render_map(view,
+                                                coordinates,
+                                                zoom_factor,
+                                                rotation_angle);
+
+       if(v->center != coordinates) {
+               maps_coordinates_destroy(v->center);
+               maps_coordinates_clone(coordinates, &v->center);
+       }
+       #else
+       map_view_s *v = (map_view_s *) view;
+       if(v->center != coordinates) {
+               if (v->center)
+                       maps_coordinates_destroy(v->center);
+               maps_coordinates_clone(coordinates, &v->center);
+       }
+
+       /* Set up the target for camera inertial movement */
+       if(v->inertial_camera)
+               v->inertial_camera->set_targets(v->center,
+                                               zoom_factor,
+                                               rotation_angle);
+       else
+               /* Rund rendering in the plugin */
+               error = __maps_plugin_render_map(view,
+                                                v->center,
+                                                zoom_factor,
+                                                rotation_angle);
+       #endif
+
+       /* Invoke user registered event callback */
+       map_event_data_h ed =
+               _map_view_create_event_data(MAP_EVENT_ACTION);
+       if(ed) {
+               _map_event_data_set_action_type(ed, MAP_ACTION_SCROLL);
+               _map_event_data_set_center(ed, v->center);
+               _map_view_invoke_event_callback(v, ed);
+       }
+
+       return error;
+}
+
+int _map_view_move_center(map_view_h view, const int delta_x, const int delta_y)
+{
+       if (!view)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+
+       /* TODO: Implement it with command and command queue,
+       *  similarly as it is done in maps service */
+
+       int request_id = 0;
+       int error = __get_plugin_interface(view)->maps_plugin_move_center(
+                                               delta_x, delta_y,
+                                               __maps_plugin_render_map_cb,
+                                               view,
+                                               &request_id);
+
+       /* Invoke user registered event callback */
+       map_event_data_h ed =
+               _map_view_create_event_data(MAP_EVENT_ACTION);
+       if(ed) {
+               #ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+               _map_event_data_set_action_type(ed, MAP_ACTION_SCROLL);
+               #else
+               _map_event_data_set_action_type(ed, MAP_ACTION_MOVE_CENTER);
+               #endif
+               _map_event_data_set_delta(ed, delta_x, delta_y);
+               _map_view_invoke_event_callback(view, ed);
+       }
+
+       return error;
+}
+
+EXPORT_API int map_view_get_center(const map_view_h view,
+                                  maps_coordinates_h *coordinates)
+{
+       MAPS_LOG_API;
+       if (!view || !coordinates)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_view_s *v = (map_view_s *) view;
+       return maps_coordinates_clone(v->center, coordinates);
+}
+
+EXPORT_API int map_view_set_zoom_level(map_view_h view, const int level)
+{
+#if 1
+       MAPS_LOG_API;
+       if (!view)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       map_view_s *v = (map_view_s *) view;
+       int new_level = level;
+       if (new_level < v->min_zoom_level) new_level = v->min_zoom_level;
+       if (new_level > v->max_zoom_level) new_level = v->max_zoom_level;
+       
+       /* Add inertia to the zoom process */
+       if(v->inertial_camera)
+               v->inertial_camera->set_zoom_target(double(new_level));
+
+       v->zoom_level = new_level;
+       v->zoom_factor = double(new_level); /* Update the integer  zoom level too */
+#else
+       MAPS_LOG_API;
+       if (!view || (level <= 1))
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       map_view_s *v = (map_view_s *) view;
+
+
+       /* TODO: consider more convenient for App Devs approach:
+        *    level = min(level, max_zoom);
+        *    level = max(level, min_zoom);
+        *    error = NONE
+        */
+
+       /* Check if new zoom factor matches existing zoom range */
+       if((level < v->min_zoom_level) || (level > v->max_zoom_level))
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Add inertia to the zoom process */
+       if(v->inertial_camera)
+               v->inertial_camera->set_zoom_target(double(level));
+
+       v->zoom_level = level;
+       v->zoom_factor = double(level); /* Update the integer  zoom level too */
+#endif
+
+       const int error = map_view_set_center(view, v->center);
+
+       /* Invoke user registered event callback */
+       map_event_data_h ed =
+               _map_view_create_event_data(MAP_EVENT_ACTION);
+       if(ed) {
+               _map_event_data_set_action_type(ed, MAP_ACTION_ZOOM);
+               _map_event_data_set_zoom_factor(ed, v->zoom_factor);
+               _map_view_invoke_event_callback(v, ed);
+       }
+
+       return error;
+}
+
+EXPORT_API int map_view_get_zoom_level(const map_view_h view, int *level)
+{
+       MAPS_LOG_API;
+       if (!view || !level)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_view_s *v = (map_view_s *) view;
+       *level = v->zoom_level;
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int map_view_get_min_zoom_level(const map_view_h view,
+                                          int *min_zoom_level)
+{
+       MAPS_LOG_API;
+       if (!view || !min_zoom_level)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_view_s *v = (map_view_s *) view;
+       *min_zoom_level = v->min_zoom_level;
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int map_view_get_max_zoom_level(const map_view_h view,
+                                          int *max_zoom_level)
+{
+       MAPS_LOG_API;
+       if (!view || !max_zoom_level)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_view_s *v = (map_view_s *) view;
+       *max_zoom_level = v->max_zoom_level;
+       return MAPS_ERROR_NONE;
+}
+
+int _map_view_set_zoom_rotate(map_view_h view,
+                             const bool zoom_changed,
+                             const double factor,
+                             const bool rotation_changed,
+                             const double angle)
+{
+       MAPS_LOG_API;
+       if (!view)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       map_view_s *v = (map_view_s *) view;
+
+       /* 1. Apply new zoom and orientation values */
+       if (zoom_changed) {
+               /* TODO: consider more convenient for App Devs approach:
+               *    factor = min(factor, max_zoom);
+               *    factor = max(factor, min_zoom);
+               *    error = NONE
+                */
+
+               #if 1
+               double new_factor = factor;
+               if (new_factor < v->min_zoom_level) new_factor = v->min_zoom_level;
+               if (new_factor > v->max_zoom_level) new_factor = v->max_zoom_level;
+
+               /* Add inertia to the zoom process */
+               if(v->inertial_camera) {
+                       v->inertial_camera->set_zoom_target(new_factor);
+                       if(rotation_changed)
+                               v->inertial_camera->set_rotation_target(angle);
+               }
+
+               /* Update Map View zoom factor */
+               v->zoom_factor = new_factor;
+
+               /* Update the integer  zoom level too */
+               v->zoom_level = int(new_factor);
+               #else
+               /* Check if new zoom factor matches existing zoom range */
+               if((factor < v->min_zoom_level) || (factor > v->max_zoom_level))
+                       return MAPS_ERROR_INVALID_PARAMETER;
+
+               /* Add inertia to the zoom process */
+               if(v->inertial_camera) {
+                       v->inertial_camera->set_zoom_target(factor);
+                       if(rotation_changed)
+                               v->inertial_camera->set_rotation_target(angle);
+               }
+
+               /* Update Map View zoom factor */
+               v->zoom_factor = factor;
+
+               /* Update the integer  zoom level too */
+               v->zoom_level = int(factor);
+               #endif
+       }
+
+       if (rotation_changed) {
+               v->rotation_angle = angle;
+       }
+
+       /* 2. Send update center command to the plugin */
+       const int error = map_view_set_center(view, v->center);
+
+       /* Notify the user about changes */
+       if (zoom_changed) {
+               /* Invoke user registered event callback */
+               map_event_data_h ed =
+                       _map_view_create_event_data(MAP_EVENT_ACTION);
+               if(ed) {
+                       _map_event_data_set_action_type(ed, MAP_ACTION_ZOOM);
+                       _map_event_data_set_zoom_factor(ed, v->zoom_factor);
+                       _map_view_invoke_event_callback(v, ed);
+               }
+       }
+
+       if (rotation_changed) {
+               /* Invoke user registered event callback */
+               map_event_data_h ed =
+                       _map_view_create_event_data(MAP_EVENT_ACTION);
+               if(ed) {
+                       _map_event_data_set_action_type(ed, MAP_ACTION_ROTATE);
+                       _map_event_data_set_rotation_angle(ed,
+                                                          v->rotation_angle);
+                       _map_view_invoke_event_callback(v, ed);
+               }
+       }
+
+       return error;
+}
+
+EXPORT_API int map_view_set_zoom_factor(const map_view_h view,
+                                       const double factor)
+{
+       MAPS_LOG_API;
+       if (!view)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+#if 1
+       map_view_s *v = (map_view_s *) view;
+       double new_factor = factor;
+       if (new_factor < v->min_zoom_level) new_factor = v->min_zoom_level;
+       if (new_factor > v->max_zoom_level) new_factor = v->max_zoom_level;
+
+       return _map_view_set_zoom_rotate(view, true, new_factor, false, .0);
+#else
+       return _map_view_set_zoom_rotate(view, true, factor, false, .0);
+#endif
+}
+
+EXPORT_API int map_view_get_zoom_factor(const map_view_h view, double *factor)
+{
+       MAPS_LOG_API;
+       if (!view || !factor)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_view_s *v = (map_view_s *) view;
+       *factor = v->zoom_factor;
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int map_view_set_orientation(const map_view_h view,
+                                       const double angle)
+{
+       MAPS_LOG_API;
+       if (!view)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Add inertia to the rotation process */
+       map_view_s *v = (map_view_s *)view;
+       if(v->inertial_camera)
+               v->inertial_camera->set_rotation_target(angle);
+
+       return _map_view_set_zoom_rotate(view, false, .0, true, angle);
+}
+
+EXPORT_API int map_view_get_orientation(const map_view_h view,
+                                       double *angle)
+{
+       MAPS_LOG_API;
+       if (!view || !angle)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_view_s *v = (map_view_s *) view;
+       *angle = v->rotation_angle;
+       return MAPS_ERROR_NONE;
+}
+
+
+/*----------------------SCREEN <--> GEOGRAPHY---------------------------------*/
+
+
+/* Converting screen coordinates to geographical */
+EXPORT_API int map_view_screen_to_geography(const map_view_h view,
+                                 const int x, const int y,
+                                 maps_coordinates_h *coordinates)
+{
+       MAPS_LOG_API;
+       if (!view || !coordinates)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       int posx = 0;
+       int posy = 0;
+       map_view_get_geometry(view, &posx, &posy, NULL, NULL);
+       return __get_plugin_interface(view)->
+               maps_plugin_screen_to_geography(x - posx, y - posy,
+                                               coordinates);
+}
+
+EXPORT_API int map_view_geography_to_screen(const map_view_h view,
+                                 const maps_coordinates_h coordinates,
+                                 int *x, int *y)
+{
+       MAPS_LOG_API;
+       if (!view || !coordinates || !x || !y)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       int posx = 0;
+       int posy = 0;
+       map_view_get_geometry(view, &posx, &posy, NULL, NULL);
+       const int error = __get_plugin_interface(view)->
+                       maps_plugin_geography_to_screen(coordinates, x, y);
+       *x += posx;
+       *y += posy;
+       return error;
+}
+
+
+/* --------------------MAPS VIEW PREFERENCES----------------------------------*/
+
+
+EXPORT_API int map_view_set_type(map_view_h view, const map_view_type_e type)
+{
+       MAPS_LOG_API;
+       if (!view)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       if ((type < MAP_VIEW_TYPE_DAY) || (type > MAP_VIEW_TYPE_TERRAIN))
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_view_s *v = (map_view_s *) view;
+       v->type = type;
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int map_view_get_type(const map_view_h view, map_view_type_e *type)
+{
+       MAPS_LOG_API;
+       if (!view || !type)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_view_s *v = (map_view_s *) view;
+       *type = v->type;
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int map_view_set_inertia_enabled(map_view_h view, bool enabled)
+{
+       MAPS_LOG_API;
+       if (!view)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_view_s *v = (map_view_s *) view;
+
+       if(enabled) {
+               if(v->inertial_camera)
+                       return MAPS_ERROR_NONE;
+
+               /* Set Inertial Gesture */
+               v->finger_stream->set_gesture_detector(
+                                       new view::inertial_gesture(view));
+
+               /* Set 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);
+                       return MAPS_ERROR_OUT_OF_MEMORY;
+               }
+       } else {
+               if(!v->inertial_camera)
+                       return MAPS_ERROR_NONE;
+
+               /* Set Non-Inertial Gesture */
+               v->finger_stream->set_gesture_detector(
+                       new view::gesture_detector_statemachine(view));
+
+               /* Unset Inertial Camera */
+               if(v->inertial_camera->is_transiting()) {
+                       v->inertial_camera->set_transiting(false);
+                       sleep(0);
+               }
+               view::inertial_camera *inertial_camera = v->inertial_camera;
+               v->inertial_camera = NULL;
+               delete inertial_camera;
+       }
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int map_view_get_inertia_enabled(map_view_h view, bool *enabled)
+{
+       MAPS_LOG_API;
+       if (!view || !enabled)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       map_view_s *v = (map_view_s *) view;
+       *enabled = v->inertial_camera != NULL;
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int map_view_set_language(map_view_h view, const char *language)
+{
+       MAPS_LOG_API;
+       if (!view || !language)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Check if language is supported */
+       static const char *lngs[] = {
+               "ara",
+               "chi",
+               "cht",
+               "dut",
+               "eng",
+               "ger",
+               "gle",
+               "fre",
+               "ita",
+               "spa",
+               "rus",
+               "pol",
+               "gre",
+               "wel"
+       };
+       bool supported = false;
+       for(unsigned int i = 0; i < (sizeof(lngs) / sizeof(lngs[0])); i ++) {
+               if(g_strcmp0(language, lngs[i]) == 0) {
+                       supported = true;
+                       break;
+               }
+       }
+       if(!supported)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       return maps_set_string(language,
+                              _MAPS_VIEW_LANGUAGE_MAX_LENGTH,
+                              &((map_view_s *) view)->language);
+}
+
+EXPORT_API int map_view_get_language(const map_view_h view, char **language)
+{
+       MAPS_LOG_API;
+       if (!view || !language)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       return maps_get_string(((map_view_s *) view)->language,
+               _MAPS_VIEW_LANGUAGE_MAX_LENGTH, language);
+}
+
+
+/* --------------------MAPS PANEL MANIPULATIONS-------------------------------*/
+
+
+EXPORT_API int map_view_get_port(const map_view_h view, Evas_Object **viewport)
+{
+       MAPS_LOG_API;
+       if (!view || !viewport)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_view_s *v = (map_view_s *) view;
+       *viewport = v->panel;
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int map_view_get_geometry(const map_view_h view,
+                          int *x, int *y,
+                          int *width, int *height)
+{
+       MAPS_LOG_API;
+       if (!view)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_view_s *v = (map_view_s *) view;
+       evas_object_geometry_get(v->panel, x, y, width, height);
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int map_view_resize(const map_view_h view,
+                               const int width, const int height)
+{
+       MAPS_LOG_API;
+       if (!view || (width <= 0) || (height <= 0))
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_view_s *v = (map_view_s *) view;
+       evas_object_resize(v->panel, width, height);
+       return map_view_set_center(view, v->center);
+}
+
+EXPORT_API int map_view_set_visible(const map_view_h view, const bool visible)
+{
+       MAPS_LOG_API;
+       if (!view)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_view_s *v = (map_view_s *) view;
+       if (visible)
+               evas_object_show(v->panel);
+       else
+               evas_object_hide(v->panel);
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int map_view_get_visible(const map_view_h view, bool *visible)
+{
+       MAPS_LOG_API;
+       if (!view || !visible)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_view_s *v = (map_view_s *) view;
+       *visible = evas_object_visible_get(v->panel) == EINA_TRUE;
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int map_view_redraw(const map_view_h view)
+{
+       MAPS_LOG_API;
+       if (!view)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_view_s *v = (map_view_s *) view;
+
+#if 0
+       /* render and get the updated rectangles: */
+       Eina_List *updates = evas_render_updates(v->canvas);
+       evas_render_updates_free(updates);
+#endif
+       /* Signal to the animator, that we are ready to draw */
+       v->ready_to_draw = true;
+
+       return MAPS_ERROR_NONE;
+}
+
+
+/* ---------------------USER CONTROL------------------------------------------*/
+
+
+EXPORT_API int map_view_set_event_callback(map_view_h view,
+                                          const map_event_type_e type,
+                                          map_view_on_event_cb callback,
+                                          void *user_data)
+{
+       MAPS_LOG_API;
+       if (!view || !callback)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       if((type < MAP_EVENT_GESTURE) || (type > MAP_EVENT_READY))
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       map_view_s *v = (map_view_s *) view;
+       v->event_callbacks[type].callback = callback;
+       v->event_callbacks[type].user_data = user_data;
+
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int map_view_unset_event_callback(map_view_h view,
+                                            const map_event_type_e type)
+{
+       MAPS_LOG_API;
+       if (!view)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       if((type < MAP_EVENT_GESTURE) || (type > MAP_EVENT_READY))
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       map_view_s *v = (map_view_s *) view;
+       v->event_callbacks[type].callback = __map_view_on_event_empty_cb;
+       v->event_callbacks[type].user_data = NULL;
+
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int map_view_set_gesture_action(map_view_h view,
+                                          const map_gesture_e gesture,
+                                          const map_action_e action)
+{
+       MAPS_LOG_API;
+       if (!view)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       if((gesture < MAP_GESTURE_SCROLL) || (gesture > MAP_GESTURE_NONE))
+               return MAPS_ERROR_INVALID_PARAMETER;
+       if((action < MAP_ACTION_SCROLL) || (action > MAP_ACTION_NONE))
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_view_s *v = (map_view_s *) view;
+       v->gesture_actions[gesture] = action;
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int map_view_get_gesture_action(map_view_h view,
+                                           const map_gesture_e gesture,
+                                           map_action_e *action)
+{
+       MAPS_LOG_API;
+       if (!view || !action)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       if((gesture < MAP_GESTURE_SCROLL) || (gesture > MAP_GESTURE_NONE))
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_view_s *v = (map_view_s *) view;
+       *action = v->gesture_actions[gesture];
+       return MAPS_ERROR_NONE;
+}
+
+
+EXPORT_API int map_view_set_gesture_enabled(map_view_h view,
+                                           const map_gesture_e gesture,
+                                           const bool enabled)
+{
+       MAPS_LOG_API;
+       if (!view)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       if((gesture < MAP_GESTURE_SCROLL) || (gesture > MAP_GESTURE_NONE))
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_view_s *v = (map_view_s *) view;
+       v->gesture_available[gesture] = enabled;
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int map_view_get_gesture_enabled(map_view_h view,
+                                           const map_gesture_e gesture,
+                                           bool *enabled)
+{
+       MAPS_LOG_API;
+       if (!view || !enabled)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       if((gesture < MAP_GESTURE_SCROLL) || (gesture > MAP_GESTURE_NONE))
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_view_s *v = (map_view_s *) view;
+       *enabled = v->gesture_available[gesture];
+       return MAPS_ERROR_NONE;
+}
+
+
+/* ---------------------VISUAL OBJECTS ON THE MAP-----------------------------*/
+
+EXPORT_API int map_view_add_object(map_view_h view, map_object_h object)
+{
+       MAPS_LOG_API;
+       if (!view || !object)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       int error = MAPS_ERROR_NONE;
+       do {
+               /* Add Visual Object to the list of View Visual Objects */
+               map_view_s *v = (map_view_s *)view;
+               error = maps_item_list_append(v->view_objects,
+                                             object,
+                                             maps_item_no_clone);
+               if(error != MAPS_ERROR_NONE)
+                       break;
+
+               /* Link the object with the View */
+               error = _map_object_set_view(object, view);
+               if(error != MAPS_ERROR_NONE)
+                       break;
+
+               /* Notify the plugin about added object */
+               error = _map_view_on_object_operation(view,
+                                                     object,
+                                                     MAP_OBJECT_ADD);
+               if(error != MAPS_ERROR_NONE)
+                       break;
+
+               /* Redraw the view */
+               error = map_view_redraw(v);
+               if(error != MAPS_ERROR_NONE)
+                       break;
+
+               return MAPS_ERROR_NONE;
+       } while(false);
+
+       return error;
+}
+
+EXPORT_API int map_view_remove_object(map_view_h view,
+                                     const map_object_h object)
+{
+       MAPS_LOG_API;
+       if (!view || !object)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       int error = MAPS_ERROR_NONE;
+       do {
+               /* Remove Visual Object from the list of View Visual Objects */
+               map_view_s *v = (map_view_s *)view;
+               error =  maps_item_list_remove(v->view_objects,
+                                                  object,
+                                                  map_object_destroy);
+               if(error != MAPS_ERROR_NONE)
+                       return error;
+
+#if 0
+               /* Notify the plugin about added object */
+               error = _map_view_on_object_operation(view,
+                                                     object,
+                                                     MAP_OBJECT_REMOVE);
+               if(error != MAPS_ERROR_NONE)
+                       break;
+#endif
+
+               /* Redraw the view */
+               error = map_view_redraw(v);
+               if(error != MAPS_ERROR_NONE)
+                       return error;
+
+               return MAPS_ERROR_NONE;
+       } while(false);
+
+       return error;
+}
+
+EXPORT_API int map_view_remove_all_objects(map_view_h view)
+{
+       MAPS_LOG_API;
+       if (!view)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       int error = MAPS_ERROR_NONE;
+       do {
+               map_view_s *v = (map_view_s *)view;
+               error = maps_item_list_remove_all(v->view_objects,
+                                                     map_object_destroy);
+               if(error != MAPS_ERROR_NONE)
+                       return error;
+
+               /* Notify the plugin view, that all objects are removed */
+               _map_view_on_object_operation(view,
+                                             NULL,
+                                             MAP_OBJECT_REMOVE_ALL);
+               if(error != MAPS_ERROR_NONE)
+                       break;
+
+               /* Redraw the view */
+               error = map_view_redraw(v);
+               if(error != MAPS_ERROR_NONE)
+                       return error;
+
+               return MAPS_ERROR_NONE;
+       } while(false);
+
+       return error;
+}
+
+EXPORT_API int map_view_foreach_object(const map_view_h view,
+                                       map_object_cb callback,
+                                       void *user_data)
+{
+       MAPS_LOG_API;
+       if (!view || !callback)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       map_view_s *v = (map_view_s *)view;
+       return maps_item_list_foreach(v->view_objects,
+                                     maps_item_no_clone,
+                                     callback, user_data);
+}
+
+
+/* ----------------------SEND MAP VIEW CALLBACK TO THE USER-------------------*/
+
+/* TODO: Consider refactoring of send Map View Callbacks to the User */
+
+map_event_data_h _map_view_create_event_data(map_event_type_e type)
+{
+       map_event_data_h event_data = NULL;
+       const int error = _map_event_data_create(&event_data);
+       if(error != MAPS_ERROR_NONE) {
+               map_event_data_destroy(event_data);
+               return NULL;
+       }
+       if(!event_data)
+               return NULL;
+       _map_event_data_set_type(event_data, type);
+       return event_data;
+}
+
+void _map_view_invoke_event_callback(map_view_h view,
+                                    map_event_data_h event_data)
+{
+       if(!view || !event_data)
+               return;
+
+       map_view_s *v = (map_view_s *)view;
+
+       map_event_type_e type = MAP_EVENT_GESTURE;
+       map_event_data_get_type(event_data, &type);
+
+       v->event_callbacks[type].callback(MAPS_ERROR_NONE, type, event_data,
+                                         v->event_callbacks[type].user_data);
+}
+
+/* ----------------------HIT TEST---------------------------------------------*/
+/* TODO: consider refactoring of Hit Test features and separation as
+ *  dedicated classes */
+
+typedef struct _map_view_hit_test_data_s {
+       map_view_s *v;
+       int x;
+       int y;
+       map_object_h object;
+} map_view_hit_test_data_s;
+
+
+typedef struct _map_view_collect_poly_object_point_s {
+       map_view_s *v;
+       view::poly_shape_hit_test *pd;
+} map_view_collect_poly_object_point_s;
+
+
+static bool __map_object_poly_collect_points_cb(int index,
+                                                    maps_coordinates_h point,
+                                                    void *user_data)
+{
+       if(!point || !user_data)
+               return false;
+
+       map_view_collect_poly_object_point_s *cpop =
+               (map_view_collect_poly_object_point_s *)user_data;
+
+       int x = 0;
+       int y = 0;
+       if(map_view_geography_to_screen(cpop->v, point, &x, &y) ==
+          MAPS_ERROR_NONE)
+               cpop->pd->add_point(float(x), float(y));
+
+       maps_coordinates_destroy(point);
+
+       return true;
+}
+
+static bool __map_view_hit_test_cb(int index, int total,
+                                  map_object_h object,
+                                  void *user_data)
+{
+       if(!object || !user_data)
+               return false;
+
+       #ifdef IMPROVEMENT_OF_VISUAL_OBJECTS
+       /* If it is an unvisible object, skip this hit-testing. */
+       bool visible = false;
+       map_object_get_visible(object, &visible);
+       if (!visible) return true;
+       #endif
+
+       map_view_hit_test_data_s *htd = (map_view_hit_test_data_s *)user_data;
+
+       map_object_type_e type = MAP_OBJECT_UNKNOWN;
+       map_object_get_type(object, &type);
+       switch(type) {
+               case MAP_OBJECT_GROUP: {
+                       map_object_group_foreach_object(object,
+                                                       __map_view_hit_test_cb,
+                                                       htd);
+                       #ifndef IMPROVEMENT_OF_VISUAL_OBJECTS
+                       /* BLOCK : If one of objects in the group, the actual object should be returned. */
+                       if(htd->object)
+                               htd->object = object;
+                       #endif
+                       break;
+               }
+               case MAP_OBJECT_POLYLINE: {
+                       view::poly_shape_hit_test pd;
+                       map_view_collect_poly_object_point_s cpop = {htd->v,
+                                                                       &pd};
+                       int error = map_object_polyline_foreach_point(object,
+                               __map_object_poly_collect_points_cb,
+                               &cpop);
+                       if(error != MAPS_ERROR_NONE)
+                               break;
+
+                       if(pd.hit_test(float(htd->x), float(htd->y), false))
+                               htd->object = object;
+
+                       break;
+               }
+
+               case MAP_OBJECT_POLYGON: {
+                       view::poly_shape_hit_test pd;
+                       map_view_collect_poly_object_point_s cpop = {htd->v,
+                                                                       &pd};
+                       int error = map_object_polygon_foreach_point(object,
+                               __map_object_poly_collect_points_cb,
+                               &cpop);
+                       if(error != MAPS_ERROR_NONE)
+                               break;
+
+                       if(pd.hit_test(float(htd->x), float(htd->y), true))
+                               htd->object = object;
+
+                       break;
+               }
+               case MAP_OBJECT_MARKER: {
+                       maps_coordinates_h c = NULL;
+                       map_object_marker_get_coordinates(object, &c);
+
+                       int x = 0;
+                       int y = 0;
+                       map_view_geography_to_screen(htd->v, c, &x, &y);
+                       maps_coordinates_destroy(c);
+
+                       int w = 0;
+                       int h = 0;
+                       map_object_marker_get_size(object, &w, &h);
+
+                       #ifdef IMPROVEMENT_OF_VISUAL_OBJECTS
+                       /* In case of PIN marker type, rearrange the hit-area. */
+                       map_marker_type_e marker_type;
+                       map_object_marker_get_type(object, &marker_type);
+                       if (marker_type == MAP_MARKER_PIN)
+                               y -= h / 2;
+
+                       /* Add some margin of the hit-area. */
+                       w += 20;
+                       h += 20;
+                       #endif
+
+                       if((x > (htd->x - w)) && (x < (htd->x + w))
+                          && (y > (htd->y - h)) && (y < (htd->y + h))) {
+                               htd->object = object;
+                       }
+                       break;
+               }
+#ifdef TIZEN_3_0_NEXT_MS
+               case MAP_OBJECT_ROUTE: {
+                       /* TODO: Implement Hit Test for route */
+                       break;
+               }
+#endif /* TIZEN_3_0_NEXT_MS */
+               default:
+                       break;
+       }
+
+       if(htd->object)
+               return false;
+
+       return true;
+}
+
+
+map_object_h _map_object_hit_test(map_view_h view,
+                                           const int x,
+                                           const int y,
+                                           map_gesture_e gesture)
+{
+       if (!view)
+               return NULL;
+
+       map_view_s *v = (map_view_s *)view;
+
+       /* Check if we are going to inform anyone about object events */
+       if (v->event_callbacks[MAP_EVENT_OBJECT].callback
+               == __map_view_on_event_empty_cb)
+               return NULL;
+
+       /* 1. Iterate through the list of object and test the hit */
+       map_view_hit_test_data_s htd = {v, x, y, NULL};
+       int error = map_view_foreach_object(view, __map_view_hit_test_cb, &htd);
+       if ((error != MAPS_ERROR_NONE) || !htd.object)
+               return NULL;
+
+       /*g_print("Hit Test: FOUND OBJECT: %p\n", htd.object);*/
+
+       /* Invoke user registered event callback */
+       map_event_data_h ed =
+               _map_view_create_event_data(MAP_EVENT_OBJECT);
+       if (ed) {
+               _map_event_data_set_object(ed, htd.object);
+               _map_event_data_set_gesture_type(ed, gesture);
+               _map_view_invoke_event_callback(view, ed);
+       }
+
+       /* 2. Extract test result */
+       return htd.object;
+}
index bcf97e884097b5386c9b23b3ac3020d6fc3bd564..4123d075a0ea75b0198336776100e8364a877b45 100755 (executable)
@@ -54,7 +54,8 @@ const gsize _MAPS_ADDRESS_COUNTY_MAX_LENGTH = 128;
 
 EXPORT_API int maps_address_create(maps_address_h *address)
 {
-       if (not address)
+       MAPS_LOG_API;
+       if (!address)
                return MAPS_ERROR_INVALID_PARAMETER;
 
        maps_address_s *a = g_slice_new0(maps_address_s);
@@ -69,7 +70,8 @@ EXPORT_API int maps_address_create(maps_address_h *address)
 
 EXPORT_API int maps_address_destroy(maps_address_h address)
 {
-       if (not address)
+       MAPS_LOG_API;
+       if (!address)
                return MAPS_ERROR_INVALID_PARAMETER;
 
        maps_address_s *a = (maps_address_s *) address;
@@ -104,6 +106,7 @@ EXPORT_API int maps_address_destroy(maps_address_h address)
 EXPORT_API int maps_address_clone(const maps_address_h origin,
                                  maps_address_h *cloned)
 {
+       MAPS_LOG_API;
        if (!cloned || !origin)
                return MAPS_ERROR_INVALID_PARAMETER;
 
@@ -191,7 +194,8 @@ EXPORT_API int maps_address_clone(const maps_address_h origin,
 EXPORT_API int maps_address_get_building_number(const maps_address_h address,
                                                char **building_number)
 {
-       if (not address or not building_number)
+       MAPS_LOG_API;
+       if (!address || !building_number)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_address_s *) address)->building_number,
                _MAPS_ADDRESS_BUILDING_NUMBER_MAX_LENGTH, building_number);
@@ -200,7 +204,8 @@ EXPORT_API int maps_address_get_building_number(const maps_address_h address,
 EXPORT_API int maps_address_get_street(const maps_address_h address,
                                       char **street)
 {
-       if (not address or not street)
+       MAPS_LOG_API;
+       if (!address || !street)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_address_s *) address)->street,
                _MAPS_ADDRESS_STREET_MAX_LENGTH, street);
@@ -209,7 +214,8 @@ EXPORT_API int maps_address_get_street(const maps_address_h address,
 EXPORT_API int maps_address_get_district(const maps_address_h address,
                                         char **district)
 {
-       if (not address or not district)
+       MAPS_LOG_API;
+       if (!address || !district)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_address_s *) address)->district,
                _MAPS_ADDRESS_DISTRICT_MAX_LENGTH, district);
@@ -217,7 +223,8 @@ EXPORT_API int maps_address_get_district(const maps_address_h address,
 
 EXPORT_API int maps_address_get_city(const maps_address_h address, char **city)
 {
-       if (not address or not city)
+       MAPS_LOG_API;
+       if (!address || !city)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_address_s *) address)->city,
                _MAPS_ADDRESS_CITY_MAX_LENGTH, city);
@@ -226,7 +233,8 @@ EXPORT_API int maps_address_get_city(const maps_address_h address, char **city)
 EXPORT_API int maps_address_get_state(const maps_address_h address,
                                      char **state)
 {
-       if (not address or not state)
+       MAPS_LOG_API;
+       if (!address || !state)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_address_s *) address)->state,
                _MAPS_ADDRESS_STATE_MAX_LENGTH, state);
@@ -235,7 +243,8 @@ EXPORT_API int maps_address_get_state(const maps_address_h address,
 EXPORT_API int maps_address_get_country(const maps_address_h address,
                                        char **country)
 {
-       if (not address or not country)
+       MAPS_LOG_API;
+       if (!address || !country)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_address_s *) address)->country,
                _MAPS_ADDRESS_COUNTRY_MAX_LENGTH, country);
@@ -244,7 +253,8 @@ EXPORT_API int maps_address_get_country(const maps_address_h address,
 EXPORT_API int maps_address_get_country_code(const maps_address_h address,
                                             char **country_code)
 {
-       if (not address or not country_code)
+       MAPS_LOG_API;
+       if (!address || !country_code)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_address_s *) address)->country_code,
                _MAPS_ADDRESS_COUNTRY_CODE_MAX_LENGTH, country_code);
@@ -253,7 +263,8 @@ EXPORT_API int maps_address_get_country_code(const maps_address_h address,
 EXPORT_API int maps_address_get_county(const maps_address_h address,
                                       char **county)
 {
-       if (not address or not county)
+       MAPS_LOG_API;
+       if (!address || !county)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_address_s *) address)->county,
                _MAPS_ADDRESS_COUNTY_MAX_LENGTH, county);
@@ -262,7 +273,8 @@ EXPORT_API int maps_address_get_county(const maps_address_h address,
 EXPORT_API int maps_address_get_postal_code(const maps_address_h address,
                                            char **postal_code)
 {
-       if (not address or not postal_code)
+       MAPS_LOG_API;
+       if (!address || !postal_code)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_address_s *) address)->postal_code,
                _MAPS_ADDRESS_POSTAL_CODE_MAX_LENGTH, postal_code);
@@ -271,7 +283,8 @@ EXPORT_API int maps_address_get_postal_code(const maps_address_h address,
 EXPORT_API int maps_address_get_freetext(const maps_address_h address,
                                         char **freetext)
 {
-       if (not address or not freetext)
+       MAPS_LOG_API;
+       if (!address || !freetext)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_address_s *) address)->freetext,
                _MAPS_ADDRESS_FREE_TEXT_MAX_LENGTH, freetext);
@@ -282,7 +295,8 @@ EXPORT_API int maps_address_get_freetext(const maps_address_h address,
 EXPORT_API int maps_address_set_building_number(maps_address_h address,
                                                const char *building_number)
 {
-       if (not address or not building_number)
+       MAPS_LOG_API;
+       if (!address || !building_number)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(building_number,
                _MAPS_ADDRESS_BUILDING_NUMBER_MAX_LENGTH,
@@ -292,7 +306,8 @@ EXPORT_API int maps_address_set_building_number(maps_address_h address,
 EXPORT_API int maps_address_set_street(maps_address_h address,
                                       const char *street)
 {
-       if (not address or not street)
+       MAPS_LOG_API;
+       if (!address || !street)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(street, _MAPS_ADDRESS_STREET_MAX_LENGTH,
                &((maps_address_s *) address)->street);
@@ -301,7 +316,8 @@ EXPORT_API int maps_address_set_street(maps_address_h address,
 EXPORT_API int maps_address_set_district(maps_address_h address,
                                         const char *district)
 {
-       if (not address or not district)
+       MAPS_LOG_API;
+       if (!address || !district)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(district, _MAPS_ADDRESS_DISTRICT_MAX_LENGTH,
                &((maps_address_s *) address)->district);
@@ -309,7 +325,8 @@ EXPORT_API int maps_address_set_district(maps_address_h address,
 
 EXPORT_API int maps_address_set_city(maps_address_h address, const char *city)
 {
-       if (not address or not city)
+       MAPS_LOG_API;
+       if (!address || !city)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(city, _MAPS_ADDRESS_CITY_MAX_LENGTH,
                &((maps_address_s *) address)->city);
@@ -317,7 +334,8 @@ EXPORT_API int maps_address_set_city(maps_address_h address, const char *city)
 
 EXPORT_API int maps_address_set_state(maps_address_h address, const char *state)
 {
-       if (not address or not state)
+       MAPS_LOG_API;
+       if (!address || !state)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(state, _MAPS_ADDRESS_STATE_MAX_LENGTH,
                &((maps_address_s *) address)->state);
@@ -326,7 +344,8 @@ EXPORT_API int maps_address_set_state(maps_address_h address, const char *state)
 EXPORT_API int maps_address_set_country(maps_address_h address,
                                        const char *country)
 {
-       if (not address or not country)
+       MAPS_LOG_API;
+       if (!address || !country)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(country, _MAPS_ADDRESS_COUNTRY_MAX_LENGTH,
                &((maps_address_s *) address)->country);
@@ -335,7 +354,8 @@ EXPORT_API int maps_address_set_country(maps_address_h address,
 EXPORT_API int maps_address_set_country_code(maps_address_h address,
                                             const char *country_code)
 {
-       if (not address or not country_code)
+       MAPS_LOG_API;
+       if (!address || !country_code)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(country_code,
                _MAPS_ADDRESS_COUNTRY_CODE_MAX_LENGTH,
@@ -345,7 +365,8 @@ EXPORT_API int maps_address_set_country_code(maps_address_h address,
 EXPORT_API int maps_address_set_county(maps_address_h address,
                                       const char *county)
 {
-       if (not address or not county)
+       MAPS_LOG_API;
+       if (!address || !county)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(county, _MAPS_ADDRESS_COUNTY_MAX_LENGTH,
                &((maps_address_s *) address)->county);
@@ -354,7 +375,8 @@ EXPORT_API int maps_address_set_county(maps_address_h address,
 EXPORT_API int maps_address_set_postal_code(maps_address_h address,
                                            const char *postal_code)
 {
-       if (not address or not postal_code)
+       MAPS_LOG_API;
+       if (!address || !postal_code)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(postal_code,
                _MAPS_ADDRESS_POSTAL_CODE_MAX_LENGTH,
@@ -364,8 +386,130 @@ EXPORT_API int maps_address_set_postal_code(maps_address_h address,
 EXPORT_API int maps_address_set_freetext(maps_address_h address,
                                         const char *freetext)
 {
-       if (not address or not freetext)
+       MAPS_LOG_API;
+       if (!address || !freetext)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(freetext, _MAPS_ADDRESS_FREE_TEXT_MAX_LENGTH,
                &((maps_address_s *) address)->freetext);
 }
+
+/*
+ * Tizen 3.0
+ */
+
+EXPORT_API int maps_address_list_create(maps_address_list_h *address_list)
+{
+       if (!address_list)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       GList *list = g_list_alloc();
+       MAPS_CHECK_CONDITION(list, MAPS_ERROR_OUT_OF_MEMORY, "MAPS_ERROR_OUT_OF_MEMORY");
+       *address_list = (void *) list;
+       MAPS_LOGD("address_list: %p", list);
+
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_address_list_append(maps_address_list_h address_list, maps_address_h address)
+{
+       if (!address_list || !address)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       GList *list = g_list_append((GList *)address_list, (gpointer) address);
+       MAPS_CHECK_CONDITION(list, MAPS_ERROR_OUT_OF_MEMORY, "MAPS_ERROR_OUT_OF_MEMORY");
+       address_list = list;
+
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_address_list_remove(maps_address_list_h address_list, maps_address_h address)
+{
+       if (!address_list || !address)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       GList *list = g_list_remove((GList *) address_list, (gpointer) address);
+       MAPS_CHECK_CONDITION(list, MAPS_ERROR_OUT_OF_MEMORY, "MAPS_ERROR_OUT_OF_MEMORY");
+       address_list = list;
+
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_address_list_get_length(maps_address_list_h address_list, int *length)
+{
+       if (!address_list || !length)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       *length = g_list_length((GList *)address_list) - 1;
+
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_address_list_foreach(maps_address_list_h address_list, maps_address_cb callback, void *user_data)
+{
+       if (!address_list || !callback)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       bool ret = true;
+       int index = 0;
+
+       GList *l = (GList *)address_list;
+       l = g_list_first(l);
+       while (l != NULL)
+       {
+               GList *next = l->next;
+               maps_address_s *address = (maps_address_s *)l->data;
+               if (address) {
+                       /*
+                       int ret = callback(index++, address->country_code, address->country, addres->county, address->state,
+                                                       address->city, address->district, addrss->street, address->building_number, address->freetext, user_data);
+                       */
+                       ret = callback(index++, address, user_data);
+               }
+               if (ret)
+                       l = next;
+               else
+                       break;
+       }
+
+       return MAPS_ERROR_NONE;
+}
+
+static void _free_address(gpointer data, gpointer user_data)
+{
+       maps_address_h address = (maps_address_h) data;
+       maps_address_h address_list = (maps_address_list_h) user_data;
+       int ret;
+
+       if (address) {
+               MAPS_LOGD("%p", address);
+               ret = maps_address_destroy(address);
+               if (ret) {
+                       MAPS_LOGI("Failed to maps_address_destroy!!!");
+               }
+       }
+
+       if (address_list) {
+               ret = maps_address_list_remove(address_list, address);
+               if (ret) {
+                       MAPS_LOGI("Failed to maps_address_list_remove!!!");
+               }
+       }
+       address = NULL;
+}
+
+EXPORT_API int maps_address_list_destroy(maps_address_list_h address_list)
+{
+       if (!address_list)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       GList *list = (GList *) address_list;
+       MAPS_LOGD("address_list:%p, length = %d", list, g_list_length(list));
+
+       list = g_list_first(list);
+       g_list_foreach(list, _free_address, list);
+       g_list_free(list);
+       address_list = NULL;
+
+       return MAPS_ERROR_NONE;
+}
+
index f6e7d739170d1ba8843523390791a66c23ff5ea1..798888d6385e7f14b617c51221a556790766f8fa 100755 (executable)
@@ -23,7 +23,8 @@ EXPORT_API int maps_area_create_rectangle(const maps_coordinates_h top_left,
                                          const maps_coordinates_h bottom_right,
                                          maps_area_h *area)
 {
-       if (not top_left or not bottom_right or not area)
+       MAPS_LOG_API;
+       if (!top_left || !bottom_right || !area)
                return MAPS_ERROR_INVALID_PARAMETER;
 
        double tf_lat = .0;
@@ -67,9 +68,10 @@ EXPORT_API int maps_area_create_rectangle(const maps_coordinates_h top_left,
 EXPORT_API int maps_area_create_circle(const maps_coordinates_h center,
                                       const double radius, maps_area_h *area)
 {
-       if (not center or not area)
+       MAPS_LOG_API;
+       if (!center || !area)
                return MAPS_ERROR_INVALID_PARAMETER;
-       if(radius < 0)
+       if (radius < 0)
                return MAPS_ERROR_INVALID_PARAMETER;
 
        /* MAPS_CHECK_CONDITION(radius > 0, MAPS_ERROR_INVALID_PARAMETER,
@@ -91,7 +93,8 @@ EXPORT_API int maps_area_create_circle(const maps_coordinates_h center,
 
 EXPORT_API int maps_area_destroy(maps_area_h area)
 {
-       if (not area)
+       MAPS_LOG_API;
+       if (!area)
                return MAPS_ERROR_INVALID_PARAMETER;
 
        maps_area_s *handle = (maps_area_s *) area;
@@ -102,7 +105,8 @@ EXPORT_API int maps_area_destroy(maps_area_h area)
 
 EXPORT_API int maps_area_clone(const maps_area_h origin, maps_area_h *cloned)
 {
-       if (not cloned or not origin)
+       MAPS_LOG_API;
+       if (!cloned || !origin)
                return MAPS_ERROR_INVALID_PARAMETER;
 
        maps_area_s * origin_handle = (maps_area_s *) origin;
index bd3d520b1f8287b3477701678b7b9f9d92200f01..6107f269c020f724405c9fabf1c39985f263eaa6 100755 (executable)
@@ -16,6 +16,7 @@
 
 #include <glib.h>
 #include "maps_error.h"
+#include "maps_plugin_types.h"
 #include "maps_coordinates.h"
 #include "maps_util.h"
 
@@ -23,7 +24,8 @@ EXPORT_API int maps_coordinates_create(const double latitude,
                                       const double longitude,
                                       maps_coordinates_h *coords)
 {
-       if (not coords)
+       MAPS_LOG_API;
+       if (!coords)
                return MAPS_ERROR_INVALID_PARAMETER;
 
        MAPS_CHECK_CONDITION(latitude >= -90
@@ -48,7 +50,8 @@ EXPORT_API int maps_coordinates_create(const double latitude,
 
 EXPORT_API int maps_coordinates_destroy(maps_coordinates_h coords)
 {
-       if (not coords)
+       MAPS_LOG_API;
+       if (!coords)
                return MAPS_ERROR_INVALID_PARAMETER;
 
        maps_coordinates_s *handle = (maps_coordinates_s *) coords;
@@ -62,7 +65,8 @@ EXPORT_API int maps_coordinates_destroy(maps_coordinates_h coords)
 EXPORT_API int maps_coordinates_clone(const maps_coordinates_h origin,
                                      maps_coordinates_h *cloned)
 {
-       if (not cloned or not origin)
+       MAPS_LOG_API;
+       if (!cloned || !origin)
                return MAPS_ERROR_INVALID_PARAMETER;
 
        int error = MAPS_ERROR_NONE;
@@ -88,7 +92,8 @@ EXPORT_API int maps_coordinates_clone(const maps_coordinates_h origin,
 EXPORT_API int maps_coordinates_get_latitude(const maps_coordinates_h coords,
                                             double *latitude)
 {
-       if (not coords or not latitude)
+       MAPS_LOG_API;
+       if (!coords || !latitude)
                return MAPS_ERROR_INVALID_PARAMETER;
        *latitude = ((maps_coordinates_s *) coords)->latitude;
        return MAPS_ERROR_NONE;
@@ -97,18 +102,32 @@ EXPORT_API int maps_coordinates_get_latitude(const maps_coordinates_h coords,
 EXPORT_API int maps_coordinates_get_longitude(const maps_coordinates_h coords,
                                              double *longitude)
 {
-       if (not coords or not longitude)
+       MAPS_LOG_API;
+       if (!coords || !longitude)
                return MAPS_ERROR_INVALID_PARAMETER;
        *longitude = ((maps_coordinates_s *) coords)->longitude;
        return MAPS_ERROR_NONE;
 }
 
+EXPORT_API int maps_coordinates_get_latitude_longitude(const maps_coordinates_h coords,
+                                             double *latitude,
+                                             double *longitude)
+{
+       MAPS_LOG_API;
+       if (!coords || !latitude || !longitude)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       *latitude = ((maps_coordinates_s *) coords)->latitude;
+       *longitude = ((maps_coordinates_s *) coords)->longitude;
+       return MAPS_ERROR_NONE;
+}
+
 /*----------------------------------------------------------------------------*/
 
 EXPORT_API int maps_coordinates_set_latitude(maps_coordinates_h coords,
                                             const double latitude)
 {
-       if (not coords)
+       MAPS_LOG_API;
+       if (!coords)
                return MAPS_ERROR_INVALID_PARAMETER;
        MAPS_CHECK_CONDITION(latitude >= -90
                && latitude <= 90, MAPS_ERROR_INVALID_PARAMETER,
@@ -120,7 +139,8 @@ EXPORT_API int maps_coordinates_set_latitude(maps_coordinates_h coords,
 EXPORT_API int maps_coordinates_set_longitude(maps_coordinates_h coords,
        const double longitude)
 {
-       if (not coords)
+       MAPS_LOG_API;
+       if (!coords)
                return MAPS_ERROR_INVALID_PARAMETER;
        MAPS_CHECK_CONDITION(longitude >= -180
                && longitude <= 180, MAPS_ERROR_INVALID_PARAMETER,
@@ -128,3 +148,145 @@ EXPORT_API int maps_coordinates_set_longitude(maps_coordinates_h coords,
        ((maps_coordinates_s *) coords)->longitude = longitude;
        return MAPS_ERROR_NONE;
 }
+
+EXPORT_API int maps_coordinates_set_latitude_longitude(maps_coordinates_h coords,
+       const double latitude,
+       const double longitude)
+{
+       MAPS_LOG_API;
+       if (!coords)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       MAPS_CHECK_CONDITION(latitude >= -90
+               && latitude <= 90, MAPS_ERROR_INVALID_PARAMETER,
+               "MAPS_ERROR_INVALID_PARAMETER");
+       MAPS_CHECK_CONDITION(longitude >= -180
+               && longitude <= 180, MAPS_ERROR_INVALID_PARAMETER,
+               "MAPS_ERROR_INVALID_PARAMETER");
+       ((maps_coordinates_s *) coords)->latitude = latitude;
+       ((maps_coordinates_s *) coords)->longitude = longitude;
+       return MAPS_ERROR_NONE;
+}
+
+/*
+ * Tizen 3.0
+ */
+
+EXPORT_API int maps_coordinates_list_create(maps_coordinates_list_h *coordinates_list)
+{
+       if (!coordinates_list)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       GList *list = g_list_alloc();
+       MAPS_CHECK_CONDITION(list, MAPS_ERROR_OUT_OF_MEMORY, "MAPS_ERROR_OUT_OF_MEMORY");
+       *coordinates_list = (void *) list;
+
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_coordinates_list_append(maps_coordinates_list_h coordinates_list, maps_coordinates_h coordinates)
+{
+       if (!coordinates_list || !coordinates)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       GList *list = g_list_append((GList *) coordinates_list, (gpointer) coordinates);
+       /*
+       Although this logic is faster, it doesn't guarantee the order of item.
+       GList *list = g_list_prepend((GList *) coordinates_list, (gpointer) coordinates);
+       list = g_list_reverse(list);
+       */
+
+       MAPS_CHECK_CONDITION(list, MAPS_ERROR_OUT_OF_MEMORY, "MAPS_ERROR_OUT_OF_MEMORY");
+       coordinates_list = (void *) list;
+
+       return MAPS_ERROR_NONE;
+}
+
+static void _free_coordinates(gpointer data, gpointer user_data)
+{
+       maps_coordinates_h coordinates = (maps_coordinates_h) data;
+       maps_coordinates_list_h coordinates_list = (maps_coordinates_list_h) user_data;
+       int ret = 0;
+
+       if (coordinates) {
+               ret = maps_coordinates_destroy(coordinates);
+               if (ret) {
+                       MAPS_LOGI("Failed to maps_coordinates_destroy!!!");
+               }
+       }
+
+       if (coordinates_list) {
+               ret = maps_coordinates_list_remove(coordinates_list, coordinates);
+               if (ret) {
+                       MAPS_LOGI("Failed to maps_coordinates_list_remove!!!");
+               }
+       }
+       coordinates = NULL;
+}
+
+EXPORT_API int maps_coordinates_list_destroy(maps_coordinates_list_h coordinates_list)
+{
+       if (!coordinates_list)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       GList *list = (GList *) coordinates_list;
+       MAPS_LOGD("length = %d", g_list_length(list));
+
+       list = g_list_first(list);
+       g_list_foreach(list, _free_coordinates, list);
+       g_list_free(list);
+       coordinates_list = NULL;
+
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_coordinates_list_remove(maps_coordinates_list_h coordinates_list, maps_coordinates_h coordinates)
+{
+       if (!coordinates_list || !coordinates)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       GList *list = g_list_remove((GList *)coordinates_list, (gpointer) coordinates);
+       MAPS_CHECK_CONDITION(list, MAPS_ERROR_OUT_OF_MEMORY, "MAPS_ERROR_OUT_OF_MEMORY");
+       coordinates_list = (void *) list;
+
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_coordinates_list_get_length(maps_coordinates_list_h coordinates_list, int *length)
+{
+       if (!coordinates_list || !length)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       *length = g_list_length((GList *)coordinates_list) - 1;
+
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_coordinates_list_foreach(maps_coordinates_list_h coordinates_list, maps_coordinates_cb callback, void *user_data)
+{
+       if (!coordinates_list || !callback)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       bool ret = true;
+       int index = 0;
+
+       GList *list = (GList *)coordinates_list;
+       list = g_list_first(list);
+       while (list != NULL)
+       {
+               GList *next = list->next;
+               maps_coordinates_s *coordinates = (maps_coordinates_s *)list->data;
+               if (coordinates) {
+                       /*
+                       int ret = callback(index++, coordinates->latitude, coordinates->longitude, user_data);
+                       */
+                       MAPS_LOGD("index = %d", index);
+                       ret = callback(index++, coordinates, user_data);
+               }
+               if (ret)
+                       list = next;
+               else
+                       break;
+       }
+
+       return MAPS_ERROR_NONE;
+}
index 95d9b249509feeee2d63d968510ed937ec20667a..baa07913a9ee7b9da0459663a9b611ca750c7b7d 100755 (executable)
@@ -17,6 +17,7 @@
 #include <glib.h>
 #include "maps_error.h"
 #include "maps_extra_types.h"
+#include "maps_extra_types_private.h"
 #include "maps_util.h"
 
 typedef struct _maps_item_list_s
@@ -26,6 +27,7 @@ typedef struct _maps_item_list_s
 
 EXPORT_API int maps_item_list_create(maps_item_list_h *list)
 {
+       MAPS_LOG_API;
        if (!list)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_item_list_s *l = g_slice_new0(maps_item_list_s);
@@ -43,6 +45,7 @@ EXPORT_API int maps_item_list_create(maps_item_list_h *list)
 
 EXPORT_API int maps_item_list_destroy(maps_item_list_h list)
 {
+       MAPS_LOG_API;
        if (!list)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_item_list_s *l = (maps_item_list_s *) list;
@@ -55,6 +58,7 @@ EXPORT_API int maps_item_list_destroy(maps_item_list_h list)
 EXPORT_API int maps_item_list_append(maps_item_list_h list, const void *data,
                                     maps_item_list_clone_cb clone_func)
 {
+       MAPS_LOG_API;
        if (!list || !data || !clone_func)
                return MAPS_ERROR_INVALID_PARAMETER;
        void *p = NULL;
@@ -71,6 +75,7 @@ EXPORT_API int maps_item_list_foreach(maps_item_list_h list,
                                      maps_item_list_foreach_cb callback,
        void *user_data)
 {
+       MAPS_LOG_API;
        if (!list || !clone_func || !callback)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_item_list_s *l = (maps_item_list_s *) list;
@@ -94,9 +99,27 @@ EXPORT_API int maps_item_list_foreach(maps_item_list_h list,
        return MAPS_ERROR_NONE;
 }
 
+EXPORT_API int maps_item_list_remove(maps_item_list_h list,
+                                    void *item,
+                                    maps_item_list_free_cb free_func)
+{
+       MAPS_LOG_API;
+       if (!list)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       maps_item_list_s *l = (maps_item_list_s *) list;
+       if (l->l) {
+               l->l = g_list_remove(l->l, item);
+               if (free_func)
+                       free_func(item);
+       }
+       return MAPS_ERROR_NONE;
+}
+
 EXPORT_API int maps_item_list_remove_all(maps_item_list_h list,
                                         maps_item_list_free_cb free_func)
 {
+       MAPS_LOG_API;
        if (!list)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_item_list_s *l = (maps_item_list_s *) list;
@@ -118,6 +141,7 @@ EXPORT_API int maps_item_list_clone(const maps_item_list_h origin,
                                    maps_item_list_clone_cb clone_func,
                                    maps_item_list_h *cloned)
 {
+       MAPS_LOG_API;
        if (!cloned || !origin || !clone_func)
                return MAPS_ERROR_INVALID_PARAMETER;
 
@@ -165,6 +189,7 @@ typedef struct _maps_string_hashtable_s
 
 EXPORT_API int maps_string_hashtable_create(maps_string_hashtable_h *table)
 {
+       MAPS_LOG_API;
        if (!table)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_string_hashtable_s *t = g_slice_new0(maps_string_hashtable_s);
@@ -181,6 +206,7 @@ EXPORT_API int maps_string_hashtable_create(maps_string_hashtable_h *table)
 
 EXPORT_API int maps_string_hashtable_destroy(maps_string_hashtable_h table)
 {
+       MAPS_LOG_API;
        if (!table)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_string_hashtable_s *t = (maps_string_hashtable_s *) table;
@@ -193,6 +219,7 @@ EXPORT_API int maps_string_hashtable_destroy(maps_string_hashtable_h table)
 EXPORT_API int maps_string_hashtable_set(maps_string_hashtable_h table,
                                         const char *key, const char *value)
 {
+       MAPS_LOG_API;
        if (!table || !key || !value)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_string_hashtable_s *t = (maps_string_hashtable_s *) table;
@@ -205,6 +232,7 @@ EXPORT_API int maps_string_hashtable_set(maps_string_hashtable_h table,
 EXPORT_API int maps_string_hashtable_get(maps_string_hashtable_h table,
                                         const char *key, char **value)
 {
+       MAPS_LOG_API;
        if (!table || !key || !value)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_string_hashtable_s *t = (maps_string_hashtable_s *) table;
@@ -219,6 +247,7 @@ EXPORT_API int maps_string_hashtable_get(maps_string_hashtable_h table,
 EXPORT_API int maps_string_hashtable_remove(maps_string_hashtable_h table,
                                            const char *key)
 {
+       MAPS_LOG_API;
        if (!table || !key)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_string_hashtable_s *t = (maps_string_hashtable_s *) table;
@@ -232,6 +261,7 @@ EXPORT_API int maps_string_hashtable_foreach(maps_string_hashtable_h table,
                                             callback,
                                             void *user_data)
 {
+       MAPS_LOG_API;
        if (!table || !callback)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_string_hashtable_s *t = (maps_string_hashtable_s *) table;
@@ -266,6 +296,7 @@ EXPORT_API int maps_string_hashtable_foreach(maps_string_hashtable_h table,
 EXPORT_API int maps_string_hashtable_clone(const maps_string_hashtable_h origin,
                                           maps_string_hashtable_h *cloned)
 {
+       MAPS_LOG_API;
        if (!cloned || !origin)
                return MAPS_ERROR_INVALID_PARAMETER;
 
@@ -305,6 +336,7 @@ EXPORT_API int maps_string_hashtable_clone(const maps_string_hashtable_h origin,
 EXPORT_API int maps_string_hashtable_contains(maps_string_hashtable_h table,
                                              const char * key, bool * contains)
 {
+       MAPS_LOG_API;
        if (!table || !key || !contains)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_string_hashtable_s *t = (maps_string_hashtable_s *) table;
@@ -315,6 +347,177 @@ EXPORT_API int maps_string_hashtable_contains(maps_string_hashtable_h table,
 
 /*----------------------------------------------------------------------------*/
 
+typedef struct _maps_int_hashtable_s
+{
+       GHashTable *t;
+} maps_int_hashtable_s;
+
+EXPORT_API int maps_int_hashtable_create(maps_int_hashtable_h *table)
+{
+       MAPS_LOG_API;
+       if (!table)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       maps_int_hashtable_s *t = g_slice_new0(maps_int_hashtable_s);
+
+       if (!t) {
+               MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
+               return MAPS_ERROR_OUT_OF_MEMORY;
+       }
+
+       t->t = g_hash_table_new_full(g_int_hash, g_int_equal, g_free, g_free);
+       *table = t;
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_int_hashtable_destroy(maps_int_hashtable_h table)
+{
+       MAPS_LOG_API;
+       if (!table)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       maps_int_hashtable_s *t = (maps_int_hashtable_s *) table;
+       if (t->t)
+               g_hash_table_unref(t->t);
+       g_slice_free(maps_int_hashtable_s, t);
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_int_hashtable_set(maps_int_hashtable_h table,
+                                     const int key, const int value)
+{
+       MAPS_LOG_API;
+       if (!table)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       maps_int_hashtable_s *t = (maps_int_hashtable_s *) table;
+       if (t->t) {
+               int *new_key = g_new0(int, 1);
+               *new_key = key;
+               int *new_value = g_new0(int, 1);
+               *new_value = value;
+               g_hash_table_insert(t->t,
+                                   (gpointer)new_key,
+                                   (gpointer)new_value);
+       }
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_int_hashtable_get(maps_int_hashtable_h table,
+                                     const int key, int *value)
+{
+       MAPS_LOG_API;
+       if (!table || !value)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       maps_int_hashtable_s *t = (maps_int_hashtable_s *) table;
+       if (!t->t)
+               return MAPS_ERROR_NOT_FOUND;
+       const int *table_value = (const int *) g_hash_table_lookup(t->t, &key);
+       if (!table_value)
+               return MAPS_ERROR_NONE;
+       *value = *table_value;
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_int_hashtable_remove(maps_int_hashtable_h table,
+                                        const int key)
+{
+       MAPS_LOG_API;
+       if (!table)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       maps_int_hashtable_s *t = (maps_int_hashtable_s *) table;
+       if (t->t)
+               g_hash_table_remove(t->t, (gpointer) &key);
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_int_hashtable_foreach(maps_int_hashtable_h table,
+                                         maps_int_hashtable_foreach_cb
+                                         callback,
+                                         void *user_data)
+{
+       MAPS_LOG_API;
+       if (!table || !callback)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       maps_int_hashtable_s *t = (maps_int_hashtable_s *) table;
+
+       if (!t->t)
+               return MAPS_ERROR_NOT_FOUND;
+
+       GHashTableIter iter;
+       gpointer key, value;
+       const int total = g_hash_table_size(t->t);
+       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 *key_ptr = (int *)key;
+               int *value_ptr = (int *)value;
+               if (!callback(index++, total, *key_ptr, *value_ptr, user_data))
+                       break;
+
+       }
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_int_hashtable_clone(const maps_int_hashtable_h origin,
+                                       maps_int_hashtable_h *cloned)
+{
+       MAPS_LOG_API;
+       if (!cloned || !origin)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       int error = MAPS_ERROR_NONE;
+       do {
+
+               error = maps_int_hashtable_create(cloned);
+               if (!(*cloned) || (error != MAPS_ERROR_NONE))
+                       break;
+
+               maps_int_hashtable_s *t = (maps_int_hashtable_s *) origin;
+
+               if (!t->t)
+                       return MAPS_ERROR_NONE;
+
+               maps_int_hashtable_s *t_cloned =
+                       (maps_int_hashtable_s *) (*cloned);
+
+               GHashTableIter iter;
+               gpointer key, value;
+               g_hash_table_iter_init(&iter, t->t);
+               while (g_hash_table_iter_next(&iter, &key, &value)) {
+                       int *new_key = g_new0(int, 1);
+                       *new_key = *((int *)key);
+                       int *new_value = g_new0(int, 1);
+                       *new_value = *((int *)value);
+                       g_hash_table_insert(t_cloned->t,
+                               (gpointer) new_key,
+                               (gpointer) new_value);
+               }
+
+               return MAPS_ERROR_NONE;
+
+       } while (false);
+
+       maps_int_hashtable_destroy(*cloned);
+       *cloned = NULL;
+       return error;
+}
+
+EXPORT_API int maps_int_hashtable_contains(maps_int_hashtable_h table,
+                                          const int key, bool *contains)
+{
+       MAPS_LOG_API;
+       if (!table || !contains)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       maps_int_hashtable_s *t = (maps_int_hashtable_s *) table;
+       if (t->t)
+               *contains = g_hash_table_contains(t->t, (gpointer)&key);
+       return MAPS_ERROR_NONE;
+}
+
+/*----------------------------------------------------------------------------*/
+
 typedef struct _maps_hashtable_item_s
 {
        void *value;
@@ -352,6 +555,7 @@ typedef struct _maps_item_hashtable_s
 
 EXPORT_API int maps_item_hashtable_create(maps_item_hashtable_h *table)
 {
+       MAPS_LOG_API;
        if (!table)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_item_hashtable_s *t = g_slice_new0(maps_item_hashtable_s);
@@ -369,6 +573,7 @@ EXPORT_API int maps_item_hashtable_create(maps_item_hashtable_h *table)
 
 EXPORT_API int maps_item_hashtable_destroy(maps_item_hashtable_h table)
 {
+       MAPS_LOG_API;
        if (!table)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_item_hashtable_s *t = (maps_item_hashtable_s *) table;
@@ -380,6 +585,7 @@ EXPORT_API int maps_item_hashtable_destroy(maps_item_hashtable_h table)
 
 EXPORT_API int maps_item_hashtable_clone_string(void *origin, void **cloned)
 {
+       MAPS_LOG_API;
        if (!origin || !cloned)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string((char *) origin, strlen((char *) origin),
@@ -388,12 +594,14 @@ EXPORT_API int maps_item_hashtable_clone_string(void *origin, void **cloned)
 
 EXPORT_API int maps_item_hashtable_free_string(void *data)
 {
+       MAPS_LOG_API;
        g_free(data);
        return MAPS_ERROR_NONE;
 }
 
 EXPORT_API int maps_item_hashtable_clone_int(void *origin, void **cloned)
 {
+       MAPS_LOG_API;
        if (!origin || !cloned)
                return MAPS_ERROR_INVALID_PARAMETER;
        int *n_cloned = g_new0(int, 1);
@@ -411,12 +619,14 @@ EXPORT_API int maps_item_hashtable_clone_int(void *origin, void **cloned)
 
 EXPORT_API int maps_item_hashtable_free_int(void *data)
 {
+       MAPS_LOG_API;
        g_free(data);
        return MAPS_ERROR_NONE;
 }
 
 EXPORT_API int maps_item_hashtable_clone_float(void *origin, void **cloned)
 {
+       MAPS_LOG_API;
        if (!origin || !cloned)
                return MAPS_ERROR_INVALID_PARAMETER;
        double *n_cloned = g_new0(double, 1);
@@ -434,6 +644,7 @@ EXPORT_API int maps_item_hashtable_clone_float(void *origin, void **cloned)
 
 EXPORT_API int maps_item_hashtable_free_float(void *data)
 {
+       MAPS_LOG_API;
        g_free(data);
        return MAPS_ERROR_NONE;
 }
@@ -442,6 +653,7 @@ EXPORT_API int maps_item_hashtable_set_string(maps_item_hashtable_h table,
                                              const char *key,
                                              const char *value)
 {
+       MAPS_LOG_API;
        return maps_item_hashtable_set(table, key, value,
                maps_item_hashtable_clone_string,
                maps_item_hashtable_free_string);
@@ -450,6 +662,7 @@ EXPORT_API int maps_item_hashtable_set_string(maps_item_hashtable_h table,
 EXPORT_API int maps_item_hashtable_set_int(maps_item_hashtable_h table,
                                           const char *key, const int value)
 {
+       MAPS_LOG_API;
        return maps_item_hashtable_set(table, key, &value,
                maps_item_hashtable_clone_int, maps_item_hashtable_free_int);
 }
@@ -458,6 +671,7 @@ EXPORT_API int maps_item_hashtable_set_float(maps_item_hashtable_h table,
                                             const char *key,
                                             const double value)
 {
+       MAPS_LOG_API;
        return maps_item_hashtable_set(table, key, &value,
                maps_item_hashtable_clone_float,
                maps_item_hashtable_free_float);
@@ -468,6 +682,7 @@ EXPORT_API int maps_item_hashtable_set(maps_item_hashtable_h table,
        maps_item_hashtable_clone_cb clone_func,
        maps_item_hashtable_free_cb free_func)
 {
+       MAPS_LOG_API;
        if (!table || !key || !value || !clone_func || !free_func)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_item_hashtable_s *t = (maps_item_hashtable_s *) table;
@@ -494,12 +709,14 @@ EXPORT_API int maps_item_hashtable_set(maps_item_hashtable_h table,
 EXPORT_API int maps_item_hashtable_get_string(maps_item_hashtable_h table,
                                              const char *key, char **value)
 {
+       MAPS_LOG_API;
        return maps_item_hashtable_get(table, key, (void **) value);
 }
 
 EXPORT_API int maps_item_hashtable_get_int(maps_item_hashtable_h table,
                                           const char *key, int *value)
 {
+       MAPS_LOG_API;
        if (!table || !key || !value)
                return MAPS_ERROR_INVALID_PARAMETER;
        int *data = NULL;
@@ -514,6 +731,7 @@ EXPORT_API int maps_item_hashtable_get_int(maps_item_hashtable_h table,
 EXPORT_API int maps_item_hashtable_get_float(maps_item_hashtable_h table,
                                             const char *key, double *value)
 {
+       MAPS_LOG_API;
        if (!table || !key || !value)
                return MAPS_ERROR_INVALID_PARAMETER;
        double *data = NULL;
@@ -528,6 +746,7 @@ EXPORT_API int maps_item_hashtable_get_float(maps_item_hashtable_h table,
 EXPORT_API int maps_item_hashtable_get(maps_item_hashtable_h table,
                                       const char *key, void **value)
 {
+       MAPS_LOG_API;
        if (!table || !key || !value)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_item_hashtable_s *t = (maps_item_hashtable_s *) table;
@@ -543,6 +762,7 @@ EXPORT_API int maps_item_hashtable_get(maps_item_hashtable_h table,
 EXPORT_API int maps_item_hashtable_remove(maps_item_hashtable_h table,
                                          const char *key)
 {
+       MAPS_LOG_API;
        if (!table || !key)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_item_hashtable_s *t = (maps_item_hashtable_s *) table;
@@ -556,6 +776,7 @@ EXPORT_API int maps_item_hashtable_foreach(maps_item_hashtable_h table,
                                           callback,
                                           void *user_data)
 {
+       MAPS_LOG_API;
        if (!table || !callback)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_item_hashtable_s *t = (maps_item_hashtable_s *) table;
@@ -593,6 +814,7 @@ EXPORT_API int maps_item_hashtable_foreach(maps_item_hashtable_h table,
 EXPORT_API int maps_item_hashtable_clone(const maps_item_hashtable_h origin,
                                         maps_item_hashtable_h* cloned)
 {
+       MAPS_LOG_API;
        if (!cloned || !origin)
                return MAPS_ERROR_INVALID_PARAMETER;
 
@@ -633,6 +855,7 @@ EXPORT_API int maps_item_hashtable_clone(const maps_item_hashtable_h origin,
 EXPORT_API int maps_item_hashtable_contains(maps_item_hashtable_h table,
                                            const char *key, bool *contains)
 {
+       MAPS_LOG_API;
        if (!table || !key || !contains)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_item_hashtable_s *t = (maps_item_hashtable_s *) table;
@@ -640,3 +863,19 @@ EXPORT_API int maps_item_hashtable_contains(maps_item_hashtable_h table,
                *contains = g_hash_table_contains(t->t, (gpointer) key);
        return MAPS_ERROR_NONE;
 }
+
+/**
+ * This is the function, needed by maps_item_list_append.
+ * It allows not cloning the object while appending it to the list,
+ * but directly add the object pointer.
+ * We should use this function to reduce the memory consumption,
+ * caused by multyple clones
+ */
+EXPORT_API int maps_item_no_clone(void *origin, void **cloned)
+{
+       MAPS_LOG_API;
+       if(!cloned)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       *cloned = origin;
+       return MAPS_ERROR_NONE;
+}
diff --git a/src/api/maps_extra_types_private.h b/src/api/maps_extra_types_private.h
new file mode 100644 (file)
index 0000000..45ef1cd
--- /dev/null
@@ -0,0 +1,291 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MAPS_SERVICE_API_EXTRA_TYPES_PRIVATE_H__
+#define __MAPS_SERVICE_API_EXTRA_TYPES_PRIVATE_H__
+
+#include <tizen_type.h>
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*----------------------------------------------------------------------------*/
+
+/*
+ * @internal
+ * @ingroup    CAPI_MAPS_CONTAINERS_MODULE
+ * @defgroup   CAPI_MAPS_CONTAINERS_MODULE_INT_HASHTABLE Maps Integer Hash Tables
+ *
+ * @file maps_extra_types.h
+ * @brief This section contains API for using Hash Table of integers.
+ *
+ * @addtogroup CAPI_MAPS_CONTAINERS_MODULE_INT_HASHTABLE
+ * @{
+ * @brief This provides API for using Hash Table of ntegers.
+ */
+
+/*
+ * @internal
+ * @brief      The handle of Hash Table of ntegers.
+ * @details The handle of Hash Table of integers can be obtained via call of
+ * maps_int_hashtable_create().
+ * @remarks To release the handle use maps_int_hashtable_destroy().
+ * \n To clone the handle use maps_int_hashtable_clone().
+ * \n To assign the value to a key use maps_int_hashtable_set().
+ * \n The value, assigned with a specified key may be obtained using
+ * maps_int_hashtable_get().
+ * \n All key-value pairs of the table may be iterated using
+ * maps_int_hashtable_foreach().
+ * \n The key-value pair may be removed form the table using
+ * maps_int_hashtable_remove().
+ * \n To check if key is added to the table use
+ * maps_int_hashtable_contains().
+ * @since_tizen 3.0
+ *
+ * @see maps_int_hashtable_create()
+ * @see maps_int_hashtable_destroy()
+ * @see maps_int_hashtable_clone()
+ */
+typedef void *maps_int_hashtable_h;
+
+/*
+ * @internal
+ * @brief      Creates a new Hash Table of ntegers.
+ * @details This function creates a new instance of Hash Table of integers,
+ * associate a new handle with it and allocates all needed resources.
+ * @since_tizen 3.0
+ * @remarks @a table must be released using maps_int_hashtable_destroy().
+ * \n @a table may be cloned using maps_int_hashtable_clone().
+ *
+ * @param[out] table           The handle of newly created table
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_int_hashtable_clone()
+ * @see maps_int_hashtable_destroy()
+ */
+int maps_int_hashtable_create(maps_int_hashtable_h *table);
+
+/*
+ * @internal
+ * @brief      Destroys the Hash Table of integers and releases all its
+ * resources.
+ * @details This function destroys the Hash Table handle and releases all its
+ * resources.
+ * @since_tizen 3.0
+ * @remarks All integers stored in the table will be released.
+ *
+ * @param[in]  table           The handle of table to be destroyed
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a table is created using maps_int_hashtable_create().
+ *
+ * @see maps_int_hashtable_create()
+ * @see maps_int_hashtable_clone()
+ */
+int maps_int_hashtable_destroy(maps_int_hashtable_h table);
+
+/*
+ * @internal
+ * @brief      Clones the Hash Table of integerss.
+ * @details This function clones the Hash Table of integers @a origin and all
+ * its resources.
+ * \n The list handle @a origin may be created using
+ * maps_int_hashtable_create().
+ * @since_tizen 3.0
+ * @remarks @a cloned must be released using maps_int_hashtable_destroy().
+ *
+ * @param[in]  origin          The handle of the table to be cloned
+ * @param[out] cloned          The handle of the cloned table
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a table is created using maps_int_hashtable_create().
+ *
+ * @see maps_int_hashtable_create()
+ * @see maps_int_hashtable_destroy()
+ */
+int maps_int_hashtable_clone(const maps_int_hashtable_h origin,
+                            maps_int_hashtable_h *cloned);
+
+/*
+ * @internal
+ * @brief      Sets the association between integer key and value in the table.
+ * @details This function sets the association between int key and value in
+ * the Hash Table.
+ * @since_tizen 3.0
+ *
+ * @param[in]  table           The handle of the table
+ * @param[in]  key             The integer value of "key"
+ * @param[in]  value           The integer value of "value"
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a table is created using maps_int_hashtable_create().
+ *
+ * @see maps_int_hashtable_get()
+ * @see maps_int_hashtable_remove()
+ * @see maps_int_hashtable_create()
+ */
+int maps_int_hashtable_set(maps_int_hashtable_h table, const int key,
+                          const int value);
+
+/*
+ * @internal
+ * @brief      Gets the integer value associated with an integer key in the
+ * table.
+ * @details This function gets the integer value associated with a integer key
+ * in the Hash Table.
+ * @since_tizen 3.0
+ *
+ * @param[in]  table           The handle of the table
+ * @param[in]  key             The integer value of "key"
+ * @param[out] value           The integer value of "value"
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a table is created using maps_int_hashtable_create().
+ *
+ * @see maps_int_hashtable_set()
+ * @see maps_int_hashtable_remove()
+ * @see maps_int_hashtable_create()
+ */
+int maps_int_hashtable_get(maps_int_hashtable_h table, const int key,
+                          int *value);
+
+/*
+ * @internal
+ * @brief      Removes the key-value pair from the table.
+ * @details This function removes the key-value pair from the Hash Table.
+ * @since_tizen 3.0
+ * @remarks The resources, used by item will be released automatically.
+ *
+ * @param[in]  table           The handle of the table
+ * @param[in]  key             The integer value of "key"
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a table is created using maps_int_hashtable_create().
+ *
+ * @see maps_int_hashtable_set()
+ * @see maps_int_hashtable_get()
+ * @see maps_int_hashtable_create()
+ */
+int maps_int_hashtable_remove(maps_int_hashtable_h table,
+                             const int key);
+
+/*
+ * @internal
+ * @brief      Called once for each key-value pair while iterating through
+ * the given table.
+ * @details This function is called once for each key-value pair of the given
+ * table while the table is being iterated
+ * during the maps_int_hashtable_foreach() procedure.
+ * @since_tizen 3.0
+ *
+ * @param[in]  index           The current index of item
+ * @param[in]  total           The total amount of items
+ * @param[in]  key             The integer value of "key"
+ * @param[in]  value           The integer value of "value"
+ * @param[in]  user_data       The user data passed from
+ * maps_int_hashtable_foreach()
+ * @return     @c true to continue with the next iteration of the loop, \n @c
+ * false to break out of the loop
+ *
+ * @pre maps_int_hashtable_foreach() will invoke this callback.
+ *
+ * @see maps_int_hashtable_foreach()
+ */
+typedef bool(*maps_int_hashtable_foreach_cb) (int index, int total,
+                                             const int key, const int value,
+                                             void *user_data);
+
+/*
+ * @internal
+ * @brief      Gets the key-value pairs of the specified table.
+ * @details This function delivers key-value pairs of a specified table via
+ * maps_int_hashtable_foreach_cb() callback.
+ * @since_tizen 3.0
+ *
+ * @param[in]  table           The handle of table
+ * @param[in]  callback        The callback to be invoked for delivering each
+ * key-value pair
+ * @param[in]  user_data       The user data to be passed to the callback
+ * function
+ * @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_FOUND Result not found
+ *
+ * @pre @a table is created using maps_int_hashtable_create().
+ * @post This function invokes maps_int_hashtable_foreach_cb() to deliver
+ * key-value pairs.
+ *
+ * @see maps_int_hashtable_foreach_cb()
+ * @see maps_int_hashtable_set()
+ * @see maps_int_hashtable_get()
+ * @see maps_int_hashtable_create()
+ */
+int maps_int_hashtable_foreach(maps_int_hashtable_h table,
+                                 maps_int_hashtable_foreach_cb callback,
+                                 void *user_data);
+
+/*
+ * @internal
+ * @brief      Checks if key is in hash_table.
+ * @details This function checks if the specified key is in the Hash Table of
+ * integers.
+ * @since_tizen 3.0
+ *
+ * @param[in]  table           The handle of the table
+ * @param[in]  key             The integer value of "key"
+ * @param[out] contains        The flag of key presence
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a table is created using maps_int_hashtable_create().
+ *
+ * @see maps_int_hashtable_set()
+ * @see maps_int_hashtable_get()
+ * @see maps_int_hashtable_create()
+ */
+int maps_int_hashtable_contains(maps_int_hashtable_h table,
+                               const int key, bool *contains);
+
+/*
+ * @}
+ */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif                 /* __MAPS_SERVICE_API_EXTRA_TYPES_PRIVATE_H__ */
index a51b536e70bebeba2ed7e0fd5ed62a41768f813d..5659551b02faa9474416237e2cfc589205ed8123 100755 (executable)
@@ -16,6 +16,7 @@
 #include "maps_error.h"
 #include "maps_place_plugin.h"
 #include "maps_extra_types.h"
+#include "maps_extra_types_private.h"
 #include "maps_util.h"
 #include "maps_address.h"
 #include "maps_place_private.h"
@@ -84,8 +85,7 @@ typedef struct _maps_place_s
        maps_place_link_object_h related;
 
        /* The table of available data features */
-       maps_string_hashtable_h supported_data;
-       /* TODO: implement hashtable<int, int> */
+       maps_int_hashtable_h supported_data;
 
 } maps_place_s;
 
@@ -98,6 +98,7 @@ const gsize _MAPS_PLACE_URI_MAX_LENGTH = 128;
 
 EXPORT_API int maps_place_create(maps_place_h *place)
 {
+       MAPS_LOG_API;
        if (!place)
                return MAPS_ERROR_INVALID_PARAMETER;
        *place = (maps_place_h) g_slice_new0(maps_place_s);
@@ -112,6 +113,7 @@ EXPORT_API int maps_place_create(maps_place_h *place)
 
 EXPORT_API int maps_place_destroy(maps_place_h place)
 {
+       MAPS_LOG_API;
        if (!place)
                return MAPS_ERROR_INVALID_PARAMETER;
 
@@ -177,7 +179,7 @@ EXPORT_API int maps_place_destroy(maps_place_h place)
                maps_place_link_object_destroy(p->related);
 
        if (p->supported_data)
-               maps_item_hashtable_destroy(p->supported_data);
+               maps_int_hashtable_destroy(p->supported_data);
 
        g_slice_free(maps_place_s, place);
        return MAPS_ERROR_NONE;
@@ -186,6 +188,7 @@ EXPORT_API int maps_place_destroy(maps_place_h place)
 EXPORT_API int maps_place_clone(const maps_place_h origin,
                                maps_place_h *cloned)
 {
+       MAPS_LOG_API;
        if (!cloned || !origin)
                return MAPS_ERROR_INVALID_PARAMETER;
 
@@ -316,6 +319,7 @@ EXPORT_API int maps_place_clone(const maps_place_h origin,
 
 EXPORT_API int maps_place_get_id(const maps_place_h place, char **id)
 {
+       MAPS_LOG_API;
        if (!place || !id)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_place_s *) place)->id,
@@ -324,6 +328,7 @@ EXPORT_API int maps_place_get_id(const maps_place_h place, char **id)
 
 EXPORT_API int maps_place_get_name(const maps_place_h place, char **name)
 {
+       MAPS_LOG_API;
        if (!place || !name)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_place_s *) place)->name,
@@ -332,6 +337,7 @@ EXPORT_API int maps_place_get_name(const maps_place_h place, char **name)
 
 EXPORT_API int maps_place_get_uri(const maps_place_h place, char **uri)
 {
+       MAPS_LOG_API;
        if (!place || !uri)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_place_s *) place)->uri,
@@ -341,6 +347,7 @@ EXPORT_API int maps_place_get_uri(const maps_place_h place, char **uri)
 EXPORT_API int maps_place_get_location(const maps_place_h place,
                                       maps_coordinates_h *location)
 {
+       MAPS_LOG_API;
        if (!place || !location)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_coordinates_clone(((maps_place_s *) place)->location,
@@ -349,6 +356,7 @@ EXPORT_API int maps_place_get_location(const maps_place_h place,
 
 EXPORT_API int maps_place_get_distance(const maps_place_h place, int *distance)
 {
+       MAPS_LOG_API;
        if (!place || !distance)
                return MAPS_ERROR_INVALID_PARAMETER;
        *distance = ((maps_place_s *) place)->distance;
@@ -358,20 +366,38 @@ EXPORT_API int maps_place_get_distance(const maps_place_h place, int *distance)
 EXPORT_API int maps_place_get_address(const maps_place_h place,
                                      maps_address_h *address)
 {
-       if (!place || !address)
+       MAPS_LOG_API;
+       /* Check if the handle of the Place is valid */
+       if (!place)
                return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Check if this API feature available */
        if (!__is_supported(place, MAPS_PLACE_ADDRESS))
                return MAPS_ERROR_NOT_SUPPORTED;
+
+       /* Check if parameters are valid */
+       if (!address)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
        return maps_address_clone(((maps_place_s *) place)->address, address);
 }
 
 EXPORT_API int maps_place_get_rating(const maps_place_h place,
                                     maps_place_rating_h *rating)
 {
-       if (!place || !rating)
+
+       /* Check if the handle of the Place is valid */
+       if (!place)
                return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Check if this API feature available */
        if (!__is_supported(place, MAPS_PLACE_RATING))
                return MAPS_ERROR_NOT_SUPPORTED;
+
+       /* Check if parameters are valid */
+       if (!rating)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
        return maps_place_rating_clone(((maps_place_s *) place)->rating,
                rating);
 }
@@ -380,6 +406,7 @@ EXPORT_API int maps_place_foreach_property(const maps_place_h place,
                                           maps_place_properties_cb callback,
                                           void *user_data)
 {
+       MAPS_LOG_API;
        if (!place || !callback)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_item_hashtable_foreach(((maps_place_s *) place)->properties,
@@ -390,10 +417,19 @@ EXPORT_API int maps_place_foreach_category(const maps_place_h place,
                                           maps_place_categories_cb callback,
                                           void *user_data)
 {
-       if (!place || !callback)
+       MAPS_LOG_API;
+       /* Check if the handle of the Place is valid */
+       if (!place)
                return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Check if this API feature available */
        if (!__is_supported(place, MAPS_PLACE_CATEGORIES))
                return MAPS_ERROR_NOT_SUPPORTED;
+
+       /* Check if parameters are valid */
+       if (!callback)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
        return maps_item_list_foreach(((maps_place_s *) place)->categories,
                maps_place_category_clone, callback, user_data);
 }
@@ -402,10 +438,19 @@ EXPORT_API int maps_place_foreach_attribute(const maps_place_h place,
                                            maps_place_attributes_cb callback,
                                            void * user_data)
 {
-       if (!place || !callback)
+       MAPS_LOG_API;
+       /* Check if the handle of the Place is valid */
+       if (!place)
                return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Check if this API feature available */
        if (!__is_supported(place, MAPS_PLACE_ATTRIBUTES))
                return MAPS_ERROR_NOT_SUPPORTED;
+
+       /* Check if parameters are valid */
+       if (!callback)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
        return maps_item_list_foreach(((maps_place_s *) place)->attribute,
                maps_place_attribute_clone, callback, user_data);
 }
@@ -414,10 +459,19 @@ EXPORT_API int maps_place_foreach_contact(const maps_place_h place,
                                          maps_place_contacts_cb callback,
                                          void *user_data)
 {
-       if (!place || !callback)
+       MAPS_LOG_API;
+       /* Check if the handle of the Place is valid */
+       if (!place)
                return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Check if this API feature available */
        if (!__is_supported(place, MAPS_PLACE_CONTACTS))
                return MAPS_ERROR_NOT_SUPPORTED;
+
+       /* Check if parameters are valid */
+       if (!callback)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
        return maps_item_list_foreach(((maps_place_s *) place)->contacts,
                maps_place_contact_clone, callback, user_data);
 }
@@ -426,10 +480,19 @@ EXPORT_API int maps_place_foreach_editorial(const maps_place_h place,
                                            maps_place_editorials_cb callback,
                                            void *user_data)
 {
-       if (!place || !callback)
+       MAPS_LOG_API;
+       /* Check if the handle of the Place is valid */
+       if (!place)
                return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Check if this API feature available */
        if (!__is_supported(place, MAPS_PLACE_EDITORIALS))
                return MAPS_ERROR_NOT_SUPPORTED;
+
+       /* Check if parameters are valid */
+       if (!callback)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
        return maps_item_list_foreach(((maps_place_s *) place)->editorials,
                maps_place_editorial_clone, callback, user_data);
 }
@@ -438,10 +501,19 @@ EXPORT_API int maps_place_foreach_image(const maps_place_h place,
                                        maps_place_images_cb callback,
                                        void *user_data)
 {
-       if (!place || !callback)
+       MAPS_LOG_API;
+       /* Check if the handle of the Place is valid */
+       if (!place)
                return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Check if this API feature available */
        if (!__is_supported(place, MAPS_PLACE_IMAGE))
                return MAPS_ERROR_NOT_SUPPORTED;
+
+       /* Check if parameters are valid */
+       if (!callback)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
        return maps_item_list_foreach(((maps_place_s *) place)->images,
                maps_place_image_clone, callback, user_data);
 }
@@ -450,10 +522,19 @@ EXPORT_API int maps_place_foreach_review(const maps_place_h place,
                                         maps_place_reviews_cb callback,
                                         void *user_data)
 {
-       if (!place || !callback)
+       MAPS_LOG_API;
+       /* Check if the handle of the Place is valid */
+       if (!place)
                return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Check if this API feature available */
        if (!__is_supported(place, MAPS_PLACE_REVIEWS))
                return MAPS_ERROR_NOT_SUPPORTED;
+
+       /* Check if parameters are valid */
+       if (!callback)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
        return maps_item_list_foreach(((maps_place_s *) place)->reviews,
                maps_place_review_clone, callback, user_data);
 }
@@ -461,10 +542,19 @@ EXPORT_API int maps_place_foreach_review(const maps_place_h place,
 EXPORT_API int maps_place_get_supplier_link(const maps_place_image_h place,
                                            maps_place_link_object_h *supplier)
 {
-       if (!place || !supplier)
+       MAPS_LOG_API;
+       /* Check if the handle of the Place is valid */
+       if (!place)
                return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Check if this API feature available */
        if (!__is_supported(place, MAPS_PLACE_SUPPLIER))
                return MAPS_ERROR_NOT_SUPPORTED;
+
+       /* Check if parameters are valid */
+       if (!supplier)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
        return maps_place_link_object_clone(((maps_place_s *) place)->supplier,
                supplier);
 }
@@ -472,10 +562,19 @@ EXPORT_API int maps_place_get_supplier_link(const maps_place_image_h place,
 EXPORT_API int maps_place_get_related_link(const maps_place_image_h place,
                                           maps_place_link_object_h *related)
 {
-       if (!place || !related)
+       MAPS_LOG_API;
+       /* Check if the handle of the Place is valid */
+       if (!place)
                return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Check if this API feature available */
        if (!__is_supported(place, MAPS_PLACE_RELATED))
                return MAPS_ERROR_NOT_SUPPORTED;
+
+       /* Check if parameters are valid */
+       if (!related)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
        return maps_place_link_object_clone(((maps_place_s *) place)->related,
                related);
 }
@@ -486,7 +585,8 @@ int _maps_place_is_data_supported(const maps_place_h place,
        if (!place || !supported)
                return MAPS_ERROR_INVALID_PARAMETER;
 
-       if (!((maps_place_s*) place)->supported_data) {
+       maps_place_s *p = (maps_place_s *)place;
+       if (!p->supported_data) {
                /* This is a case when the "supported" flags are not set yet */
                /* No need to limit access to fields */
                *supported = true;
@@ -494,49 +594,14 @@ int _maps_place_is_data_supported(const maps_place_h place,
        }
 
        *supported = false;
-       string data_feature;
-       switch (data) {
-       case MAPS_PLACE_ADDRESS:
-               data_feature = _S(MAPS_PLACE_ADDRESS);
-               break;
-       case MAPS_PLACE_RATING:
-               data_feature = _S(MAPS_PLACE_RATING);
-               break;
-       case MAPS_PLACE_CATEGORIES:
-               data_feature = _S(MAPS_PLACE_CATEGORIES);
-               break;
-       case MAPS_PLACE_ATTRIBUTES:
-               data_feature = _S(MAPS_PLACE_ATTRIBUTES);
-               break;
-       case MAPS_PLACE_CONTACTS:
-               data_feature = _S(MAPS_PLACE_CONTACTS);
-               break;
-       case MAPS_PLACE_EDITORIALS:
-               data_feature = _S(MAPS_PLACE_EDITORIALS);
-               break;
-       case MAPS_PLACE_REVIEWS:
-               data_feature = _S(MAPS_PLACE_REVIEWS);
-               break;
-       case MAPS_PLACE_IMAGE:
-               data_feature = _S(MAPS_PLACE_IMAGE);
-               break;
-       case MAPS_PLACE_SUPPLIER:
-               data_feature = _S(MAPS_PLACE_SUPPLIER);
-               break;
-       case MAPS_PLACE_RELATED:
-               data_feature = _S(MAPS_PLACE_RELATED);
-               break;
-       default:
-               return MAPS_ERROR_NOT_SUPPORTED;
-       }
-       return maps_string_hashtable_contains(((maps_place_s *) place)->
-               supported_data, data_feature.c_str(), supported);
+       return maps_int_hashtable_contains(p->supported_data, data, supported);
 }
 
 /*----------------------------------------------------------------------------*/
 
 EXPORT_API int maps_place_set_id(maps_place_h place, const char *id)
 {
+       MAPS_LOG_API;
        if (!place || !id)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(id, _MAPS_PLACE_ID_MAX_LENGTH,
@@ -545,6 +610,7 @@ EXPORT_API int maps_place_set_id(maps_place_h place, const char *id)
 
 EXPORT_API int maps_place_set_name(maps_place_h place, const char *name)
 {
+       MAPS_LOG_API;
        if (!place || !name)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(name, _MAPS_PLACE_NAME_MAX_LENGTH,
@@ -553,6 +619,7 @@ EXPORT_API int maps_place_set_name(maps_place_h place, const char *name)
 
 EXPORT_API int maps_place_set_uri(maps_place_h place, const char *uri)
 {
+       MAPS_LOG_API;
        if (!place || !uri)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(uri, _MAPS_PLACE_URI_MAX_LENGTH,
@@ -562,6 +629,7 @@ EXPORT_API int maps_place_set_uri(maps_place_h place, const char *uri)
 EXPORT_API int maps_place_set_location(maps_place_h place,
        const maps_coordinates_h location)
 {
+       MAPS_LOG_API;
        if (!place || !location)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_place_s *p = (maps_place_s *) place;
@@ -572,6 +640,7 @@ EXPORT_API int maps_place_set_location(maps_place_h place,
 
 EXPORT_API int maps_place_set_distance(maps_place_h place, const int distance)
 {
+       MAPS_LOG_API;
        if (!place)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_place_s *p = (maps_place_s *) place;
@@ -582,6 +651,7 @@ EXPORT_API int maps_place_set_distance(maps_place_h place, const int distance)
 EXPORT_API int maps_place_set_address(maps_place_h place,
                                      const maps_address_h address)
 {
+       MAPS_LOG_API;
        if (!place || !address)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_place_s *p = (maps_place_s *) place;
@@ -593,6 +663,7 @@ EXPORT_API int maps_place_set_address(maps_place_h place,
 EXPORT_API int maps_place_set_categories(maps_place_h place,
                                         const maps_item_list_h categories)
 {
+       MAPS_LOG_API;
        if (!place || !categories)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_place_s *p = (maps_place_s *) place;
@@ -608,6 +679,7 @@ EXPORT_API int maps_place_set_categories(maps_place_h place,
 EXPORT_API int maps_place_set_attributes(maps_place_h place,
                                         const maps_item_list_h attributes)
 {
+       MAPS_LOG_API;
        if (!place || !attributes)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_place_s *p = (maps_place_s *) place;
@@ -623,6 +695,7 @@ EXPORT_API int maps_place_set_attributes(maps_place_h place,
 EXPORT_API int maps_place_set_contacts(maps_place_h place,
                                       const maps_item_list_h contacts)
 {
+       MAPS_LOG_API;
        if (!place || !contacts)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_place_s *p = (maps_place_s *) place;
@@ -638,6 +711,7 @@ EXPORT_API int maps_place_set_contacts(maps_place_h place,
 EXPORT_API int maps_place_set_editorials(maps_place_h place,
                                         const maps_item_list_h editorials)
 {
+       MAPS_LOG_API;
        if (!place || !editorials)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_place_s *p = (maps_place_s *) place;
@@ -653,6 +727,7 @@ EXPORT_API int maps_place_set_editorials(maps_place_h place,
 EXPORT_API int maps_place_set_images(maps_place_h place,
                                     const maps_item_list_h images)
 {
+       MAPS_LOG_API;
        if (!place || !images)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_place_s *p = (maps_place_s *) place;
@@ -666,6 +741,7 @@ EXPORT_API int maps_place_set_images(maps_place_h place,
 EXPORT_API int maps_place_set_reviews(maps_place_h place,
                                      const maps_item_list_h reviews)
 {
+       MAPS_LOG_API;
        if (!place || !reviews)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_place_s *p = (maps_place_s *) place;
@@ -681,6 +757,7 @@ EXPORT_API int maps_place_set_reviews(maps_place_h place,
 EXPORT_API int maps_place_set_properties(maps_place_h place,
                                         const maps_item_hashtable_h properties)
 {
+       MAPS_LOG_API;
        if (!place || !properties)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_place_s *p = (maps_place_s *) place;
@@ -692,6 +769,7 @@ EXPORT_API int maps_place_set_properties(maps_place_h place,
 EXPORT_API int maps_place_set_rating(maps_place_h place,
                                     const maps_place_rating_h rating)
 {
+       MAPS_LOG_API;
        if (!place || !rating)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_place_s *p = (maps_place_s *) place;
@@ -704,6 +782,7 @@ EXPORT_API int maps_place_set_supplier_link(maps_place_h place,
                                            const maps_place_link_object_h
                                            supplier)
 {
+       MAPS_LOG_API;
        if (!place || !supplier)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_place_s *p = (maps_place_s *) place;
@@ -716,6 +795,7 @@ EXPORT_API int maps_place_set_related_link(maps_place_h place,
                                           const maps_place_link_object_h
                                           related)
 {
+       MAPS_LOG_API;
        if (!place || !related)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_place_s *p = (maps_place_s *) place;
@@ -725,12 +805,12 @@ EXPORT_API int maps_place_set_related_link(maps_place_h place,
 }
 
 int _maps_place_set_supported_data(maps_place_h place,
-                                  const maps_string_hashtable_h supported_data)
+                                  const maps_int_hashtable_h supported_data)
 {
        if (!place || !supported_data)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_place_s *p = (maps_place_s *) place;
        if (p->supported_data)
-               maps_string_hashtable_destroy(p->supported_data);
-       return maps_string_hashtable_clone(supported_data, &p->supported_data);
+               maps_int_hashtable_destroy(p->supported_data);
+       return maps_int_hashtable_clone(supported_data, &p->supported_data);
 }
index 975ce7adf9ac362beeeeaccf38cf83a809fdf1db..fbc7865d57493c7a6b2c2735111684e34a7957b8 100755 (executable)
@@ -33,6 +33,7 @@ const gsize _MAPS_PLACE_ATTRIBUTE_TEXT_MAX_LENGTH = 512;
 
 EXPORT_API int maps_place_attribute_create(maps_place_attribute_h *place)
 {
+       MAPS_LOG_API;
        if (!place)
                return MAPS_ERROR_INVALID_PARAMETER;
        *place = (maps_place_attribute_h) g_slice_new0(maps_place_attribute_s);
@@ -47,6 +48,7 @@ EXPORT_API int maps_place_attribute_create(maps_place_attribute_h *place)
 
 EXPORT_API int maps_place_attribute_destroy(maps_place_attribute_h place)
 {
+       MAPS_LOG_API;
        if (!place)
                return MAPS_ERROR_INVALID_PARAMETER;
 
@@ -66,6 +68,7 @@ EXPORT_API int maps_place_attribute_destroy(maps_place_attribute_h place)
 EXPORT_API int maps_place_attribute_clone(const maps_place_attribute_h origin,
                                          maps_place_attribute_h *cloned)
 {
+       MAPS_LOG_API;
        if (!cloned || !origin)
                return MAPS_ERROR_INVALID_PARAMETER;
 
@@ -109,6 +112,7 @@ EXPORT_API int maps_place_attribute_clone(const maps_place_attribute_h origin,
 EXPORT_API int maps_place_attribute_get_id(const maps_place_attribute_h place,
                                           char **id)
 {
+       MAPS_LOG_API;
        if (!place || !id)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_place_attribute_s *) place)->id,
@@ -118,6 +122,7 @@ EXPORT_API int maps_place_attribute_get_id(const maps_place_attribute_h place,
 EXPORT_API int maps_place_attribute_get_text(const maps_place_attribute_h place,
                                             char **text)
 {
+       MAPS_LOG_API;
        if (!place || !text)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_place_attribute_s *) place)->text,
@@ -127,6 +132,7 @@ EXPORT_API int maps_place_attribute_get_text(const maps_place_attribute_h place,
 EXPORT_API int maps_place_attribute_get_label(const maps_place_attribute_h
                                              place, char **label)
 {
+       MAPS_LOG_API;
        if (!place || !label)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_place_attribute_s *) place)->label,
@@ -138,6 +144,7 @@ EXPORT_API int maps_place_attribute_get_label(const maps_place_attribute_h
 EXPORT_API int maps_place_attribute_set_id(maps_place_attribute_h place,
                                           const char * id)
 {
+       MAPS_LOG_API;
        if (!place || !id)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(id, _MAPS_PLACE_ATTRIBUTE_ID_MAX_LENGTH,
@@ -147,6 +154,7 @@ EXPORT_API int maps_place_attribute_set_id(maps_place_attribute_h place,
 EXPORT_API int maps_place_attribute_set_label(maps_place_attribute_h place,
                                              const char *label)
 {
+       MAPS_LOG_API;
        if (!place || !label)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(label, _MAPS_PLACE_ATTRIBUTE_LABEL_MAX_LENGTH,
@@ -156,6 +164,7 @@ EXPORT_API int maps_place_attribute_set_label(maps_place_attribute_h place,
 EXPORT_API int maps_place_attribute_set_text(maps_place_attribute_h place,
                                             const char *text)
 {
+       MAPS_LOG_API;
        if (!place || !text)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(text, _MAPS_PLACE_ATTRIBUTE_TEXT_MAX_LENGTH,
index 130cac21a0150ffc98dfa98820d85a84796df82c..db6fb3cbecbbc76d1a59b7b62b0939b90b7d754d 100755 (executable)
@@ -34,6 +34,7 @@ const gsize _MAPS_PLACE_CATEGORY_URL_MAX_LENGTH = 128;
 
 EXPORT_API int maps_place_category_create(maps_place_category_h *place)
 {
+       MAPS_LOG_API;
        if (!place)
                return MAPS_ERROR_INVALID_PARAMETER;
        *place = g_slice_new0(maps_place_category_s);
@@ -48,6 +49,7 @@ EXPORT_API int maps_place_category_create(maps_place_category_h *place)
 
 EXPORT_API int maps_place_category_destroy(maps_place_category_h place)
 {
+       MAPS_LOG_API;
        if (!place)
                return MAPS_ERROR_INVALID_PARAMETER;
        int error = MAPS_ERROR_NONE;
@@ -68,6 +70,7 @@ EXPORT_API int maps_place_category_destroy(maps_place_category_h place)
 EXPORT_API int maps_place_category_clone(const maps_place_category_h origin,
                                         maps_place_category_h *cloned)
 {
+       MAPS_LOG_API;
        if (!cloned || !origin)
                return MAPS_ERROR_INVALID_PARAMETER;
 
@@ -112,6 +115,7 @@ EXPORT_API int maps_place_category_clone(const maps_place_category_h origin,
 EXPORT_API int maps_place_category_get_name(const maps_place_category_h place,
                                            char **name)
 {
+       MAPS_LOG_API;
        if (!place || !name)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_place_category_s *) place)->name,
@@ -121,6 +125,7 @@ EXPORT_API int maps_place_category_get_name(const maps_place_category_h place,
 EXPORT_API int maps_place_category_get_id(const maps_place_category_h place,
                                          char **id)
 {
+       MAPS_LOG_API;
        if (!place || !id)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_place_category_s *) place)->id,
@@ -130,6 +135,7 @@ EXPORT_API int maps_place_category_get_id(const maps_place_category_h place,
 EXPORT_API int maps_place_category_get_url(const maps_place_category_h place,
                                           char **url)
 {
+       MAPS_LOG_API;
        if (!place || !url)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_place_category_s *) place)->url,
@@ -141,6 +147,7 @@ EXPORT_API int maps_place_category_get_url(const maps_place_category_h place,
 EXPORT_API int maps_place_category_set_id(maps_place_category_h place,
                                          const char *id)
 {
+       MAPS_LOG_API;
        if (!place || !id)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(id, _MAPS_PLACE_CATEGORY_ID_MAX_LENGTH,
@@ -150,6 +157,7 @@ EXPORT_API int maps_place_category_set_id(maps_place_category_h place,
 EXPORT_API int maps_place_category_set_name(maps_place_category_h place,
                                            const char *name)
 {
+       MAPS_LOG_API;
        if (!place || !name)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(name, _MAPS_PLACE_CATEGORY_NAME_MAX_LENGTH,
@@ -159,6 +167,7 @@ EXPORT_API int maps_place_category_set_name(maps_place_category_h place,
 EXPORT_API int maps_place_category_set_url(maps_place_category_h place,
                                           const char *url)
 {
+       MAPS_LOG_API;
        if (!place || !url)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(url, _MAPS_PLACE_CATEGORY_URL_MAX_LENGTH,
index ae771bf00c23324885e4a6748b9afffbc0065950..d16bc644a1c6cff66a1acd1b8437ef448dd58ee7 100755 (executable)
@@ -33,6 +33,7 @@ const gsize _MAPS_PLACE_CONTACT_VALUE_MAX_LENGTH = 512;
 
 EXPORT_API int maps_place_contact_create(maps_place_contact_h *place)
 {
+       MAPS_LOG_API;
        if (!place)
                return MAPS_ERROR_INVALID_PARAMETER;
        *place = (maps_place_contact_h) g_slice_new0(maps_place_contact_s);
@@ -47,6 +48,7 @@ EXPORT_API int maps_place_contact_create(maps_place_contact_h *place)
 
 EXPORT_API int maps_place_contact_destroy(maps_place_contact_h place)
 {
+       MAPS_LOG_API;
        if (!place)
                return MAPS_ERROR_INVALID_PARAMETER;
 
@@ -66,6 +68,7 @@ EXPORT_API int maps_place_contact_destroy(maps_place_contact_h place)
 EXPORT_API int maps_place_contact_clone(const maps_place_contact_h origin,
                                        maps_place_contact_h *cloned)
 {
+       MAPS_LOG_API;
        if (!cloned || !origin)
                return MAPS_ERROR_INVALID_PARAMETER;
 
@@ -108,6 +111,7 @@ EXPORT_API int maps_place_contact_clone(const maps_place_contact_h origin,
 EXPORT_API int maps_place_contact_get_label(const maps_place_contact_h place,
                                            char **label)
 {
+       MAPS_LOG_API;
        if (!place || !label)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_place_contact_s *) place)->label,
@@ -117,6 +121,7 @@ EXPORT_API int maps_place_contact_get_label(const maps_place_contact_h place,
 EXPORT_API int maps_place_contact_get_type(const maps_place_contact_h place,
                                           char **type)
 {
+       MAPS_LOG_API;
        if (!place || !type)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_place_contact_s *) place)->type,
@@ -126,6 +131,7 @@ EXPORT_API int maps_place_contact_get_type(const maps_place_contact_h place,
 EXPORT_API int maps_place_contact_get_value(const maps_place_contact_h place,
                                            char **value)
 {
+       MAPS_LOG_API;
        if (!place || !value)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_place_contact_s *) place)->value,
@@ -137,6 +143,7 @@ EXPORT_API int maps_place_contact_get_value(const maps_place_contact_h place,
 EXPORT_API int maps_place_contact_set_label(maps_place_contact_h place,
                                            const char *label)
 {
+       MAPS_LOG_API;
        if (!place || !label)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(label, _MAPS_PLACE_CONTACT_LABEL_MAX_LENGTH,
@@ -146,6 +153,7 @@ EXPORT_API int maps_place_contact_set_label(maps_place_contact_h place,
 EXPORT_API int maps_place_contact_set_type(maps_place_contact_h place,
                                           const char *type)
 {
+       MAPS_LOG_API;
        if (!place || !type)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(type, _MAPS_PLACE_CONTACT_TYPE_MAX_LENGTH,
@@ -155,6 +163,7 @@ EXPORT_API int maps_place_contact_set_type(maps_place_contact_h place,
 EXPORT_API int maps_place_contact_set_value(maps_place_contact_h place,
                                            const char *value)
 {
+       MAPS_LOG_API;
        if (!place || !value)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(value, _MAPS_PLACE_CONTACT_VALUE_MAX_LENGTH,
index 2413263021197cf6955b1d249088ef2be891af5e..0e65e05a8fe86a702f9fdf432d3162c1b0dee792 100755 (executable)
@@ -33,6 +33,7 @@ const gsize _MAPS_PLACE_EDITORIAL_LANGUAGE_MAX_LENGTH = 32;
 
 EXPORT_API int maps_place_editorial_create(maps_place_editorial_h *place)
 {
+       MAPS_LOG_API;
        if (!place)
                return MAPS_ERROR_INVALID_PARAMETER;
        *place = (maps_place_editorial_h) g_slice_new0(maps_place_editorial_s);
@@ -47,6 +48,7 @@ EXPORT_API int maps_place_editorial_create(maps_place_editorial_h *place)
 
 EXPORT_API int maps_place_editorial_destroy(maps_place_editorial_h place)
 {
+       MAPS_LOG_API;
        if (!place)
                return MAPS_ERROR_INVALID_PARAMETER;
 
@@ -67,6 +69,7 @@ EXPORT_API int maps_place_editorial_destroy(maps_place_editorial_h place)
 EXPORT_API int maps_place_editorial_clone(const maps_place_editorial_h origin,
                                          maps_place_editorial_h *cloned)
 {
+       MAPS_LOG_API;
        if (!cloned || !origin)
                return MAPS_ERROR_INVALID_PARAMETER;
 
@@ -115,6 +118,7 @@ EXPORT_API int maps_place_editorial_get_description(const maps_place_editorial_h
                                                    place,
                                                    char **description)
 {
+       MAPS_LOG_API;
        if (!place || !description)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_place_editorial_s *) place)->description,
@@ -125,6 +129,7 @@ EXPORT_API int maps_place_editorial_get_language(const maps_place_editorial_h
                                                 place,
                                                 char **language)
 {
+       MAPS_LOG_API;
        if (!place || !language)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_place_editorial_s *) place)->language,
@@ -135,6 +140,7 @@ EXPORT_API int maps_place_editorial_get_media(const maps_place_editorial_h
                                              place,
                                              maps_place_media_h *media)
 {
+       MAPS_LOG_API;
        if (!place || !media)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_place_media_clone(((maps_place_editorial_s *) place)->media,
@@ -147,6 +153,7 @@ EXPORT_API int maps_place_editorial_set_description(maps_place_editorial_h
                                                    place,
                                                    const char *description)
 {
+       MAPS_LOG_API;
        if (!place || !description)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(description,
@@ -157,6 +164,7 @@ EXPORT_API int maps_place_editorial_set_description(maps_place_editorial_h
 EXPORT_API int maps_place_editorial_set_language(maps_place_editorial_h place,
                                                 const char *language)
 {
+       MAPS_LOG_API;
        if (!place || !language)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(language,
@@ -167,6 +175,7 @@ EXPORT_API int maps_place_editorial_set_language(maps_place_editorial_h place,
 EXPORT_API int maps_place_editorial_set_media(maps_place_editorial_h place,
        const maps_place_media_h media)
 {
+       MAPS_LOG_API;
        if (!place || !media)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_place_editorial_s *e = (maps_place_editorial_s *) place;
index f1170605fa7baa46221af394eab907a842aded02..81324b7194df778fda757128c5afc733fd59dd0b 100755 (executable)
@@ -29,6 +29,7 @@ typedef struct _maps_place_filter_s
 
 EXPORT_API int maps_place_filter_create(maps_place_filter_h *filter)
 {
+       MAPS_LOG_API;
        if (!filter)
                return MAPS_ERROR_INVALID_PARAMETER;
        *filter = (maps_place_filter_h) g_slice_new0(maps_place_filter_s);
@@ -46,6 +47,7 @@ EXPORT_API int maps_place_filter_create(maps_place_filter_h *filter)
 
 EXPORT_API int maps_place_filter_destroy(maps_place_filter_h filter)
 {
+       MAPS_LOG_API;
        if (!filter)
                return MAPS_ERROR_INVALID_PARAMETER;
 
@@ -61,6 +63,7 @@ EXPORT_API int maps_place_filter_destroy(maps_place_filter_h filter)
 EXPORT_API int maps_place_filter_clone(const maps_place_filter_h origin,
                                       maps_place_filter_h *cloned)
 {
+       MAPS_LOG_API;
        if (!cloned || !origin)
                return MAPS_ERROR_INVALID_PARAMETER;
 
@@ -98,6 +101,7 @@ EXPORT_API int maps_place_filter_clone(const maps_place_filter_h origin,
 EXPORT_API int maps_place_filter_get(const maps_place_filter_h filter,
                                     const char *key, char **value)
 {
+       MAPS_LOG_API;
        if (!filter)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_item_hashtable_get_string(((maps_place_filter_s *) filter)->
@@ -110,6 +114,7 @@ EXPORT_API int maps_place_filter_foreach_property(const maps_place_filter_h
                                                 callback,
                                                 void *user_data)
 {
+       MAPS_LOG_API;
        if (!filter || !callback)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_item_hashtable_foreach(((maps_place_filter_s *) filter)->
@@ -119,6 +124,7 @@ EXPORT_API int maps_place_filter_foreach_property(const maps_place_filter_h
 EXPORT_API int maps_place_filter_get_keyword(const maps_place_filter_h filter,
                                             char **keyword)
 {
+       MAPS_LOG_API;
        if (!filter || !keyword)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_item_hashtable_get_string(((maps_place_filter_s *) filter)->
@@ -129,6 +135,7 @@ EXPORT_API int maps_place_filter_get_place_name(const maps_place_filter_h
                                                filter,
                                                char **place_name)
 {
+       MAPS_LOG_API;
        if (!filter || !place_name)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_item_hashtable_get_string(((maps_place_filter_s *) filter)->
@@ -138,6 +145,7 @@ EXPORT_API int maps_place_filter_get_place_name(const maps_place_filter_h
 EXPORT_API int maps_place_filter_get_category(const maps_place_filter_h filter,
                                              maps_place_category_h *category)
 {
+       MAPS_LOG_API;
        if (!filter || !category)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_item_hashtable_get(((maps_place_filter_s *) filter)->table,
@@ -149,13 +157,14 @@ EXPORT_API int maps_place_filter_get_category(const maps_place_filter_h filter,
 EXPORT_API int maps_place_filter_set(maps_place_filter_h filter,
                                     const char *key, const char *value)
 {
+       MAPS_LOG_API;
        if (!filter)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_item_hashtable_set_string(((maps_place_filter_s *) filter)->
                table, key, value);
 }
 
-int maps_place_filter_set_keyword(maps_place_filter_h filter,
+EXPORT_API int maps_place_filter_set_keyword(maps_place_filter_h filter,
                                  const char *keyword)
 {
        if (!filter || !keyword)
@@ -164,7 +173,7 @@ int maps_place_filter_set_keyword(maps_place_filter_h filter,
                table, "MAPS_PLACE_FILTER_KEYWORD", keyword);
 }
 
-int maps_place_filter_set_place_name(maps_place_filter_h filter,
+EXPORT_API int maps_place_filter_set_place_name(maps_place_filter_h filter,
                                     const char *place_name)
 {
        if (!filter || !place_name)
@@ -173,7 +182,7 @@ int maps_place_filter_set_place_name(maps_place_filter_h filter,
                table, "MAPS_PLACE_FILTER_PLACE_NAME", place_name);
 }
 
-int maps_place_filter_set_category(maps_place_filter_h filter,
+EXPORT_API int maps_place_filter_set_category(maps_place_filter_h filter,
                                   const maps_place_category_h category)
 {
        if (!filter || !category)
index f66b5dd2616d33f532ed661fafc572e3b2ad5a36..8e07a1248d67aa81043597bd28d7097882773d71 100755 (executable)
@@ -38,6 +38,7 @@ const gsize _MAPS_PLACE_IMAGE_URL_MAX_LENGTH = 128;
 
 EXPORT_API int maps_place_image_create(maps_place_image_h *place)
 {
+       MAPS_LOG_API;
        if (!place)
                return MAPS_ERROR_INVALID_PARAMETER;
        *place = (maps_place_image_h) g_slice_new0(maps_place_image_s);
@@ -52,6 +53,7 @@ EXPORT_API int maps_place_image_create(maps_place_image_h *place)
 
 EXPORT_API int maps_place_image_destroy(maps_place_image_h place)
 {
+       MAPS_LOG_API;
        if (!place)
                return MAPS_ERROR_INVALID_PARAMETER;
 
@@ -74,6 +76,7 @@ EXPORT_API int maps_place_image_destroy(maps_place_image_h place)
 EXPORT_API int maps_place_image_clone(const maps_place_image_h origin,
                                      maps_place_image_h *cloned)
 {
+       MAPS_LOG_API;
        if (!cloned || !origin)
                return MAPS_ERROR_INVALID_PARAMETER;
 
@@ -131,6 +134,7 @@ EXPORT_API int maps_place_image_clone(const maps_place_image_h origin,
 EXPORT_API int maps_place_image_get_url(const maps_place_image_h place,
                                        char **url)
 {
+       MAPS_LOG_API;
        if (!place || !url)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_place_image_s *) place)->url,
@@ -140,6 +144,7 @@ EXPORT_API int maps_place_image_get_url(const maps_place_image_h place,
 EXPORT_API int maps_place_image_get_id(const maps_place_image_h place,
                                       char **id)
 {
+       MAPS_LOG_API;
        if (!place || !id)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_place_image_s *) place)->id,
@@ -149,6 +154,7 @@ EXPORT_API int maps_place_image_get_id(const maps_place_image_h place,
 EXPORT_API int maps_place_image_get_width(const maps_place_image_h place,
                                          int *width)
 {
+       MAPS_LOG_API;
        if (!place || !width)
                return MAPS_ERROR_INVALID_PARAMETER;
        *width = ((maps_place_image_s *) place)->width;
@@ -158,6 +164,7 @@ EXPORT_API int maps_place_image_get_width(const maps_place_image_h place,
 EXPORT_API int maps_place_image_get_height(const maps_place_image_h place,
                                           int *height)
 {
+       MAPS_LOG_API;
        if (!place || !height)
                return MAPS_ERROR_INVALID_PARAMETER;
        *height = ((maps_place_image_s *) place)->height;
@@ -167,6 +174,7 @@ EXPORT_API int maps_place_image_get_height(const maps_place_image_h place,
 EXPORT_API int maps_place_image_get_user_link(const maps_place_image_h place,
                                              maps_place_link_object_h *user)
 {
+       MAPS_LOG_API;
        if (!place || !user)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_place_link_object_clone(((maps_place_image_s *) place)->
@@ -176,6 +184,7 @@ EXPORT_API int maps_place_image_get_user_link(const maps_place_image_h place,
 EXPORT_API int maps_place_image_get_media(const maps_place_image_h place,
                                          maps_place_media_h *media)
 {
+       MAPS_LOG_API;
        if (!place || !media)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_place_media_clone(((maps_place_image_s *) place)->media,
@@ -186,6 +195,7 @@ EXPORT_API int maps_place_image_get_media(const maps_place_image_h place,
 
 EXPORT_API int maps_place_image_set_id(maps_place_image_h place, const char *id)
 {
+       MAPS_LOG_API;
        if (!place || !id)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(id, _MAPS_PLACE_IMAGE_ID_MAX_LENGTH,
@@ -195,6 +205,7 @@ EXPORT_API int maps_place_image_set_id(maps_place_image_h place, const char *id)
 EXPORT_API int maps_place_image_set_url(maps_place_image_h place,
                                        const char *url)
 {
+       MAPS_LOG_API;
        if (!place || !url)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(url, _MAPS_PLACE_IMAGE_URL_MAX_LENGTH,
@@ -204,6 +215,7 @@ EXPORT_API int maps_place_image_set_url(maps_place_image_h place,
 EXPORT_API int maps_place_image_set_width(maps_place_image_h place,
                                          const int width)
 {
+       MAPS_LOG_API;
        if (!place || width < 0)
                return MAPS_ERROR_INVALID_PARAMETER;
        ((maps_place_image_s *) place)->width = width;
@@ -213,6 +225,7 @@ EXPORT_API int maps_place_image_set_width(maps_place_image_h place,
 EXPORT_API int maps_place_image_set_height(maps_place_image_h place,
                                           const int height)
 {
+       MAPS_LOG_API;
        if (!place || height < 0)
                return MAPS_ERROR_INVALID_PARAMETER;
        ((maps_place_image_s *) place)->height = height;
@@ -223,6 +236,7 @@ EXPORT_API int maps_place_image_set_user_link(maps_place_image_h place,
                                              const maps_place_link_object_h
                                              user)
 {
+       MAPS_LOG_API;
        if (!place || !user)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_place_image_s *i = (maps_place_image_s *) place;
@@ -234,6 +248,7 @@ EXPORT_API int maps_place_image_set_user_link(maps_place_image_h place,
 EXPORT_API int maps_place_image_set_media(maps_place_image_h place,
                                          const maps_place_media_h media)
 {
+       MAPS_LOG_API;
        if (!place || !media)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_place_image_s *i = (maps_place_image_s *) place;
index 59eb281e06e87e9fb20e91c174bb6920284a0eae..cca011886f0f66a24b3cf504133eaad00a7c4032 100755 (executable)
@@ -35,6 +35,7 @@ const gsize _MAPS_PLACE_LINK_OBJECT_STRING_MAX_LENGTH = 256;
 
 EXPORT_API int maps_place_link_object_create(maps_place_link_object_h *place)
 {
+       MAPS_LOG_API;
        if (!place)
                return MAPS_ERROR_INVALID_PARAMETER;
        *place = (maps_place_link_object_h)
@@ -50,6 +51,7 @@ EXPORT_API int maps_place_link_object_create(maps_place_link_object_h *place)
 
 EXPORT_API int maps_place_link_object_destroy(maps_place_link_object_h place)
 {
+       MAPS_LOG_API;
        if (!place)
                return MAPS_ERROR_INVALID_PARAMETER;
 
@@ -72,6 +74,7 @@ EXPORT_API int maps_place_link_object_clone(const maps_place_link_object_h
                                            origin, maps_place_link_object_h *
                                            cloned)
 {
+       MAPS_LOG_API;
        if (!cloned || !origin)
                return MAPS_ERROR_INVALID_PARAMETER;
 
@@ -125,6 +128,7 @@ EXPORT_API int maps_place_link_object_get_string(const maps_place_link_object_h
                                                 place,
                                                 char **string)
 {
+       MAPS_LOG_API;
        if (!place || !string)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_place_link_object_s *) place)->string,
@@ -135,6 +139,7 @@ EXPORT_API int maps_place_link_object_get_type(const maps_place_link_object_h
                                               place,
                                               char **type)
 {
+       MAPS_LOG_API;
        if (!place || !type)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_place_link_object_s *) place)->type,
@@ -145,6 +150,7 @@ EXPORT_API int maps_place_link_object_get_id(const maps_place_link_object_h
                                             place,
                                             char **id)
 {
+       MAPS_LOG_API;
        if (!place || !id)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_place_link_object_s *) place)->id,
@@ -154,6 +160,7 @@ EXPORT_API int maps_place_link_object_get_id(const maps_place_link_object_h
 EXPORT_API int maps_place_link_object_get_name(const maps_place_link_object_h
                                               place, char **name)
 {
+       MAPS_LOG_API;
        if (!place || !name)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_place_link_object_s *) place)->name,
@@ -165,6 +172,7 @@ EXPORT_API int maps_place_link_object_get_name(const maps_place_link_object_h
 EXPORT_API int maps_place_link_object_set_id(maps_place_link_object_h place,
                                             const char *id)
 {
+       MAPS_LOG_API;
        if (!place || !id)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(id, _MAPS_PLACE_LINK_OBJECT_ID_MAX_LENGTH,
@@ -174,6 +182,7 @@ EXPORT_API int maps_place_link_object_set_id(maps_place_link_object_h place,
 EXPORT_API int maps_place_link_object_set_string(maps_place_link_object_h place,
                                                 const char *string)
 {
+       MAPS_LOG_API;
        if (!place || !string)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(string,
@@ -184,6 +193,7 @@ EXPORT_API int maps_place_link_object_set_string(maps_place_link_object_h place,
 EXPORT_API int maps_place_link_object_set_type(maps_place_link_object_h place,
                                               const char *type)
 {
+       MAPS_LOG_API;
        if (!place || !type)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(type, _MAPS_PLACE_LINK_OBJECT_TYPE_MAX_LENGTH,
@@ -193,6 +203,7 @@ EXPORT_API int maps_place_link_object_set_type(maps_place_link_object_h place,
 EXPORT_API int maps_place_link_object_set_name(maps_place_link_object_h place,
                                               const char *name)
 {
+       MAPS_LOG_API;
        if (!place || !name)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(name, _MAPS_PLACE_LINK_OBJECT_NAME_MAX_LENGTH,
index ef43511353def0a16b961d09e6b9eb4f870ad191..5e3685c38f051d95cdfc309781e254785e3b7d44 100755 (executable)
@@ -32,6 +32,7 @@ const gsize _MAPS_PLACE_MEDIA_ATTRIBUTION_MAX_LENGTH = 64;
 
 EXPORT_API int maps_place_media_create(maps_place_media_h *place)
 {
+       MAPS_LOG_API;
        if (!place)
                return MAPS_ERROR_INVALID_PARAMETER;
        *place = (maps_place_media_h) g_slice_new0(maps_place_media_s);
@@ -46,6 +47,7 @@ EXPORT_API int maps_place_media_create(maps_place_media_h *place)
 
 EXPORT_API int maps_place_media_destroy(maps_place_media_h place)
 {
+       MAPS_LOG_API;
        if (!place)
                return MAPS_ERROR_INVALID_PARAMETER;
 
@@ -65,6 +67,7 @@ EXPORT_API int maps_place_media_destroy(maps_place_media_h place)
 EXPORT_API int maps_place_media_clone(const maps_place_media_h origin,
                                      maps_place_media_h *cloned)
 {
+       MAPS_LOG_API;
        if (!cloned || !origin)
                return MAPS_ERROR_INVALID_PARAMETER;
 
@@ -109,6 +112,7 @@ EXPORT_API int maps_place_media_clone(const maps_place_media_h origin,
 EXPORT_API int maps_place_media_get_attribution(const maps_place_media_h place,
                                                char **attribution)
 {
+       MAPS_LOG_API;
        if (!place || !attribution)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_place_media_s *) place)->attribution,
@@ -118,6 +122,7 @@ EXPORT_API int maps_place_media_get_attribution(const maps_place_media_h place,
 EXPORT_API int maps_place_media_get_supplier(const maps_place_media_h place,
                                             maps_place_link_object_h *supplier)
 {
+       MAPS_LOG_API;
        if (!place || !supplier)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_place_link_object_clone(((maps_place_media_s *) place)->
@@ -127,6 +132,7 @@ EXPORT_API int maps_place_media_get_supplier(const maps_place_media_h place,
 EXPORT_API int maps_place_media_get_via(const maps_place_media_h place,
                                        maps_place_link_object_h * via)
 {
+       MAPS_LOG_API;
        if (!place || !via)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_place_link_object_clone(((maps_place_media_s *) place)->via,
@@ -138,6 +144,7 @@ EXPORT_API int maps_place_media_get_via(const maps_place_media_h place,
 EXPORT_API int maps_place_media_set_attribution(maps_place_media_h place,
                                                const char *attribution)
 {
+       MAPS_LOG_API;
        if (!place || !attribution)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(attribution,
@@ -149,6 +156,7 @@ EXPORT_API int maps_place_media_set_supplier(maps_place_media_h place,
                                             const maps_place_link_object_h
                                             supplier)
 {
+       MAPS_LOG_API;
        if (!place || !supplier)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_place_media_s *m = (maps_place_media_s *) place;
@@ -160,6 +168,7 @@ EXPORT_API int maps_place_media_set_supplier(maps_place_media_h place,
 EXPORT_API int maps_place_media_set_via(maps_place_media_h place,
                                        const maps_place_link_object_h via)
 {
+       MAPS_LOG_API;
        if (!place || !via)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_place_media_s *m = (maps_place_media_s *) place;
index a4330d666aba15e939f1a6b31e9b087a0c5a730e..34f06ed28df7e15f85a0f4a99458a1c7369f37ff 100755 (executable)
@@ -18,7 +18,7 @@
 #define __MAPS_PLACE_PRIVATE_H__
 
 #include <maps_service.h>
-#include <maps_extra_types.h>
+#include "maps_extra_types_private.h"
 
 /**
  * @ingroup    CAPI_MAPS_PLACE_MODULE
@@ -74,8 +74,7 @@ int _maps_place_is_data_supported(const maps_place_h place,
  * @see maps_place_create()
  */
 int _maps_place_set_supported_data(maps_place_h place,
-                                  const maps_string_hashtable_h
-                                  supported_data);
+                                  const maps_int_hashtable_h supported_data);
 
 #ifdef __cplusplus
 }
index 91986cee6342346378eb470daec27438839935f6..174b1c7e4fe7f847f941856a081a13437013a60e 100755 (executable)
@@ -28,6 +28,7 @@ typedef struct _maps_place_rating_s
 
 EXPORT_API int maps_place_rating_create(maps_place_rating_h *place)
 {
+       MAPS_LOG_API;
        if (!place)
                return MAPS_ERROR_INVALID_PARAMETER;
        *place = (maps_place_rating_h) g_slice_new0(maps_place_rating_s);
@@ -42,6 +43,7 @@ EXPORT_API int maps_place_rating_create(maps_place_rating_h *place)
 
 EXPORT_API int maps_place_rating_destroy(maps_place_rating_h place)
 {
+       MAPS_LOG_API;
        if (!place)
                return MAPS_ERROR_INVALID_PARAMETER;
        g_slice_free(maps_place_rating_s, place);
@@ -51,6 +53,7 @@ EXPORT_API int maps_place_rating_destroy(maps_place_rating_h place)
 EXPORT_API int maps_place_rating_clone(const maps_place_rating_h origin,
                                       maps_place_rating_h *cloned)
 {
+       MAPS_LOG_API;
        if (!cloned || !origin)
                return MAPS_ERROR_INVALID_PARAMETER;
 
@@ -83,6 +86,7 @@ EXPORT_API int maps_place_rating_clone(const maps_place_rating_h origin,
 EXPORT_API int maps_place_rating_get_count(const maps_place_rating_h place,
                                           int *count)
 {
+       MAPS_LOG_API;
        if (!place || !count)
                return MAPS_ERROR_INVALID_PARAMETER;
        *count = ((maps_place_rating_s *) place)->count;
@@ -92,6 +96,7 @@ EXPORT_API int maps_place_rating_get_count(const maps_place_rating_h place,
 EXPORT_API int maps_place_rating_get_average(const maps_place_rating_h place,
                                             double *average)
 {
+       MAPS_LOG_API;
        if (!place || !average)
                return MAPS_ERROR_INVALID_PARAMETER;
        *average = ((maps_place_rating_s *) place)->average;
@@ -103,6 +108,7 @@ EXPORT_API int maps_place_rating_get_average(const maps_place_rating_h place,
 EXPORT_API int maps_place_rating_set_count(maps_place_rating_h place,
                                           const int count)
 {
+       MAPS_LOG_API;
        if (!place || (count < 0))
                return MAPS_ERROR_INVALID_PARAMETER;
        ((maps_place_rating_s *) place)->count = count;
@@ -112,6 +118,7 @@ EXPORT_API int maps_place_rating_set_count(maps_place_rating_h place,
 EXPORT_API int maps_place_rating_set_average(maps_place_rating_h place,
                                             const double average)
 {
+       MAPS_LOG_API;
        if (!place || (average < 0))
                return MAPS_ERROR_INVALID_PARAMETER;
        ((maps_place_rating_s *) place)->average = average;
index 9d1f0e578b82a863bb542d7a4346cffeddd5307d..aa935c4ec8db4eed288317477fcbc6d3a168dad1 100755 (executable)
@@ -40,6 +40,7 @@ const gsize _MAPS_PLACE_REVIEW_LANGUAGE_MAX_LENGTH = 32;
 
 EXPORT_API int maps_place_review_create(maps_place_review_h *place)
 {
+       MAPS_LOG_API;
        if (!place)
                return MAPS_ERROR_INVALID_PARAMETER;
        *place = (maps_place_review_h) g_slice_new0(maps_place_review_s);
@@ -54,6 +55,7 @@ EXPORT_API int maps_place_review_create(maps_place_review_h *place)
 
 EXPORT_API int maps_place_review_destroy(maps_place_review_h place)
 {
+       MAPS_LOG_API;
        if (!place)
                return MAPS_ERROR_INVALID_PARAMETER;
 
@@ -80,6 +82,7 @@ EXPORT_API int maps_place_review_destroy(maps_place_review_h place)
 EXPORT_API int maps_place_review_clone(const maps_place_review_h origin,
                                       maps_place_review_h *cloned)
 {
+       MAPS_LOG_API;
        if (!cloned || !origin)
                return MAPS_ERROR_INVALID_PARAMETER;
 
@@ -142,6 +145,7 @@ EXPORT_API int maps_place_review_clone(const maps_place_review_h origin,
 EXPORT_API int maps_place_review_get_date(const maps_place_review_h place,
                                          char **date)
 {
+       MAPS_LOG_API;
        if (!place || !date)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_place_review_s *) place)->date,
@@ -151,6 +155,7 @@ EXPORT_API int maps_place_review_get_date(const maps_place_review_h place,
 EXPORT_API int maps_place_review_get_title(const maps_place_review_h place,
                                           char **title)
 {
+       MAPS_LOG_API;
        if (!place || !title)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_place_review_s *) place)->title,
@@ -160,6 +165,7 @@ EXPORT_API int maps_place_review_get_title(const maps_place_review_h place,
 EXPORT_API int maps_place_review_get_rating(const maps_place_review_h place,
                                            double *rating)
 {
+       MAPS_LOG_API;
        if (!place || !rating)
                return MAPS_ERROR_INVALID_PARAMETER;
        *rating = ((maps_place_review_s *) place)->rating;
@@ -170,6 +176,7 @@ EXPORT_API int maps_place_review_get_description(const maps_place_review_h
                                                 place,
                                                 char **description)
 {
+       MAPS_LOG_API;
        if (!place || !description)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_place_review_s *) place)->description,
@@ -179,6 +186,7 @@ EXPORT_API int maps_place_review_get_description(const maps_place_review_h
 EXPORT_API int maps_place_review_get_language(const maps_place_review_h place,
                                              char ** language)
 {
+       MAPS_LOG_API;
        if (!place || !language)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_place_review_s *) place)->language,
@@ -188,6 +196,7 @@ EXPORT_API int maps_place_review_get_language(const maps_place_review_h place,
 EXPORT_API int maps_place_review_get_media(const maps_place_review_h place,
                                           maps_place_media_h *media)
 {
+       MAPS_LOG_API;
        if (!place || !media)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_place_media_clone(((maps_place_review_s *) place)->media,
@@ -197,6 +206,7 @@ EXPORT_API int maps_place_review_get_media(const maps_place_review_h place,
 EXPORT_API int maps_place_review_get_user_link(const maps_place_review_h place,
                                               maps_place_link_object_h *user)
 {
+       MAPS_LOG_API;
        if (!place || !user)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_place_link_object_clone(((maps_place_review_s *) place)->
@@ -208,6 +218,7 @@ EXPORT_API int maps_place_review_get_user_link(const maps_place_review_h place,
 EXPORT_API int maps_place_review_set_date(maps_place_review_h place,
                                          const char *date)
 {
+       MAPS_LOG_API;
        if (!place || !date)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(date, _MAPS_PLACE_REVIEW_DATE_MAX_LENGTH,
@@ -217,6 +228,7 @@ EXPORT_API int maps_place_review_set_date(maps_place_review_h place,
 EXPORT_API int maps_place_review_set_title(maps_place_review_h place,
                                           const char *title)
 {
+       MAPS_LOG_API;
        if (!place || !title)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(title, _MAPS_PLACE_REVIEW_TITLE_MAX_LENGTH,
@@ -226,6 +238,7 @@ EXPORT_API int maps_place_review_set_title(maps_place_review_h place,
 EXPORT_API int maps_place_review_set_rating(maps_place_review_h place,
                                            const double rating)
 {
+       MAPS_LOG_API;
        if (!place)
                return MAPS_ERROR_INVALID_PARAMETER;
        ((maps_place_review_s *) place)->rating = rating;
@@ -235,6 +248,7 @@ EXPORT_API int maps_place_review_set_rating(maps_place_review_h place,
 EXPORT_API int maps_place_review_set_description(maps_place_review_h place,
                                                 const char *description)
 {
+       MAPS_LOG_API;
        if (!place || !description)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(description,
@@ -245,6 +259,7 @@ EXPORT_API int maps_place_review_set_description(maps_place_review_h place,
 EXPORT_API int maps_place_review_set_language(maps_place_review_h place,
                                              const char *language)
 {
+       MAPS_LOG_API;
        if (!place || !language)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(language, _MAPS_PLACE_REVIEW_LANGUAGE_MAX_LENGTH,
@@ -254,6 +269,7 @@ EXPORT_API int maps_place_review_set_language(maps_place_review_h place,
 EXPORT_API int maps_place_review_set_media(maps_place_review_h place,
                                           const maps_place_media_h media)
 {
+       MAPS_LOG_API;
        if (!place || !media)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_place_review_s *r = (maps_place_review_s *) place;
@@ -266,6 +282,7 @@ EXPORT_API int maps_place_review_set_user_link(maps_place_review_h place,
                                               const maps_place_link_object_h
                                               user)
 {
+       MAPS_LOG_API;
        if (!place || !user)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_place_review_s *r = (maps_place_review_s *) place;
index ac34da21d71663ddd9fa8bc973e8dd2bb14b550d..3de64559bf4d469f372fd45c2f15d3251f584249 100755 (executable)
@@ -31,6 +31,7 @@ const gsize _MAPS_PLACE_URL_DESC_MAX_LENGTH = 512;
 
 EXPORT_API int maps_place_url_create(maps_place_url_h *place)
 {
+       MAPS_LOG_API;
        if (!place)
                return MAPS_ERROR_INVALID_PARAMETER;
        *place = (maps_place_url_h) g_slice_new0(maps_place_url_s);
@@ -45,6 +46,7 @@ EXPORT_API int maps_place_url_create(maps_place_url_h *place)
 
 EXPORT_API int maps_place_url_destroy(maps_place_url_h place)
 {
+       MAPS_LOG_API;
        if (!place)
                return MAPS_ERROR_INVALID_PARAMETER;
 
@@ -62,6 +64,7 @@ EXPORT_API int maps_place_url_destroy(maps_place_url_h place)
 EXPORT_API int maps_place_url_clone(const maps_place_url_h origin,
                                    maps_place_url_h *cloned)
 {
+       MAPS_LOG_API;
        if (!cloned || !origin)
                return MAPS_ERROR_INVALID_PARAMETER;
 
@@ -99,6 +102,7 @@ EXPORT_API int maps_place_url_clone(const maps_place_url_h origin,
 EXPORT_API int maps_place_url_get_path(const maps_place_url_h place,
                                       char **path)
 {
+       MAPS_LOG_API;
        if (!place || !path)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_place_url_s *) place)->path,
@@ -108,6 +112,7 @@ EXPORT_API int maps_place_url_get_path(const maps_place_url_h place,
 EXPORT_API int maps_place_url_get_description(const maps_place_url_h place,
                                              char **desc)
 {
+       MAPS_LOG_API;
        if (!place || !desc)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_place_url_s *) place)->desc,
@@ -118,6 +123,7 @@ EXPORT_API int maps_place_url_get_description(const maps_place_url_h place,
 
 EXPORT_API int maps_place_url_set_path(maps_place_url_h place, const char *path)
 {
+       MAPS_LOG_API;
        if (!place || !path)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(path, _MAPS_PLACE_URL_PATH_MAX_LENGTH,
@@ -127,6 +133,7 @@ EXPORT_API int maps_place_url_set_path(maps_place_url_h place, const char *path)
 EXPORT_API int maps_place_url_set_description(maps_place_url_h place,
                                              const char *desc)
 {
+       MAPS_LOG_API;
        if (!place || !desc)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(desc, _MAPS_PLACE_URL_DESC_MAX_LENGTH,
index 461f26b93db4633e996ee4d5ac0df6d09a3d812a..3f7e229cc316523694dfec0d7b854b104e86b116 100755 (executable)
@@ -29,6 +29,7 @@ const gsize _MAPS_PLUGIN_INFO_NAME_MAX_LENGTH = 64;
 
 EXPORT_API int maps_plugin_info_create(maps_plugin_info_h *info)
 {
+       MAPS_LOG_API;
        if (!info)
                return MAPS_ERROR_INVALID_PARAMETER;
        *info = g_slice_new0(maps_plugin_info_s);
@@ -43,6 +44,7 @@ EXPORT_API int maps_plugin_info_create(maps_plugin_info_h *info)
 
 EXPORT_API int maps_plugin_info_destroy(maps_plugin_info_h info)
 {
+       MAPS_LOG_API;
        if (!info)
                return MAPS_ERROR_INVALID_PARAMETER;
        int error = MAPS_ERROR_NONE;
@@ -59,6 +61,7 @@ EXPORT_API int maps_plugin_info_destroy(maps_plugin_info_h info)
 EXPORT_API int maps_plugin_info_clone(const maps_plugin_info_h origin,
                                      maps_plugin_info_h *cloned)
 {
+       MAPS_LOG_API;
        if (!cloned || !origin)
                return MAPS_ERROR_INVALID_PARAMETER;
 
@@ -92,6 +95,7 @@ EXPORT_API int maps_plugin_info_clone(const maps_plugin_info_h origin,
 EXPORT_API int maps_plugin_info_get_provider_name(const maps_plugin_info_h info,
                                                  char **provider_name)
 {
+       MAPS_LOG_API;
        if (!info || !provider_name)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_plugin_info_s *) info)->provider_name,
@@ -103,6 +107,7 @@ EXPORT_API int maps_plugin_info_get_provider_name(const maps_plugin_info_h info,
 EXPORT_API int maps_plugin_info_set_provider_name(maps_plugin_info_h info,
                                                  const char *provider_name)
 {
+       MAPS_LOG_API;
        if (!info || !provider_name)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(provider_name, _MAPS_PLUGIN_INFO_NAME_MAX_LENGTH,
index 4ce9e7b256cbfce0e908a9ed982e1fe66f0bc366..1a7332fb8eeded4035e5544fdf1f91717fbfeec9 100755 (executable)
@@ -87,6 +87,7 @@ static bool __maps_preference_properties_helper_cb(int index, int total,
 
 EXPORT_API int maps_preference_create(maps_preference_h *preference)
 {
+       MAPS_LOG_API;
        if (!preference)
                return MAPS_ERROR_INVALID_PARAMETER;
 
@@ -119,6 +120,7 @@ EXPORT_API int maps_preference_create(maps_preference_h *preference)
 
 EXPORT_API int maps_preference_destroy(maps_preference_h preference)
 {
+       MAPS_LOG_API;
        if (!preference)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_item_hashtable_destroy(preference);
@@ -127,6 +129,7 @@ EXPORT_API int maps_preference_destroy(maps_preference_h preference)
 EXPORT_API int maps_preference_clone(const maps_preference_h origin,
                                     maps_preference_h *cloned)
 {
+       MAPS_LOG_API;
        if (!cloned || !origin)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_item_hashtable_clone(origin, cloned);
@@ -138,6 +141,7 @@ EXPORT_API int maps_preference_get_distance_unit(const maps_preference_h
                                                 preference,
                                                 maps_distance_unit_e *unit)
 {
+       MAPS_LOG_API;
        if (!preference || !unit)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_item_hashtable_get_int(preference,
@@ -147,6 +151,7 @@ EXPORT_API int maps_preference_get_distance_unit(const maps_preference_h
 EXPORT_API int maps_preference_get_language(const maps_preference_h preference,
                                            char **language)
 {
+       MAPS_LOG_API;
        if (!preference || !language)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_item_hashtable_get_string(preference,
@@ -157,6 +162,7 @@ EXPORT_API int maps_preference_get_max_results(const maps_preference_h
                                               preference,
                                               int *max_results)
 {
+       MAPS_LOG_API;
        if (!preference || !max_results)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_item_hashtable_get_int(preference,
@@ -167,6 +173,7 @@ EXPORT_API int maps_preference_get_country_code(const maps_preference_h
                                                preference,
                                                char **country_code)
 {
+       MAPS_LOG_API;
        if (!preference || !country_code)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_item_hashtable_get_string(preference,
@@ -178,6 +185,7 @@ EXPORT_API int maps_preference_get_route_optimization(const maps_preference_h
                                                      maps_route_optimization_e*
                                                      optimization)
 {
+       MAPS_LOG_API;
        if (!preference || !optimization)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_item_hashtable_get_int(preference,
@@ -189,6 +197,7 @@ EXPORT_API int maps_preference_get_route_transport_mode(const maps_preference_h
                                                maps_route_transport_mode_e *
                                                transport_mode)
 {
+       MAPS_LOG_API;
        if (!preference || !transport_mode)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_item_hashtable_get_int(preference,
@@ -200,6 +209,7 @@ EXPORT_API int maps_preference_get_route_feature_weight(const maps_preference_h
                                                maps_route_feature_weight_e *
                                                feature_weight)
 {
+       MAPS_LOG_API;
        if (!preference || !feature_weight)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_item_hashtable_get_int(preference,
@@ -210,6 +220,7 @@ EXPORT_API int maps_preference_get_route_feature(const maps_preference_h
                                                 preference,
                                                 maps_route_feature_e * feature)
 {
+       MAPS_LOG_API;
        if (!preference || !feature)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_item_hashtable_get_int(preference,
@@ -219,6 +230,7 @@ EXPORT_API int maps_preference_get_route_feature(const maps_preference_h
 EXPORT_API int maps_preference_get(const maps_preference_h preference,
                                   const char *key, char **value)
 {
+       MAPS_LOG_API;
        if (!preference || !key || !value)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_item_hashtable_get_string(preference, key, value);
@@ -230,6 +242,7 @@ EXPORT_API int maps_preference_foreach_property(const maps_preference_h
                                                maps_preference_properties_cb
                                                callback, void *user_data)
 {
+       MAPS_LOG_API;
        if (!preference || !callback)
                return MAPS_ERROR_INVALID_PARAMETER;
        callback_data cd = { callback, user_data };
@@ -243,9 +256,10 @@ EXPORT_API int maps_preference_set_distance_unit(maps_preference_h preference,
                                                 const maps_distance_unit_e
                                                 unit)
 {
+       MAPS_LOG_API;
        if (!preference)
                return MAPS_ERROR_INVALID_PARAMETER;
-       if((unit < MAPS_DISTANCE_UNIT_M) || (unit > MAPS_DISTANCE_UNIT_YD))
+       if ((unit < MAPS_DISTANCE_UNIT_M) || (unit > MAPS_DISTANCE_UNIT_YD))
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_item_hashtable_set_int(preference,
                "MAPS_PREFERENCE_DISTANCE_UNIT", unit);
@@ -254,6 +268,7 @@ EXPORT_API int maps_preference_set_distance_unit(maps_preference_h preference,
 EXPORT_API int maps_preference_set_language(maps_preference_h preference,
                                            const char *language)
 {
+       MAPS_LOG_API;
        if (!preference || !language)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_item_hashtable_set_string(preference,
@@ -263,6 +278,7 @@ EXPORT_API int maps_preference_set_language(maps_preference_h preference,
 EXPORT_API int maps_preference_set_max_results(maps_preference_h preference,
                                               const int max_results)
 {
+       MAPS_LOG_API;
        if (!preference || max_results <= 0)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_item_hashtable_set_int(preference,
@@ -272,6 +288,7 @@ EXPORT_API int maps_preference_set_max_results(maps_preference_h preference,
 EXPORT_API int maps_preference_set_country_code(maps_preference_h preference,
                                                const char *country_code)
 {
+       MAPS_LOG_API;
        if (!preference || !country_code)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_item_hashtable_set_string(preference,
@@ -283,9 +300,10 @@ EXPORT_API int maps_preference_set_route_optimization(maps_preference_h
                                                const maps_route_optimization_e
                                                optimization)
 {
+       MAPS_LOG_API;
        if (!preference)
                return MAPS_ERROR_INVALID_PARAMETER;
-       if((optimization < MAPS_ROUTE_TYPE_FASTEST)
+       if ((optimization < MAPS_ROUTE_TYPE_FASTEST)
           || (optimization > MAPS_ROUTE_TYPE_DIRECTDRIVE))
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_item_hashtable_set_int(preference,
@@ -297,9 +315,10 @@ EXPORT_API int maps_preference_set_route_transport_mode(maps_preference_h
                                        const maps_route_transport_mode_e
                                        transport_mode)
 {
+       MAPS_LOG_API;
        if (!preference)
                return MAPS_ERROR_INVALID_PARAMETER;
-       if((transport_mode < MAPS_ROUTE_TRANSPORT_MODE_CAR)
+       if ((transport_mode < MAPS_ROUTE_TRANSPORT_MODE_CAR)
           || (transport_mode > MAPS_ROUTE_TRANSPORT_MODE_TRUCK))
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_item_hashtable_set_int(preference,
@@ -311,9 +330,10 @@ EXPORT_API int maps_preference_set_route_feature_weight(maps_preference_h
                                        const maps_route_feature_weight_e
                                        feature_weight)
 {
+       MAPS_LOG_API;
        if (!preference)
                return MAPS_ERROR_INVALID_PARAMETER;
-       if((feature_weight < MAPS_ROUTE_FEATURE_WEIGHT_NORMAL)
+       if ((feature_weight < MAPS_ROUTE_FEATURE_WEIGHT_NORMAL)
           || (feature_weight > MAPS_ROUTE_FEATURE_WEIGHT_STRICTEXCLUDE))
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_item_hashtable_set_int(preference,
@@ -324,9 +344,10 @@ EXPORT_API int maps_preference_set_route_feature(maps_preference_h preference,
                                                 const maps_route_feature_e
                                                 feature)
 {
+       MAPS_LOG_API;
        if (!preference)
                return MAPS_ERROR_INVALID_PARAMETER;
-       if((feature < MAPS_ROUTE_FEATURE_NO)
+       if ((feature < MAPS_ROUTE_FEATURE_NO)
           || (feature > MAPS_ROUTE_FEATURE_STAIRS))
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_item_hashtable_set_int(preference,
@@ -336,6 +357,7 @@ EXPORT_API int maps_preference_set_route_feature(maps_preference_h preference,
 EXPORT_API int maps_preference_set_property(maps_preference_h preference,
                                            const char *key, const char *value)
 {
+       MAPS_LOG_API;
        if (!preference || !key || !value)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_item_hashtable_set_string(preference, key, value);
@@ -348,6 +370,7 @@ EXPORT_API int maps_preference_append_route_feature(maps_preference_h
        preference, maps_item_list_h feature_list,
        maps_route_feature_weight_e feature)
 {
+       MAPS_LOG_API;
 
        if (!preference || max_result_count <= 0)
                return MAPS_ERROR_INVALID_PARAMETER;
@@ -373,6 +396,7 @@ EXPORT_API int maps_preference_remove_route_feature(maps_preference_h
        preference, maps_item_list_h feature_list,
        maps_route_feature_weight_e feature)
 {
+       MAPS_LOG_API;
 
        if (!preference || !feature_list)
                return MAPS_ERROR_INVALID_PARAMETER;
index 4ddd9c4448052bad88b4728f829c52d4657abf8d..0c967fdbe20cdcf3dc51d557d9fd58e9acce4b09 100755 (executable)
@@ -22,6 +22,7 @@
 #include "maps_route_segment_plugin.h"
 #include "maps_route_private.h"
 #include "maps_route_segment_private.h"
+#include "maps_extra_types_private.h"
 
 static bool __is_supported(const maps_route_h route, maps_service_data_e data)
 {
@@ -38,11 +39,13 @@ static bool __maps_route_set_supported_data_foreach_cb(int index, int total,
        return true;
 }
 
+#if 0
 static int __maps_route_set_supported_data_clone_cb(void *origin, void **cloned)
 {
        *cloned = origin;       /* No clonning, please */
        return MAPS_ERROR_NONE;
 }
+#endif
 
 /*----------------------------------------------------------------------------*/
 
@@ -51,23 +54,22 @@ static int __maps_route_set_supported_data_clone_cb(void *origin, void **cloned)
  */
 typedef struct _maps_route_s
 {
-       char *route_id;                 /*< route_id */
-       maps_coordinates_h origin;      /*< Coordinate StartCoord */
-       maps_coordinates_h destination; /*< Coordinates destCoord */
-       maps_area_h bounding_box;       /*< A rectangular geographical area */
-       maps_route_transport_mode_e transport_mode;     /*< The transport mode
+       char *route_id;                 /* route_id */
+       maps_coordinates_h origin;      /* Coordinate StartCoord */
+       maps_coordinates_h destination; /* Coordinates destCoord */
+       maps_area_h bounding_box;       /* A rectangular geographical area */
+       maps_route_transport_mode_e transport_mode;     /* The transport mode
                                                          for the route */
-       double total_distance;          /*< Total distance */
-       long total_duration;            /*< Total duration */
-       maps_distance_unit_e distance_unit;     /*< Distance units */
-       maps_item_list_h segments;      /*< List of segments,
+       double total_distance;          /* Total distance */
+       long total_duration;            /* Total duration */
+       maps_distance_unit_e distance_unit;     /* Distance units */
+       maps_item_list_h segments;      /* List of segments,
                                                  maps_route_segment_h */
-       maps_item_list_h path;          /*< Path, list of maps_coordinates_h */
-       maps_item_hashtable_h properties;       /*< Key/Value> */
+       maps_item_list_h path;          /* Path, list of maps_coordinates_h */
+       maps_item_hashtable_h properties;       /* Key/Value> */
 
        /* The table of available data features */
-       maps_string_hashtable_h supported_data;
-       /* TODO: implement hashtable<int, int> */
+       maps_int_hashtable_h supported_data;
 } maps_route_s;
 
 const gsize _MAPS_ROUTE_ID_MAX_LENGTH = 32;
@@ -76,6 +78,7 @@ const gsize _MAPS_ROUTE_ID_MAX_LENGTH = 32;
 
 EXPORT_API int maps_route_create(maps_route_h *route)
 {
+       MAPS_LOG_API;
        if (!route)
                return MAPS_ERROR_INVALID_PARAMETER;
        *route = (maps_route_h) g_slice_new0(maps_route_s);
@@ -90,6 +93,7 @@ EXPORT_API int maps_route_create(maps_route_h *route)
 
 EXPORT_API int maps_route_destroy(maps_route_h route)
 {
+       MAPS_LOG_API;
        if (!route)
                return MAPS_ERROR_INVALID_PARAMETER;
 
@@ -118,7 +122,7 @@ EXPORT_API int maps_route_destroy(maps_route_h route)
        }
 
        if (p->supported_data)
-               maps_item_hashtable_destroy(p->supported_data);
+               maps_int_hashtable_destroy(p->supported_data);
 
        g_slice_free(maps_route_s, route);
        return MAPS_ERROR_NONE;
@@ -127,6 +131,7 @@ EXPORT_API int maps_route_destroy(maps_route_h route)
 EXPORT_API int maps_route_clone(const maps_route_h origin,
                                maps_route_h *cloned)
 {
+       MAPS_LOG_API;
        if (!cloned || !origin)
                return MAPS_ERROR_INVALID_PARAMETER;
 
@@ -197,14 +202,14 @@ EXPORT_API int maps_route_clone(const maps_route_h origin,
 
                if (r->properties) {
                        error = maps_route_set_properties(*cloned,
-                               r->properties);
+                                                         r->properties);
                        if (error != MAPS_ERROR_NONE)
                                break;
                }
 
                if (r->supported_data) {
                        error = _maps_route_set_supported_data(*cloned,
-                               r->supported_data);
+                                                      r->supported_data);
                        if (error != MAPS_ERROR_NONE)
                                break;
                }
@@ -222,6 +227,7 @@ EXPORT_API int maps_route_clone(const maps_route_h origin,
 EXPORT_API int maps_route_get_route_id(const maps_route_h route,
                                       char **route_id)
 {
+       MAPS_LOG_API;
        if (!route || !route_id)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_route_s *) route)->route_id,
@@ -231,6 +237,7 @@ EXPORT_API int maps_route_get_route_id(const maps_route_h route,
 EXPORT_API int maps_route_get_origin(const maps_route_h route,
                                     maps_coordinates_h *origin)
 {
+       MAPS_LOG_API;
        if (!route || !origin)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_coordinates_clone(((maps_route_s *) route)->origin, origin);
@@ -240,6 +247,7 @@ EXPORT_API int maps_route_get_origin(const maps_route_h route,
 EXPORT_API int maps_route_get_destination(const maps_route_h route,
                                          maps_coordinates_h *destination)
 {
+       MAPS_LOG_API;
        if (!route || !destination)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_coordinates_clone(((maps_route_s *) route)->destination,
@@ -249,6 +257,7 @@ EXPORT_API int maps_route_get_destination(const maps_route_h route,
 EXPORT_API int maps_route_get_bounding_box(const maps_route_h route,
                                           maps_area_h *bounding_box)
 {
+       MAPS_LOG_API;
        if (!route || !bounding_box)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_area_clone(((maps_route_s *) route)->bounding_box,
@@ -259,6 +268,7 @@ EXPORT_API int maps_route_get_transport_mode(const maps_route_h route,
                                             maps_route_transport_mode_e *
                                             transport_mode)
 {
+       MAPS_LOG_API;
        if (!route || !transport_mode)
                return MAPS_ERROR_INVALID_PARAMETER;
        *transport_mode = ((maps_route_s *) route)->transport_mode;
@@ -268,6 +278,7 @@ EXPORT_API int maps_route_get_transport_mode(const maps_route_h route,
 EXPORT_API int maps_route_get_total_distance(const maps_route_h route,
                                             double *total_distance)
 {
+       MAPS_LOG_API;
        if (!route || !total_distance)
                return MAPS_ERROR_INVALID_PARAMETER;
        *total_distance = ((maps_route_s *) route)->total_distance;
@@ -277,6 +288,7 @@ EXPORT_API int maps_route_get_total_distance(const maps_route_h route,
 EXPORT_API int maps_route_get_total_duration(const maps_route_h route,
                                             long *total_duration)
 {
+       MAPS_LOG_API;
        if (!route || !total_duration)
                return MAPS_ERROR_INVALID_PARAMETER;
        *total_duration = ((maps_route_s *) route)->total_duration;
@@ -287,10 +299,19 @@ EXPORT_API int maps_route_foreach_path(const maps_route_h route,
                                       maps_route_path_cb callback,
                                       void *user_data)
 {
-       if (!route || !callback)
+       MAPS_LOG_API;
+       /* Check if the handle of the Route is valid */
+       if (!route)
                return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Check if this API feature available */
        if (!__is_supported(route, MAPS_ROUTE_PATH))
                return MAPS_ERROR_NOT_SUPPORTED;
+
+       /* Check if parameters are valid */
+       if (!callback)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
        return maps_item_list_foreach(((maps_route_s *) route)->path,
                maps_coordinates_clone, callback, user_data);
 }
@@ -299,11 +320,20 @@ EXPORT_API int maps_route_foreach_segment(const maps_route_h route,
                                          maps_route_segment_cb callback,
                                          void *user_data)
 {
-       if (!route || !callback)
+       MAPS_LOG_API;
+       /* Check if the handle of the Route is valid */
+       if (!route)
                return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Check if this API feature available */
        if (!__is_supported(route, MAPS_ROUTE_SEGMENTS_PATH)
                && !__is_supported(route, MAPS_ROUTE_SEGMENTS_MANEUVERS))
                return MAPS_ERROR_NOT_SUPPORTED;
+
+       /* Check if parameters are valid */
+       if (!callback)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
        return maps_item_list_foreach(((maps_route_s *) route)->segments,
                maps_route_segment_clone, callback, user_data);
 }
@@ -312,6 +342,7 @@ EXPORT_API int maps_route_foreach_property(const maps_route_h route,
                                           maps_route_properties_cb callback,
                                           void *user_data)
 {
+       MAPS_LOG_API;
        if (!route || !callback)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_item_hashtable_foreach(((maps_route_s *) route)->properties,
@@ -321,6 +352,7 @@ EXPORT_API int maps_route_foreach_property(const maps_route_h route,
 EXPORT_API int maps_route_get_distance_unit(const maps_route_h route,
                                            maps_distance_unit_e *distance_unit)
 {
+       MAPS_LOG_API;
        if (!route || !distance_unit)
                return MAPS_ERROR_INVALID_PARAMETER;
        *distance_unit = ((maps_route_s *) route)->distance_unit;
@@ -333,7 +365,9 @@ int _maps_route_is_data_supported(const maps_route_h route,
        if (!route || !supported)
                return MAPS_ERROR_INVALID_PARAMETER;
 
-       if (!((maps_route_s *) route)->supported_data) {
+       maps_route_s *r = (maps_route_s *)route;
+
+       if (!r->supported_data) {
                /* This is a case when the "supported" flags are not set yet */
                /* No need to limit access to fields */
                *supported = true;
@@ -341,22 +375,7 @@ int _maps_route_is_data_supported(const maps_route_h route,
        }
 
        *supported = false;
-       string data_feature;
-       switch (data) {
-       case MAPS_ROUTE_PATH:
-               data_feature = _S(MAPS_ROUTE_PATH);
-               break;
-       case MAPS_ROUTE_SEGMENTS_PATH:
-               data_feature = _S(MAPS_ROUTE_SEGMENTS_PATH);
-               break;
-       case MAPS_ROUTE_SEGMENTS_MANEUVERS:
-               data_feature = _S(MAPS_ROUTE_SEGMENTS_MANEUVERS);
-               break;
-       default:
-               return MAPS_ERROR_NOT_SUPPORTED;
-       }
-       return maps_string_hashtable_contains(((maps_route_s *) route)->
-               supported_data, data_feature.c_str(), supported);
+       return maps_int_hashtable_contains(r->supported_data, data, supported);
 }
 
 /*----------------------------------------------------------------------------*/
@@ -364,6 +383,7 @@ int _maps_route_is_data_supported(const maps_route_h route,
 EXPORT_API int maps_route_set_route_id(const maps_route_h route,
                                       const char *route_id)
 {
+       MAPS_LOG_API;
        if (!route || !route_id)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(route_id, _MAPS_ROUTE_ID_MAX_LENGTH,
@@ -373,6 +393,7 @@ EXPORT_API int maps_route_set_route_id(const maps_route_h route,
 EXPORT_API int maps_route_set_origin(maps_route_h route,
                                     const maps_coordinates_h origin)
 {
+       MAPS_LOG_API;
        if (!route || !origin)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_route_s *p = (maps_route_s *) route;
@@ -384,6 +405,7 @@ EXPORT_API int maps_route_set_origin(maps_route_h route,
 EXPORT_API int maps_route_set_destination(maps_route_h route,
                                          const maps_coordinates_h destination)
 {
+       MAPS_LOG_API;
        if (!route || !destination)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_route_s *p = (maps_route_s *) route;
@@ -395,6 +417,7 @@ EXPORT_API int maps_route_set_destination(maps_route_h route,
 EXPORT_API int maps_route_set_bounding_box(maps_route_h route,
                                           const maps_area_h bounding_box)
 {
+       MAPS_LOG_API;
        if (!route || !bounding_box)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_route_s *p = (maps_route_s *) route;
@@ -406,6 +429,7 @@ EXPORT_API int maps_route_set_bounding_box(maps_route_h route,
 EXPORT_API int maps_route_set_total_distance(maps_route_h route,
                                             const double total_distance)
 {
+       MAPS_LOG_API;
        if (!route || total_distance < 0)
                return MAPS_ERROR_INVALID_PARAMETER;
        ((maps_route_s *) route)->total_distance = total_distance;
@@ -415,6 +439,7 @@ EXPORT_API int maps_route_set_total_distance(maps_route_h route,
 EXPORT_API int maps_route_set_total_duration(maps_route_h route,
                                             const long total_duration)
 {
+       MAPS_LOG_API;
        if (!route || total_duration < 0)
                return MAPS_ERROR_INVALID_PARAMETER;
        ((maps_route_s *) route)->total_duration = total_duration;
@@ -425,6 +450,7 @@ EXPORT_API int maps_route_set_transport_mode(maps_route_h route,
                                             const maps_route_transport_mode_e
                                             transport_mode)
 {
+       MAPS_LOG_API;
        if (!route)
                return MAPS_ERROR_INVALID_PARAMETER;
        if ((transport_mode < MAPS_ROUTE_TRANSPORT_MODE_CAR) ||
@@ -437,6 +463,7 @@ EXPORT_API int maps_route_set_transport_mode(maps_route_h route,
 EXPORT_API int maps_route_set_path(maps_route_h route,
                                   const maps_item_list_h path)
 {
+       MAPS_LOG_API;
        if (!route || !path)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_route_s *p = (maps_route_s *) route;
@@ -451,6 +478,7 @@ EXPORT_API int maps_route_set_path(maps_route_h route,
 EXPORT_API int maps_route_set_segments(maps_route_h route,
                                       const maps_item_list_h segments)
 {
+       MAPS_LOG_API;
        if (!route || !segments)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_route_s *p = (maps_route_s *) route;
@@ -466,6 +494,7 @@ EXPORT_API int maps_route_set_segments(maps_route_h route,
 EXPORT_API int maps_route_set_properties(maps_route_h route,
                                         const maps_item_hashtable_h properties)
 {
+       MAPS_LOG_API;
        if (!route || !properties)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_route_s *p = (maps_route_s *) route;
@@ -478,6 +507,7 @@ EXPORT_API int maps_route_set_distance_unit(maps_route_h route,
                                            const maps_distance_unit_e
                                            distance_unit)
 {
+       MAPS_LOG_API;
        if (!route)
                return MAPS_ERROR_INVALID_PARAMETER;
        if ((distance_unit < MAPS_DISTANCE_UNIT_M) ||
@@ -488,15 +518,16 @@ EXPORT_API int maps_route_set_distance_unit(maps_route_h route,
 }
 
 int _maps_route_set_supported_data(maps_route_h route,
-                                  const maps_string_hashtable_h supported_data)
+                                  const maps_int_hashtable_h supported_data)
 {
        if (!route || !supported_data)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_route_s *p = (maps_route_s *) route;
        if (p->supported_data)
-               maps_string_hashtable_destroy(p->supported_data);
-       int error =
-               maps_string_hashtable_clone(supported_data, &p->supported_data);
+               maps_int_hashtable_destroy(p->supported_data);
+
+       int error = maps_int_hashtable_clone(supported_data,
+                                            &p->supported_data);
        if (error != MAPS_ERROR_NONE)
                return error;
 
@@ -504,7 +535,8 @@ int _maps_route_set_supported_data(maps_route_h route,
                return error;
 
        return maps_item_list_foreach(p->segments,
-               __maps_route_set_supported_data_clone_cb,
-               __maps_route_set_supported_data_foreach_cb, supported_data);
+                                     maps_item_no_clone,
+                               __maps_route_set_supported_data_foreach_cb,
+                               supported_data);
 
 }
index 6270cfc392c21802ad28f3aace5e3c6a4609dca9..31537b06adeb4a696441e626e0dac960f96d1351 100755 (executable)
@@ -40,6 +40,7 @@ const gsize _MAPS_ROUTE_MANEUVER_LOCALE_MAX_LENGTH = 32;
 
 EXPORT_API int maps_route_maneuver_create(maps_route_maneuver_h *maneuver)
 {
+       MAPS_LOG_API;
        if (!maneuver)
                return MAPS_ERROR_INVALID_PARAMETER;
        *maneuver = (maps_route_maneuver_h) g_slice_new0(maps_route_maneuver_s);
@@ -54,6 +55,7 @@ EXPORT_API int maps_route_maneuver_create(maps_route_maneuver_h *maneuver)
 
 EXPORT_API int maps_route_maneuver_destroy(maps_route_maneuver_h maneuver)
 {
+       MAPS_LOG_API;
        if (!maneuver)
                return MAPS_ERROR_INVALID_PARAMETER;
 
@@ -75,6 +77,7 @@ EXPORT_API int maps_route_maneuver_destroy(maps_route_maneuver_h maneuver)
 EXPORT_API int maps_route_maneuver_clone(const maps_route_maneuver_h origin,
                                         maps_route_maneuver_h *cloned)
 {
+       MAPS_LOG_API;
        if (!cloned || !origin)
                return MAPS_ERROR_INVALID_PARAMETER;
 
@@ -149,6 +152,7 @@ EXPORT_API int maps_route_maneuver_get_direction_id(const maps_route_maneuver_h
                                                    maps_route_direction_e *
                                                    direction_id)
 {
+       MAPS_LOG_API;
        if (!maneuver || !direction_id)
                return MAPS_ERROR_INVALID_PARAMETER;
        *direction_id = ((maps_route_maneuver_s *) maneuver)->direction_id;
@@ -160,6 +164,7 @@ EXPORT_API int maps_route_maneuver_get_turn_type(const maps_route_maneuver_h
                                                 maps_route_turn_type_e *
                                                 turn_type)
 {
+       MAPS_LOG_API;
        if (!maneuver || !turn_type)
                return MAPS_ERROR_INVALID_PARAMETER;
        *turn_type = ((maps_route_maneuver_s *) maneuver)->turn_type;
@@ -170,6 +175,7 @@ EXPORT_API int maps_route_maneuver_get_position(const maps_route_maneuver_h
                                                maneuver,
                                                maps_coordinates_h * position)
 {
+       MAPS_LOG_API;
        if (!maneuver || !position)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_coordinates_clone(((maps_route_maneuver_s *) maneuver)->
@@ -180,6 +186,7 @@ EXPORT_API int maps_route_maneuver_get_road_name(const maps_route_maneuver_h
                                                 maneuver,
                                                 char ** road_name)
 {
+       MAPS_LOG_API;
        if (!maneuver || !road_name)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_route_maneuver_s *) maneuver)->road_name,
@@ -192,6 +199,7 @@ EXPORT_API int maps_route_maneuver_get_instruction_text(const
                                                        char **
                                                        instruction_text)
 {
+       MAPS_LOG_API;
        if (!maneuver || !instruction_text)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_route_maneuver_s *) maneuver)->
@@ -204,6 +212,7 @@ EXPORT_API int maps_route_maneuver_get_locale(const maps_route_maneuver_h
                                              maneuver,
                                              char **locale)
 {
+       MAPS_LOG_API;
        if (!maneuver || !locale)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_get_string(((maps_route_maneuver_s *) maneuver)->locale,
@@ -215,6 +224,7 @@ EXPORT_API int maps_route_maneuver_get_time_to_next_instruction(const
                                                        maneuver,
                                                int *time_to_next_instruction)
 {
+       MAPS_LOG_API;
        if (!maneuver || !time_to_next_instruction)
                return MAPS_ERROR_INVALID_PARAMETER;
        *time_to_next_instruction =
@@ -226,6 +236,7 @@ EXPORT_API int maps_route_maneuver_get_distance_to_next_instruction(const
                                        maps_route_maneuver_h maneuver,
                                        double *distance_to_next_instruction)
 {
+       MAPS_LOG_API;
        if (!maneuver || !distance_to_next_instruction)
                return MAPS_ERROR_INVALID_PARAMETER;
        *distance_to_next_instruction =
@@ -242,9 +253,10 @@ EXPORT_API int maps_route_maneuver_set_direction_id(maps_route_maneuver_h
                                                    maps_route_direction_e
                                                    direction_id)
 {
+       MAPS_LOG_API;
        if (!maneuver)
                return MAPS_ERROR_INVALID_PARAMETER;
-       if((direction_id < MAPS_ROUTE_DIRECTION_NONE)
+       if ((direction_id < MAPS_ROUTE_DIRECTION_NONE)
           || (direction_id > MAPS_ROUTE_DIRECTION_EAST))
                return MAPS_ERROR_INVALID_PARAMETER;
        ((maps_route_maneuver_s *) maneuver)->direction_id = direction_id;
@@ -255,9 +267,10 @@ EXPORT_API int maps_route_maneuver_set_turn_type(maps_route_maneuver_h maneuver,
                                                 const maps_route_turn_type_e
                                                 turn_type)
 {
+       MAPS_LOG_API;
        if (!maneuver)
                return MAPS_ERROR_INVALID_PARAMETER;
-       if((turn_type < MAPS_ROUTE_TURN_TYPE_NONE)
+       if ((turn_type < MAPS_ROUTE_TURN_TYPE_NONE)
           || (turn_type > MAPS_ROUTE_TURN_TYPE_STRAIGHT_FORK))
                return MAPS_ERROR_INVALID_PARAMETER;
        ((maps_route_maneuver_s *) maneuver)->turn_type = turn_type;
@@ -268,6 +281,7 @@ EXPORT_API int maps_route_maneuver_set_position(maps_route_maneuver_h maneuver,
                                                const maps_coordinates_h
                                                position)
 {
+       MAPS_LOG_API;
        if (!maneuver || !position)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_route_maneuver_s *p = (maps_route_maneuver_s *) maneuver;
@@ -279,6 +293,7 @@ EXPORT_API int maps_route_maneuver_set_position(maps_route_maneuver_h maneuver,
 EXPORT_API int maps_route_maneuver_set_road_name(maps_route_maneuver_h maneuver,
                                                 const char *road_name)
 {
+       MAPS_LOG_API;
        if (!maneuver || !road_name)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(road_name,
@@ -291,6 +306,7 @@ EXPORT_API int maps_route_maneuver_set_instruction_text(maps_route_maneuver_h
                                                        const char *
                                                        instruction_text)
 {
+       MAPS_LOG_API;
        if (!maneuver || !instruction_text)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_set_string(instruction_text,
@@ -301,6 +317,7 @@ EXPORT_API int maps_route_maneuver_set_instruction_text(maps_route_maneuver_h
 EXPORT_API int maps_route_maneuver_set_locale(maps_route_maneuver_h maneuver,
                                              const char *locale)
 {
+       MAPS_LOG_API;
        if (!maneuver || !locale)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_route_maneuver_s *p = (maps_route_maneuver_s *) maneuver;
@@ -312,6 +329,7 @@ EXPORT_API int maps_route_maneuver_set_time_to_next_instruction(
                                        maps_route_maneuver_h maneuver,
                                        const int time_to_next_instruction)
 {
+       MAPS_LOG_API;
        if (!maneuver || time_to_next_instruction < 0)
                return MAPS_ERROR_INVALID_PARAMETER;
        ((maps_route_maneuver_s *) maneuver)->time_to_next_instruction =
@@ -323,6 +341,7 @@ EXPORT_API int maps_route_maneuver_set_distance_to_next_instruction(
                                maps_route_maneuver_h maneuver,
                                const double distance_to_next_instruction)
 {
+       MAPS_LOG_API;
        if (!maneuver || distance_to_next_instruction < 0)
                return MAPS_ERROR_INVALID_PARAMETER;
        ((maps_route_maneuver_s *) maneuver)->distance_to_next_instruction =
index ae20bb1114763d3a5a129a3214921501082ee262..e773dc67ebfdecf31d78450403c6a1479781fa8f 100755 (executable)
@@ -18,7 +18,7 @@
 #define __MAPS_ROUTE_PRIVATE_H__
 
 #include <maps_service.h>
-#include <maps_extra_types.h>
+#include "maps_extra_types_private.h"
 
 /**
  * @ingroup    CAPI_MAPS_PLACE_MODULE
@@ -74,8 +74,7 @@ int _maps_route_is_data_supported(const maps_route_h route,
  * @see maps_route_create()
  */
 int _maps_route_set_supported_data(maps_route_h route,
-                                  const maps_string_hashtable_h
-                                  supported_data);
+                                  const maps_int_hashtable_h supported_data);
 
 #ifdef __cplusplus
 }
index 73c45e6555cc805ead425ced9ea658531555056b..7891ca3ae36d4681eff879f383820182406ed058 100755 (executable)
@@ -18,6 +18,7 @@
 #include "maps_route_segment_plugin.h"
 #include "maps_route_maneuver_plugin.h"
 #include "maps_extra_types.h"
+#include "maps_extra_types_private.h"
 #include <glib.h>
 #include "maps_util.h"
 #include "maps_route_segment_private.h"
@@ -44,14 +45,14 @@ typedef struct _maps_route_segment_s
                                          maps_route_maneuver_h */
 
        /* The table of available data features */
-       maps_string_hashtable_h supported_data;
-       /* TODO: implement hashtable<int, int> */
+       maps_int_hashtable_h supported_data;
 } maps_route_segment_s;
 
 /*----------------------------------------------------------------------------*/
 
 EXPORT_API int maps_route_segment_create(maps_route_segment_h *segment)
 {
+       MAPS_LOG_API;
        if (!segment)
                return MAPS_ERROR_INVALID_PARAMETER;
        *segment = (maps_route_segment_h) g_slice_new0(maps_route_segment_s);
@@ -66,6 +67,7 @@ EXPORT_API int maps_route_segment_create(maps_route_segment_h *segment)
 
 EXPORT_API int maps_route_segment_destroy(maps_route_segment_h segment)
 {
+       MAPS_LOG_API;
        if (!segment)
                return MAPS_ERROR_INVALID_PARAMETER;
 
@@ -88,7 +90,7 @@ EXPORT_API int maps_route_segment_destroy(maps_route_segment_h segment)
        }
 
        if (p->supported_data)
-               maps_item_hashtable_destroy(p->supported_data);
+               maps_int_hashtable_destroy(p->supported_data);
 
        g_slice_free(maps_route_segment_s, segment);
        return MAPS_ERROR_NONE;
@@ -97,6 +99,7 @@ EXPORT_API int maps_route_segment_destroy(maps_route_segment_h segment)
 EXPORT_API int maps_route_segment_clone(const maps_route_segment_h segment,
                                        maps_route_segment_h *cloned)
 {
+       MAPS_LOG_API;
        if (!cloned || !segment)
                return MAPS_ERROR_INVALID_PARAMETER;
 
@@ -170,6 +173,7 @@ EXPORT_API int maps_route_segment_clone(const maps_route_segment_h segment,
 EXPORT_API int maps_route_segment_get_origin(const maps_route_segment_h segment,
                                             maps_coordinates_h *origin)
 {
+       MAPS_LOG_API;
        if (!segment || !origin)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_coordinates_clone(((maps_route_segment_s *) segment)->
@@ -180,6 +184,7 @@ EXPORT_API int maps_route_segment_get_destination(const maps_route_segment_h
                                                  segment,
                                                maps_coordinates_h *destination)
 {
+       MAPS_LOG_API;
        if (!segment || !destination)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_coordinates_clone(((maps_route_segment_s *) segment)->
@@ -190,6 +195,7 @@ EXPORT_API int maps_route_segment_get_bounding_box(const maps_route_segment_h
                                                   segment, maps_area_h *
                                                   bounding_box)
 {
+       MAPS_LOG_API;
        if (!segment || !bounding_box)
                return MAPS_ERROR_INVALID_PARAMETER;
        return maps_area_clone(((maps_route_segment_s *) segment)->bounding_box,
@@ -200,6 +206,7 @@ EXPORT_API int maps_route_segment_get_distance(const maps_route_segment_h
                                               segment,
                                               double *distance)
 {
+       MAPS_LOG_API;
        if (!segment || !distance)
                return MAPS_ERROR_INVALID_PARAMETER;
        *distance = ((maps_route_segment_s *) segment)->distance;
@@ -210,6 +217,7 @@ EXPORT_API int maps_route_segment_get_duration(const maps_route_segment_h
                                               segment,
                                               long *duration)
 {
+       MAPS_LOG_API;
        if (!segment || !duration)
                return MAPS_ERROR_INVALID_PARAMETER;
        *duration = ((maps_route_segment_s *) segment)->duration;
@@ -221,10 +229,19 @@ EXPORT_API int maps_route_segment_foreach_path(const maps_route_segment_h
                                        maps_route_segment_path_cb callback,
                                        void *user_data)
 {
-       if (!segment || !callback)
+       MAPS_LOG_API;
+       /* Check if the handle of the Segment is valid */
+       if (!segment)
                return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Check if this API feature available */
        if (!__is_supported(segment, MAPS_ROUTE_SEGMENTS_PATH))
                return MAPS_ERROR_NOT_SUPPORTED;
+
+       /* Check if parameters are valid */
+       if (!callback)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
        return maps_item_list_foreach(((maps_route_segment_s *) segment)->path,
                maps_coordinates_clone, callback, user_data);
 }
@@ -235,10 +252,19 @@ EXPORT_API int maps_route_segment_foreach_maneuver(const maps_route_segment_h
                                                callback,
                                                void *user_data)
 {
-       if (!segment || !callback)
+       MAPS_LOG_API;
+       /* Check if the handle of the Segment is valid */
+       if (!segment)
                return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Check if this API feature available */
        if (!__is_supported(segment, MAPS_ROUTE_SEGMENTS_MANEUVERS))
                return MAPS_ERROR_NOT_SUPPORTED;
+
+       /* Check if parameters are valid */
+       if (!callback)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
        return maps_item_list_foreach(((maps_route_segment_s *) segment)->
                maneuvers, maps_route_maneuver_clone, callback, user_data);
 }
@@ -250,7 +276,8 @@ int _maps_route_segment_is_data_supported(const maps_route_segment_h segment,
        if (!segment || !supported)
                return MAPS_ERROR_INVALID_PARAMETER;
 
-       if (!((maps_route_segment_s *) segment)->supported_data) {
+       maps_route_segment_s *s = (maps_route_segment_s *)segment;
+       if (!s->supported_data) {
                /* This is a case when the "supported" flags are not set yet */
                /* No need to limit access to fields */
                *supported = true;
@@ -258,20 +285,7 @@ int _maps_route_segment_is_data_supported(const maps_route_segment_h segment,
        }
 
        *supported = false;
-       string data_feature;
-       switch (data) {
-       case MAPS_ROUTE_SEGMENTS_PATH:
-               data_feature = _S(MAPS_ROUTE_SEGMENTS_PATH);
-               break;
-       case MAPS_ROUTE_SEGMENTS_MANEUVERS:
-               data_feature = _S(MAPS_ROUTE_SEGMENTS_MANEUVERS);
-               break;
-       default:
-               return MAPS_ERROR_NOT_SUPPORTED;
-       }
-       return maps_string_hashtable_contains(((maps_route_segment_s *)
-                       segment)->supported_data, data_feature.c_str(),
-               supported);
+       return maps_int_hashtable_contains(s->supported_data, data, supported);
 }
 
 /*----------------------------------------------------------------------------*/
@@ -279,6 +293,7 @@ int _maps_route_segment_is_data_supported(const maps_route_segment_h segment,
 EXPORT_API int maps_route_segment_set_origin(maps_route_segment_h segment,
                                             const maps_coordinates_h origin)
 {
+       MAPS_LOG_API;
        if (!segment || !origin)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_route_segment_s *p = (maps_route_segment_s *) segment;
@@ -291,6 +306,7 @@ EXPORT_API int maps_route_segment_set_destination(maps_route_segment_h segment,
                                                  const maps_coordinates_h
                                                  destination)
 {
+       MAPS_LOG_API;
        if (!segment || !destination)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_route_segment_s *p = (maps_route_segment_s *) segment;
@@ -304,6 +320,7 @@ EXPORT_API int maps_route_segment_set_bounding_box(maps_route_segment_h segment,
                                                   const maps_area_h
                                                   bounding_box)
 {
+       MAPS_LOG_API;
        if (!segment || !bounding_box)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_route_segment_s *p = (maps_route_segment_s *) segment;
@@ -315,6 +332,7 @@ EXPORT_API int maps_route_segment_set_bounding_box(maps_route_segment_h segment,
 EXPORT_API int maps_route_segment_set_distance(maps_route_segment_h segment,
                                               const double distance)
 {
+       MAPS_LOG_API;
        if (!segment || distance < 0)
                return MAPS_ERROR_INVALID_PARAMETER;
        ((maps_route_segment_s *) segment)->distance = distance;
@@ -324,6 +342,7 @@ EXPORT_API int maps_route_segment_set_distance(maps_route_segment_h segment,
 EXPORT_API int maps_route_segment_set_duration(maps_route_segment_h segment,
                                               const long duration)
 {
+       MAPS_LOG_API;
        if (!segment || duration < 0)
                return MAPS_ERROR_INVALID_PARAMETER;
        ((maps_route_segment_s *) segment)->duration = duration;
@@ -333,6 +352,7 @@ EXPORT_API int maps_route_segment_set_duration(maps_route_segment_h segment,
 EXPORT_API int maps_route_segment_set_path(maps_route_segment_h segment,
                                           const maps_item_list_h path)
 {
+       MAPS_LOG_API;
        if (!segment || !path)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_route_segment_s *s = (maps_route_segment_s *) segment;
@@ -348,6 +368,7 @@ EXPORT_API int maps_route_segment_set_maneuvers(maps_route_segment_h segment,
                                                const maps_item_list_h
                                                maneuvers)
 {
+       MAPS_LOG_API;
        if (!segment || !maneuvers)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_route_segment_s *s = (maps_route_segment_s *) segment;
@@ -362,7 +383,7 @@ EXPORT_API int maps_route_segment_set_maneuvers(maps_route_segment_h segment,
 }
 
 int _maps_route_segment_set_supported_data(maps_route_segment_h segment,
-                                          const maps_string_hashtable_h
+                                          const maps_int_hashtable_h
                                           supported_data)
 {
 
@@ -370,6 +391,6 @@ int _maps_route_segment_set_supported_data(maps_route_segment_h segment,
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_route_segment_s *p = (maps_route_segment_s *) segment;
        if (p->supported_data)
-               maps_string_hashtable_destroy(p->supported_data);
-       return maps_string_hashtable_clone(supported_data, &p->supported_data);
+               maps_int_hashtable_destroy(p->supported_data);
+       return maps_int_hashtable_clone(supported_data, &p->supported_data);
 }
index c061610d8cff237d3505263d81df3850a91ff5f4..183c71511ab48646f4e1c5d7a3908ef56f3480ed 100755 (executable)
@@ -18,7 +18,7 @@
 #define __MAPS_ROUTE_SEGMENT_PRIVATE_H__
 
 #include <maps_service.h>
-#include <maps_extra_types.h>
+#include "maps_extra_types_private.h"
 
 /**
  * @ingroup    CAPI_MAPS_PLACE_MODULE
@@ -75,7 +75,7 @@ int _maps_route_segment_is_data_supported(const maps_route_segment_h segment,
  * @see maps_route_segment_create()
  */
 int _maps_route_segment_set_supported_data(maps_route_segment_h segment,
-                                          const maps_string_hashtable_h
+                                          const maps_int_hashtable_h
                                           supported_data);
 
 #ifdef __cplusplus
index b7dcc8681066632d52d92e91d181466bbab06c47..9187cd9003263501355fd607151617fae07a2521 100755 (executable)
 #include "discovery.h"
 #include "module.h"
 
+
+#ifdef _SIMPLE_PRIVILEGE_CHECK_AVAILABLE_
+       #include <privilege_checker.h>
+#else
+       #include <stdlib.h>
+       #include <sys/types.h>
+       #include <unistd.h>
+
+       #include <app_manager.h>
+       #include <package_manager.h>
+       #include <pkgmgr-info.h>
+       #include <privacy_checker_client.h>
+
+       #define CAPP    1
+       #define WEBAPP  2
+       #define CPPAPP  3
+#endif /*_SIMPLE_PRIVILEGE_CHECK_AVAILABLE_ */
+
+
 /*----------------------------------------------------------------------------*/
 /* Structure of maps_service */
 /* maps_service_s* is used as maps_service_h */
@@ -52,7 +71,7 @@ plugin::plugin_s *__extract_plugin(maps_service_h maps)
 static bool __maps_provider_supported(maps_service_h maps,
                                      maps_service_e service)
 {
-       if (not maps)
+       if (!maps)
                return false;
        bool supported = false;
        if (maps_service_provider_is_service_supported(maps, service,
@@ -61,6 +80,185 @@ static bool __maps_provider_supported(maps_service_h maps,
        return supported;
 }
 
+#ifndef _SIMPLE_PRIVILEGE_CHECK_AVAILABLE_
+static bool __is_privacy_initialized = false;
+
+static int __maps_service_get_app_type(char *target_app_id)
+{
+       int ret = 0;
+       pid_t pid = 0;
+       char *app_id = NULL;
+       app_info_h app_info;
+       char *type = NULL;
+
+       if (target_app_id == NULL) {
+               pid = getpid();
+               ret = app_manager_get_app_id(pid, &app_id);
+               if (ret != APP_MANAGER_ERROR_NONE) {
+                       MAPS_LOGE("Fail to get app_id. Err[%d]", ret);
+                       return MAPS_ERROR_NONE;
+               }
+       } else {
+               app_id = g_strdup(target_app_id);
+       }
+
+       ret = app_info_create(app_id, &app_info);
+       if (ret != APP_MANAGER_ERROR_NONE) {
+               MAPS_LOGE("Fail to get app_id. Err[%d]", ret);
+               g_free(app_id);
+               return 0;
+       }
+
+       ret = app_info_get_type(app_info, &type);
+       if (ret != APP_MANAGER_ERROR_NONE) {
+               MAPS_LOGE("Fail to get type. Err[%d]", ret);
+               g_free(app_id);
+               app_info_destroy(app_info);
+               return 0;
+       }
+
+       if (strcmp(type, "c++app") == 0)
+               ret = CPPAPP;
+       else if (strcmp(type, "webapp") == 0)
+               ret = WEBAPP;
+       else
+               ret = CAPP;
+
+       g_free(type);
+       g_free(app_id);
+       app_info_destroy(app_info);
+
+       return ret;
+}
+
+static void __maps_service_privacy_initialize(void)
+{
+       int ret = 0;
+       pid_t pid = 0;
+       char *app_id = NULL;
+       char *package_id = NULL;
+       pkgmgrinfo_appinfo_h pkgmgrinfo_appinfo;
+
+       pid = getpid();
+       ret = app_manager_get_app_id(pid, &app_id);
+       if (ret != APP_MANAGER_ERROR_NONE) {
+               MAPS_LOGE("Fail to get app_id. Err[%d]", ret);
+               return;
+       }
+
+       ret = pkgmgrinfo_appinfo_get_appinfo(app_id, &pkgmgrinfo_appinfo);
+       if (ret != PACKAGE_MANAGER_ERROR_NONE) {
+               MAPS_LOGE("Fail to get appinfo for [%s]. Err[%d]", app_id, ret);
+               g_free(app_id);
+               return;
+       }
+       ret = pkgmgrinfo_appinfo_get_pkgname(pkgmgrinfo_appinfo, &package_id);
+       if (ret != PACKAGE_MANAGER_ERROR_NONE) {
+               MAPS_LOGE("Fail to get package_id for [%s]. Err[%d]",
+                         app_id, ret);
+               pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo);
+               g_free(app_id);
+               return;
+       }
+
+       ret = privacy_checker_initialize(package_id);
+       if (ret != PRIV_MGR_ERROR_SUCCESS) {
+               MAPS_LOGE("Fail to initialize privacy checker. err[%d]", ret);
+               pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo);
+               g_free(app_id);
+               return;
+       }
+
+       MAPS_LOGD("Success to initialize privacy checker");
+
+       g_free(app_id);
+       pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo);
+}
+
+static void __maps_service_privacy_finalize(void)
+{
+       int ret = 0;
+       ret = privacy_checker_finalize();
+       if (ret != PRIV_MGR_ERROR_SUCCESS) {
+               MAPS_LOGE("Fail to finalize privacy_cehecker. Err[%d]", ret);
+               return;
+       }
+
+       MAPS_LOGD("Success to finalize privacy checker");
+}
+
+static int __maps_service_get_privacy(const char *privilege)
+{
+       int ret = 0;
+       pid_t pid = 0;
+       char *app_id = NULL;
+       char *package_id = NULL;
+       int app_type = 0;
+       pkgmgrinfo_appinfo_h pkgmgrinfo_appinfo;
+
+       pid = getpid();
+       ret = app_manager_get_app_id(pid, &app_id);
+       if (ret != APP_MANAGER_ERROR_NONE) {
+               MAPS_LOGE("Fail to get app_id. Err[%d]", ret);
+               return MAPS_ERROR_NONE;
+       }
+
+       app_type = __maps_service_get_app_type(app_id);
+       if (app_type == CPPAPP) {
+               MAPS_LOGE("CPPAPP use location");
+               g_free(app_id);
+               return MAPS_ERROR_NONE;
+       }
+
+       ret = pkgmgrinfo_appinfo_get_appinfo(app_id, &pkgmgrinfo_appinfo);
+       if (ret != PACKAGE_MANAGER_ERROR_NONE) {
+               MAPS_LOGE("Fail to get appinfo of [%s]. Err[%d]", app_id, ret);
+               g_free(app_id);
+               return MAPS_ERROR_PERMISSION_DENIED;
+       }
+
+       ret = pkgmgrinfo_appinfo_get_pkgname(pkgmgrinfo_appinfo, &package_id);
+       if (ret != PACKAGE_MANAGER_ERROR_NONE) {
+               MAPS_LOGE("Fail to get package_id of [%s]. Err[%d]",
+                         app_id, ret);
+               g_free(app_id);
+               pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo);
+               return MAPS_ERROR_PERMISSION_DENIED;
+       }
+
+       ret = privacy_checker_check_package_by_privilege(package_id, privilege);
+       if (ret != PRIV_MGR_ERROR_SUCCESS) {
+               MAPS_LOGE("Fail to get privilege of [%s] package. Err[%d]",
+                         package_id, ret);
+               pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo);
+               g_free(app_id);
+               return MAPS_ERROR_PERMISSION_DENIED;
+       }
+
+       pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo);
+       g_free(app_id);
+
+       return MAPS_ERROR_NONE;
+}
+#endif /* _SIMPLE_PRIVILEGE_CHECK_AVAILABLE_ */
+
+static bool __has_maps_service_privilege()
+{
+#ifdef _SIMPLE_PRIVILEGE_CHECK_AVAILABLE_
+       return (privilege_checker_check_privilege(
+               "http://tizen.org/privilege/mapservice")
+                       == PRIVILEGE_CHECKER_ERR_NONE);
+#else
+       if(!__is_privacy_initialized) {
+               __maps_service_privacy_initialize();
+               __is_privacy_initialized = true;
+       }
+       return (__maps_service_get_privacy(
+               "http://tizen.org/privilege/mapservice")
+                       == MAPS_ERROR_NONE);
+#endif /* _SIMPLE_PRIVILEGE_CHECK_AVAILABLE_ */
+}
+
 /*----------------------------------------------------------------------------*/
 /* */
 /* Maps Service & Preference */
@@ -69,8 +267,9 @@ EXPORT_API int maps_service_foreach_provider(maps_service_provider_info_cb
                                             callback,
                                             void *user_data)
 {
-
-       g_return_val_if_fail(callback, MAPS_ERROR_INVALID_PARAMETER);
+       MAPS_LOG_API;
+       if (!callback)
+               return MAPS_ERROR_INVALID_PARAMETER;
 
        /* The list of map provider info, obtained by enumerating available
         *  plugins */
@@ -78,7 +277,7 @@ EXPORT_API int maps_service_foreach_provider(maps_service_provider_info_cb
        vector < plugin::provider_info > v = pd.get_available_list();
 
        /* Send obtained provider info to the user */
-       const int total = int (v.size());
+       const int total = int(v.size());
        for (int i = 0; i < total; i++) {
                /* Get a plugin info handle from the array */
                /* and send a callback with provider info to the user */
@@ -93,9 +292,14 @@ EXPORT_API int maps_service_foreach_provider(maps_service_provider_info_cb
 EXPORT_API int maps_service_create(const char *maps_provider,
                                   maps_service_h *maps)
 {
+       MAPS_LOG_API;
+       /* Check if parameters are valid */
+       if (!maps || !maps_provider)
+               return MAPS_ERROR_INVALID_PARAMETER;
 
-       g_return_val_if_fail(maps_provider, MAPS_ERROR_INVALID_PARAMETER);
-       g_return_val_if_fail(maps, MAPS_ERROR_INVALID_PARAMETER);
+       /* Check if privileges enough */
+       if (!__has_maps_service_privilege())
+               return MAPS_ERROR_PERMISSION_DENIED;
 
        maps_error_e error = MAPS_ERROR_NOT_SUPPORTED;
 
@@ -138,7 +342,7 @@ EXPORT_API int maps_service_create(const char *maps_provider,
                /* 5. Set status of completely correct plugin initialization */
                error = MAPS_ERROR_NONE;
 
-       } while (false);
+       } while(false);
 
        if (error != MAPS_ERROR_NONE)
                maps_service_destroy(*maps);
@@ -148,7 +352,15 @@ EXPORT_API int maps_service_create(const char *maps_provider,
 
 EXPORT_API int maps_service_destroy(maps_service_h maps)
 {
-       g_return_val_if_fail(maps, MAPS_ERROR_INVALID_PARAMETER);
+       MAPS_LOG_API;
+       /* Check if parameters are valid */
+       if (!maps)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Check if privileges enough */
+       if (!__has_maps_service_privilege())
+               return MAPS_ERROR_PERMISSION_DENIED;
+
        maps_service_s *maps_service = (maps_service_s *) maps;
 
        if (maps_service->plugin)
@@ -156,12 +368,18 @@ EXPORT_API int maps_service_destroy(maps_service_h maps)
 
        g_slice_free(maps_service_s, maps);
 
+
+#ifndef _SIMPLE_PRIVILEGE_CHECK_AVAILABLE_
+       __maps_service_privacy_finalize();
+#endif /* _SIMPLE_PRIVILEGE_CHECK_AVAILABLE_ */
+
        return MAPS_ERROR_NONE;
 }
 
 EXPORT_API int maps_service_set_provider_key(maps_service_h maps,
                                             const char *provider_key)
 {
+       MAPS_LOG_API;
        if (!maps || !provider_key)
                return MAPS_ERROR_INVALID_PARAMETER;
        const plugin::plugin_s *p = __extract_plugin(maps);
@@ -173,6 +391,7 @@ EXPORT_API int maps_service_set_provider_key(maps_service_h maps,
 EXPORT_API int maps_service_get_provider_key(const maps_service_h maps,
                                             char **provider_key)
 {
+       MAPS_LOG_API;
        if (!maps || !provider_key)
                return MAPS_ERROR_INVALID_PARAMETER;
        const plugin::plugin_s *p = __extract_plugin(maps);
@@ -184,6 +403,7 @@ EXPORT_API int maps_service_get_provider_key(const maps_service_h maps,
 EXPORT_API int maps_service_set_preference(maps_service_h maps,
                                           maps_string_hashtable_h preference)
 {
+       MAPS_LOG_API;
        if (!maps || !preference)
                return MAPS_ERROR_INVALID_PARAMETER;
        const plugin::plugin_s *p = __extract_plugin(maps);
@@ -195,6 +415,7 @@ EXPORT_API int maps_service_set_preference(maps_service_h maps,
 EXPORT_API int maps_service_get_preference(maps_service_h maps,
                                           maps_string_hashtable_h *preference)
 {
+       MAPS_LOG_API;
        if (!maps || !preference)
                return MAPS_ERROR_INVALID_PARAMETER;
        const plugin::plugin_s *p = __extract_plugin(maps);
@@ -208,7 +429,8 @@ EXPORT_API int maps_service_provider_is_service_supported(const maps_service_h
                                                        maps_service_e service,
                                                        bool *supported)
 {
-       if (not maps or not supported)
+       MAPS_LOG_API;
+       if (!maps || !supported)
                return MAPS_ERROR_INVALID_PARAMETER;
        if ((service < MAPS_SERVICE_GEOCODE)
            || (service > MAPS_SERVICE_CANCEL_REQUEST))
@@ -225,11 +447,13 @@ EXPORT_API int maps_service_provider_is_data_supported(const maps_service_h
                                                       maps_service_data_e data,
                                                       bool *supported)
 {
-       if (not maps or not supported)
+       MAPS_LOG_API;
+       if (!maps || !supported)
                return MAPS_ERROR_INVALID_PARAMETER;
        if ((data < MAPS_PLACE_ADDRESS)
            || (data > MAPS_ROUTE_SEGMENTS_MANEUVERS))
                return MAPS_ERROR_INVALID_PARAMETER;
+
        const plugin::plugin_s *p = __extract_plugin(maps);
        if (!p)
                return MAPS_ERROR_NOT_SUPPORTED;
@@ -247,11 +471,23 @@ EXPORT_API int maps_service_geocode(const maps_service_h maps,
                                    void *user_data,
                                    int *request_id)
 {
-       /*if (!maps || !address || !preference || !callback || !request_id)*/
-       if (!maps || !address || !callback || !request_id)
+       MAPS_LOG_API;
+       /* Check if the handle of the Maps Service is valid */
+       if (!maps)
                return MAPS_ERROR_INVALID_PARAMETER;
-       if (not __maps_provider_supported(maps, MAPS_SERVICE_GEOCODE))
+
+       /* Check if this API feature available */
+       if (!__maps_provider_supported(maps, MAPS_SERVICE_GEOCODE))
                return MAPS_ERROR_NOT_SUPPORTED;
+
+       /* Check if parameters are valid */
+       if (!address || !callback || !request_id)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Check if privileges enough */
+       if (!__has_maps_service_privilege())
+               return MAPS_ERROR_PERMISSION_DENIED;
+
        return q()->push(new session::command_geocode(maps, address, preference,
                        callback, user_data, request_id));
 }
@@ -263,12 +499,24 @@ EXPORT_API int maps_service_geocode_inside_area(const maps_service_h maps,
                                        maps_service_geocode_cb callback,
                                        void *user_data, int *request_id)
 {
-       /*if (!maps || !address || !bounds || !preference || !callback*/
-       if (!maps || !address || !bounds || !callback || !request_id)
+       MAPS_LOG_API;
+       /* Check if the handle of the Maps Service is valid */
+       if (!maps)
                return MAPS_ERROR_INVALID_PARAMETER;
-       if (not __maps_provider_supported(maps,
+
+       /* Check if this API feature available */
+       if (!__maps_provider_supported(maps,
                        MAPS_SERVICE_GEOCODE_INSIDE_AREA))
                return MAPS_ERROR_NOT_SUPPORTED;
+
+       /* Check if parameters are valid */
+       if (!address || !bounds || !callback || !request_id)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Check if privileges enough */
+       if (!__has_maps_service_privilege())
+               return MAPS_ERROR_PERMISSION_DENIED;
+
        return q()->push(new session::command_geocode_inside_bounds(maps,
                        address, bounds, preference, callback, user_data,
                        request_id));
@@ -281,12 +529,24 @@ EXPORT_API int maps_service_geocode_by_structured_address(const maps_service_h
                                        maps_service_geocode_cb callback,
                                        void *user_data, int *request_id)
 {
-       /*if (!maps || !address || !preference || !callback || !request_id)*/
-       if (!maps || !address || !callback || !request_id)
+       MAPS_LOG_API;
+       /* Check if the handle of the Maps Service is valid */
+       if (!maps)
                return MAPS_ERROR_INVALID_PARAMETER;
-       if (not __maps_provider_supported(maps,
+
+       /* Check if this API feature available */
+       if (!__maps_provider_supported(maps,
                        MAPS_SERVICE_GEOCODE_BY_STRUCTURED_ADDRESS))
                return MAPS_ERROR_NOT_SUPPORTED;
+
+       /* Check if parameters are valid */
+       if (!address || !callback || !request_id)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Check if privileges enough */
+       if (!__has_maps_service_privilege())
+               return MAPS_ERROR_PERMISSION_DENIED;
+
        return q()->
                push(new session::command_geocode_by_structured_address(maps,
                        address, preference, callback, user_data, request_id));
@@ -299,15 +559,27 @@ EXPORT_API int maps_service_reverse_geocode(const maps_service_h maps,
                                            callback, void * user_data,
                                            int *request_id)
 {
-       /*if (!maps || !preference || !callback || !request_id)*/
-       if (!maps || !callback || !request_id)
+       MAPS_LOG_API;
+       /* Check if the handle of the Maps Service is valid */
+       if (!maps)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Check if this API feature available */
+       if (!__maps_provider_supported(maps, MAPS_SERVICE_REVERSE_GEOCODE))
+               return MAPS_ERROR_NOT_SUPPORTED;
+
+       /* Check if parameters are valid */
+       if (!callback || !request_id)
                return MAPS_ERROR_INVALID_PARAMETER;
        if (latitude <= -90 && latitude >= 90)
                return MAPS_ERROR_INVALID_PARAMETER;
        if (longitude <= -180 && longitude >= 180)
                return MAPS_ERROR_INVALID_PARAMETER;
-       if (not __maps_provider_supported(maps, MAPS_SERVICE_REVERSE_GEOCODE))
-               return MAPS_ERROR_NOT_SUPPORTED;
+
+       /* Check if privileges enough */
+       if (!__has_maps_service_privilege())
+               return MAPS_ERROR_PERMISSION_DENIED;
+
        return q()->push(new session::command_reverse_geocode(maps, latitude,
                        longitude, preference, callback, user_data,
                        request_id));
@@ -325,11 +597,23 @@ EXPORT_API int maps_service_search_place(const maps_service_h maps,
                                         maps_service_search_place_cb callback,
                                         void *user_data, int *request_id)
 {
-       /*if (!maps || !position || !preference || !filter || !callback*/
-       if (!maps || !position || !filter || !callback || !request_id)
+       MAPS_LOG_API;
+       /* Check if the handle of the Maps Service is valid */
+       if (!maps)
                return MAPS_ERROR_INVALID_PARAMETER;
-       if (not __maps_provider_supported(maps, MAPS_SERVICE_SEARCH_PLACE))
+
+       /* Check if this API feature available */
+       if (!__maps_provider_supported(maps, MAPS_SERVICE_SEARCH_PLACE))
                return MAPS_ERROR_NOT_SUPPORTED;
+
+       /* Check if parameters are valid */
+       if (!position || !filter || !callback || !request_id)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Check if privileges enough */
+       if (!__has_maps_service_privilege())
+               return MAPS_ERROR_PERMISSION_DENIED;
+
        return q()->push(new session::command_search_place(maps, position,
                        distance, preference, filter, callback, user_data,
                        request_id));
@@ -345,12 +629,24 @@ EXPORT_API int maps_service_search_place_by_area(const maps_service_h maps,
                                                 void *user_data,
                                                 int *request_id)
 {
-       /*if (!maps || !boundary || !preference || !filter || !callback*/
-       if (!maps || !boundary || !filter || !callback || !request_id)
+       MAPS_LOG_API;
+       /* Check if the handle of the Maps Service is valid */
+       if (!maps)
                return MAPS_ERROR_INVALID_PARAMETER;
-       if (not __maps_provider_supported(maps,
+
+       /* Check if this API feature available */
+       if (!__maps_provider_supported(maps,
                        MAPS_SERVICE_SEARCH_PLACE_BY_AREA))
                return MAPS_ERROR_NOT_SUPPORTED;
+
+       /* Check if parameters are valid */
+       if (!boundary || !filter || !callback || !request_id)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Check if privileges enough */
+       if (!__has_maps_service_privilege())
+               return MAPS_ERROR_PERMISSION_DENIED;
+
        return q()->push(new session::command_search_by_area_place(maps,
                        boundary, preference, filter, callback, user_data,
                        request_id));
@@ -368,13 +664,24 @@ EXPORT_API int maps_service_search_place_by_address(const maps_service_h maps,
                                                void *user_data,
                                                int *request_id)
 {
-       /*if (!maps || !address || !boundary || !preference || !filter*/
-       if (!maps || !address || !boundary || !filter || !callback
-           || !request_id)
+       MAPS_LOG_API;
+       /* Check if the handle of the Maps Service is valid */
+       if (!maps)
                return MAPS_ERROR_INVALID_PARAMETER;
-       if (not __maps_provider_supported(maps,
+
+       /* Check if this API feature available */
+       if (!__maps_provider_supported(maps,
                        MAPS_SERVICE_SEARCH_PLACE_BY_ADDRESS))
                return MAPS_ERROR_NOT_SUPPORTED;
+
+       /* Check if parameters are valid */
+       if (!address || !boundary || !filter || !callback || !request_id)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Check if privileges enough */
+       if (!__has_maps_service_privilege())
+               return MAPS_ERROR_PERMISSION_DENIED;
+
        return q()->push(new session::command_search_by_address_place(maps,
                        address, boundary, preference, filter, callback,
                        user_data, request_id));
@@ -391,11 +698,23 @@ EXPORT_API int maps_service_search_route(const maps_service_h maps,
                                         maps_service_search_route_cb callback,
                                         void *user_data, int *request_id)
 {
-       /*if (!maps || !preference || !origin || !destination || !callback*/
-       if (!maps || !origin || !destination || !callback || !request_id)
+       MAPS_LOG_API;
+       /* Check if the handle of the Maps Service is valid */
+       if (!maps)
                return MAPS_ERROR_INVALID_PARAMETER;
-       if (not __maps_provider_supported(maps, MAPS_SERVICE_SEARCH_ROUTE))
+
+       /* Check if this API feature available */
+       if (!__maps_provider_supported(maps, MAPS_SERVICE_SEARCH_ROUTE))
                return MAPS_ERROR_NOT_SUPPORTED;
+
+       /* Check if parameters are valid */
+       if (!origin || !destination || !callback || !request_id)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Check if privileges enough */
+       if (!__has_maps_service_privilege())
+               return MAPS_ERROR_PERMISSION_DENIED;
+
        return q()->push(new session::command_search_route(maps, preference,
                        origin, destination, callback, user_data, request_id));
 }
@@ -410,13 +729,24 @@ EXPORT_API int maps_service_search_route_waypoints(const maps_service_h maps,
                                                   void *user_data,
                                                   int *request_id)
 {
-       /*if (!maps || !preference || !waypoint_list || (waypoint_num < 2)*/
-       if (!maps || !waypoint_list || (waypoint_num < 2) || !callback
-           || !request_id)
+       MAPS_LOG_API;
+       /* Check if the handle of the Maps Service is valid */
+       if (!maps)
                return MAPS_ERROR_INVALID_PARAMETER;
-       if (not __maps_provider_supported(maps,
+
+       /* Check if this API feature available */
+       if (!__maps_provider_supported(maps,
                        MAPS_SERVICE_SEARCH_ROUTE_WAYPOINTS))
                return MAPS_ERROR_NOT_SUPPORTED;
+
+       /* Check if parameters are valid */
+       if (!waypoint_list || (waypoint_num < 2) || !callback || !request_id)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Check if privileges enough */
+       if (!__has_maps_service_privilege())
+               return MAPS_ERROR_PERMISSION_DENIED;
+
        return q()->push(new session::command_search_route_waypoints(maps,
                        preference, waypoint_list, waypoint_num, callback,
                        user_data, request_id));
@@ -429,9 +759,47 @@ EXPORT_API int maps_service_search_route_waypoints(const maps_service_h maps,
 EXPORT_API int maps_service_cancel_request(const maps_service_h maps,
                                           int request_id)
 {
-       if (not maps || (request_id < 0))
+       MAPS_LOG_API;
+       /* Check if the handle of the Maps Service is valid */
+       if (!maps)
                return MAPS_ERROR_INVALID_PARAMETER;
-       if (not __maps_provider_supported(maps, MAPS_SERVICE_CANCEL_REQUEST))
+
+       /* Check if this API feature available */
+       if (!__maps_provider_supported(maps, MAPS_SERVICE_CANCEL_REQUEST))
                return MAPS_ERROR_NOT_SUPPORTED;
+
+       /* Check if parameters are valid */
+       if (request_id < 0)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /* Check if privileges enough */
+       if (!__has_maps_service_privilege())
+               return MAPS_ERROR_PERMISSION_DENIED;
+
        return q()->push(new session::command_cancel_request(maps, request_id));
 }
+
+/*----------------------------------------------------------------------------*/
+/* */
+/* Multi geocoder */
+
+EXPORT_API int maps_service_multi_reverse_geocode(const maps_service_h maps,
+                               const maps_coordinates_list_h coordinates_list, const maps_preference_h preference,
+                               maps_service_multi_reverse_geocode_cb callback, void *user_data, int *request_id)
+{
+       if (!maps)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       if (!__maps_provider_supported(maps, MAPS_SERVICE_MULTI_REVERSE_GEOCODE))
+               return MAPS_ERROR_NOT_SUPPORTED;
+
+       if (!coordinates_list || !callback || !request_id)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       if (!__has_maps_service_privilege())
+               return MAPS_ERROR_PERMISSION_DENIED;
+
+       return q()->push(new session::command_multi_reverse_geocode(maps,
+                       coordinates_list, preference, callback, user_data, request_id));
+}
+
index bb31b5843c26ee0f9dfe8db3933550cd6fd83a25..e4e237735b8aa6c03ecd9547c70472c92d9b8de1 100644 (file)
@@ -39,6 +39,8 @@
 #define MAPS_LOGE(fmt,args...)  LOGE(fmt, ##args)
 #define MAPS_SECLOG(fmt,args...)  SECURE_LOGD(fmt, ##args)
 
+#define MAPS_LOG_API  /*MAPS_LOGI("%s", __func__)*/
+
 #define MAPS_CHECK_CONDITION(condition, error, msg)    \
        do { \
                if (condition) { \
@@ -139,6 +141,10 @@ public:
        {
                return current_size;
        }
+       bool empty() const
+       {
+               return size() == 0;
+       }
 };
 
 class string
index 4683be617b4230e344c727ffa0966738da045ff5..571ecc4752b603b407b1c825d5bc89f4185b6b2f 100755 (executable)
@@ -107,6 +107,14 @@ int maps_plugin_reverse_geocode_empty(double latitude, double longitude,
        return 0;
 }
 
+int maps_plugin_multi_reverse_geocode_empty(const maps_coordinates_list_h maps_list,
+                                               const maps_preference_h preference,
+                                               maps_service_multi_reverse_geocode_cb callback,
+                                               void *user_data, int *request_id)
+{
+       return 0;
+}
+
 /* Place */
 int maps_plugin_search_place_empty(const maps_coordinates_h position,
                                   int distance,
@@ -165,6 +173,70 @@ int maps_plugin_cancel_request_empty(int request_id)
        return 0;
 }
 
+/* Mapping */
+int maps_plugin_set_map_view_empty(const map_view_h view)
+{
+       return 0;
+}
+
+int maps_plugin_render_map_empty(const maps_coordinates_h coordinates,
+                                const double zoom_factor,
+                                const double rotation_angle,
+                                maps_plugin_render_map_cb callback,
+                                void* user_data,
+                                int* request_id)
+{
+       return 0;
+}
+
+int maps_plugin_move_center_empty(const int delta_x,
+                                 const int delta_y,
+                                 maps_plugin_render_map_cb callback,
+                                 void* user_data,
+                                 int* request_id)
+{
+       return 0;
+}
+
+int maps_plugin_draw_map_empty(Evas* canvas, const int x, const int y,
+                              const int width, const int height)
+{
+       return 0;
+}
+
+int maps_plugin_on_object_empty(const map_object_h object,
+                                    const map_object_operation_e
+                                    operation)
+{
+       return 0;
+}
+
+int maps_plugin_screen_to_geography_empty(const int x, const int y,
+                                         maps_coordinates_h *coordinates)
+{
+       return 0;
+}
+
+int maps_plugin_geography_to_screen_empty(const maps_coordinates_h coordinates,
+                                         int* x, int* y)
+{
+       return 0;
+}
+
+int maps_plugin_get_min_zoom_level_empty(int *min_zoom_level)
+{
+       return 0;
+}
+
+int maps_plugin_get_max_zoom_level_empty(int *max_zoom_level)
+{
+       return 0;
+}
+
+int maps_plugin_get_center_empty(maps_coordinates_h *coordinates)
+{
+       return 0;
+}
 
 /* Interface of a plugin with all empty functions */
 plugin::interface_s empty_interface = {
@@ -185,6 +257,7 @@ plugin::interface_s empty_interface = {
        maps_plugin_geocode_inside_area_empty,
        maps_plugin_geocode_by_structured_address_empty,
        maps_plugin_reverse_geocode_empty,
+       maps_plugin_multi_reverse_geocode_empty,
 
        /* Place */
        maps_plugin_search_place_empty,
@@ -197,6 +270,18 @@ plugin::interface_s empty_interface = {
 
        /* Cancel Request */
        maps_plugin_cancel_request_empty,
+
+       /* Mapping */
+       maps_plugin_set_map_view_empty,
+       maps_plugin_render_map_empty,
+       maps_plugin_move_center_empty,
+       maps_plugin_draw_map_empty,
+       maps_plugin_on_object_empty,
+       maps_plugin_screen_to_geography_empty,
+       maps_plugin_geography_to_screen_empty,
+       maps_plugin_get_min_zoom_level_empty,
+       maps_plugin_get_max_zoom_level_empty,
+       maps_plugin_get_center_empty
 };
 
 
index 6bb6b193939c92ebee1c09ff018dbd4f2fc096de..ad5ddbb83a406c4106f7c2c6cbefed4195a8e139 100755 (executable)
@@ -24,7 +24,7 @@
 
 extern const char *MAPS_PLUGINS_PATH_PREFIX;
 
- plugin::scope_mutex::scope_mutex(GMutex *m) : mutex(m)
+plugin::scope_mutex::scope_mutex(GMutex *m) : mutex(m)
 {
        g_mutex_lock(mutex);
 }
@@ -155,6 +155,9 @@ maps_plugin_h plugin::binary_extractor::init(const provider_info &info)
                new_plugin->interface.maps_plugin_reverse_geocode =
                        (maps_plugin_reverse_geocode_f) gmod_find_sym(plugin,
                        "maps_plugin_reverse_geocode");
+               new_plugin->interface.maps_plugin_multi_reverse_geocode =
+                       (maps_plugin_multi_reverse_geocode_f)
+                       gmod_find_sym(plugin, "maps_plugin_multi_reverse_geocode");
 
                /* Place */
                new_plugin->interface.maps_plugin_search_place =
@@ -183,10 +186,44 @@ maps_plugin_h plugin::binary_extractor::init(const provider_info &info)
                        (maps_plugin_cancel_request_f) gmod_find_sym(plugin,
                        "maps_plugin_cancel_request");
 
+               /* Mapping */
+               new_plugin->interface.maps_plugin_set_map_view =
+                       (maps_plugin_set_map_view_f) gmod_find_sym(plugin,
+                       "maps_plugin_set_map_view");
+               new_plugin->interface.maps_plugin_render_map =
+                       (maps_plugin_render_map_f) gmod_find_sym(plugin,
+                       "maps_plugin_render_map");
+               new_plugin->interface.maps_plugin_move_center =
+                       (maps_plugin_move_center_f) gmod_find_sym(plugin,
+                       "maps_plugin_move_center");
+               new_plugin->interface.maps_plugin_draw_map =
+                       (maps_plugin_draw_map_f) gmod_find_sym(plugin,
+                       "maps_plugin_draw_map");
+               new_plugin->interface.maps_plugin_on_object =
+                       (maps_plugin_on_object_f) gmod_find_sym(plugin,
+                       "maps_plugin_on_object");
+               new_plugin->interface.maps_plugin_screen_to_geography =
+                       (maps_plugin_screen_to_geography_f)
+                       gmod_find_sym(plugin,
+                       "maps_plugin_screen_to_geography");
+               new_plugin->interface.maps_plugin_geography_to_screen =
+                       (maps_plugin_geography_to_screen_f)
+                       gmod_find_sym(plugin,
+                       "maps_plugin_geography_to_screen");
+               new_plugin->interface.maps_plugin_get_min_zoom_level =
+                       (maps_plugin_get_min_zoom_level_f) gmod_find_sym(plugin,
+                       "maps_plugin_get_min_zoom_level");
+               new_plugin->interface.maps_plugin_get_max_zoom_level =
+                       (maps_plugin_get_max_zoom_level_f) gmod_find_sym(plugin,
+                       "maps_plugin_get_max_zoom_level");
+               new_plugin->interface.maps_plugin_get_center =
+                       (maps_plugin_get_center_f) gmod_find_sym(plugin,
+                       "maps_plugin_get_center");
+
                /* 2.3 Check whether the plugin init function is valid */
                if (!new_plugin->interface.maps_plugin_init) {
-                       MAPS_LOGE(
-                       "ERROR! Plugin initialization function is invalid");
+                       MAPS_LOGE("ERROR! Plugin initialization function is "
+                                 "invalid");
                        break;
                }
 
@@ -196,57 +233,53 @@ maps_plugin_h plugin::binary_extractor::init(const provider_info &info)
                        new_plugin->interface.
                        maps_plugin_init((maps_plugin_h *) (&new_plugin));
                if (ret != MAPS_ERROR_NONE) {
-                       MAPS_LOGE(
-                       "ERROR! Plugin initialization function ""failed: %d",
-                               ret);
+                       MAPS_LOGE("ERROR! Plugin initialization function "
+                                 "failed: %d", ret);
                        break;
                }
 
                if (!new_plugin->interface.maps_plugin_set_provider_key) {
-                       MAPS_LOGE(
-                       "ERROR! Plugin set_provider_key function is NULL: %d",
-                               ret);
+                       MAPS_LOGE("ERROR! Plugin set_provider_key function "
+                                 "is NULL: %d", ret);
                        break;
                }
 
                if (!new_plugin->interface.maps_plugin_get_provider_key) {
-                       MAPS_LOGE(
-                       "ERROR! Plugin set_provider_key function is NULL: %d",
-                               ret);
+                       MAPS_LOGE("ERROR! Plugin set_provider_key function is "
+                                 "NULL: %d", ret);
                        break;
                }
 
                if (!new_plugin->interface.maps_plugin_set_preference) {
-                       MAPS_LOGE(
-                       "ERROR! Plugin set_preference function is NULL: %d",
-                               ret);
+                       MAPS_LOGE("ERROR! Plugin set_preference function is "
+                                 "NULL: %d", ret);
                        break;
                }
 
                if (!new_plugin->interface.maps_plugin_get_preference) {
-                       MAPS_LOGE(
-                       "ERROR! Plugin get_preference function is NULL: %d",
-                               ret);
+                       MAPS_LOGE("ERROR! Plugin get_preference function is "
+                                 "NULL: %d", ret);
                        break;
                }
 
                if (!new_plugin->interface.maps_plugin_is_data_supported) {
-                       MAPS_LOGE(
-                               "ERROR! Plugin support_is_data_supported function is NULL: %d",
-                               ret);
+                       MAPS_LOGE("ERROR! Plugin support_is_data_supported "
+                                 "function is NULL: %d", ret);
                        break;
                }
 
                if (!new_plugin->interface.maps_plugin_is_service_supported) {
-                       MAPS_LOGE(
-                               "ERROR! Plugin support_is_service_supported function is NULL: %d",
-                               ret);
+                       MAPS_LOGE("ERROR! Plugin support_is_service_supported "
+                                 "function is NULL: %d", ret);
                        break;
                }
 
                /* 2.7 Create a queue with asynchronous requests to plugin */
+#ifdef _MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_
                if (session::command_queue::is_async())
+               /* We are going to use this queue for view commands */
                        new_plugin->request_queue = g_async_queue_new();
+#endif /*_MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_*/
 
                /* 2.8 Initialize the mutex for the map of pending requests */
                new_plugin->pending_request_maps =
@@ -290,8 +323,10 @@ void plugin::binary_extractor::shutdown(maps_plugin_h plugin_h)
        session::thread().stop(plugin);
 
        /* 2. Destroy the request queue */
+#ifdef _MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_
        if (plugin->request_queue)
                g_async_queue_unref(plugin->request_queue);
+#endif /* _MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_ */
 
        /* 3. Destroy the map of pending requests */
        if (plugin->pending_request_maps) {
@@ -305,7 +340,7 @@ void plugin::binary_extractor::shutdown(maps_plugin_h plugin_h)
        gmod_free((GMod *) plugin->module);
 
        /* 5. Destroying the table with plugin capabilities */
-       /*maps_string_hashtable_destroy(plugin->capabilities); */
+       /*maps_int_hashtable_destroy(plugin->capabilities); */
 
        /* 6. Release memory used by plugin structure */
        g_slice_free(plugin_s, plugin);
@@ -377,6 +412,7 @@ void plugin::binary_extractor::gmod_free(GMod *gmod) const
        g_free(gmod);
 
        MAPS_LOGD("close module");
+       MAPS_LOGD("last module error: %s", g_module_error());
 }
 
 /* Find the address of a function in a binary (which contains a plugin) */
@@ -416,13 +452,15 @@ void plugin::binary_extractor::trace_dbg(const plugin_s *plugin) const
                MAPS_LOGD("module path:\t\t\t%s", mod->path);
        }
 
+#ifdef _MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_
        if (!plugin->request_queue) {
                MAPS_LOGD("PLUGIN request queue is NULL");
        }
        else {
                MAPS_LOGD("plugin request queue:\t\t\t%p",
-                       plugin->request_queue);
+                         plugin->request_queue);
        }
+#endif /*_MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_ */
 
        const interface_s *itf = &plugin->interface;
        MAPS_LOGD("maps_plugin_init:\t\t\t%p", itf->maps_plugin_init);
@@ -446,6 +484,8 @@ void plugin::binary_extractor::trace_dbg(const plugin_s *plugin) const
                itf->maps_plugin_geocode_by_structured_address);
        MAPS_LOGD("maps_plugin_reverse_geocode:\t\t%p",
                itf->maps_plugin_reverse_geocode);
+       MAPS_LOGD("maps_plugin_multi_reverse_geocode:\t%p",
+               itf->maps_plugin_multi_reverse_geocode);
 
        MAPS_LOGD("maps_plugin_search_place:\t\t%p",
                itf->maps_plugin_search_place);
index aff3a19c9b0a19fd4a79e570313b2ffe6d1fc992..97cf1e242ddb2215a517a5b561559acc25cd2ff6 100644 (file)
@@ -68,6 +68,10 @@ typedef int (*maps_plugin_reverse_geocode_f) (double latitude, double longitude,
                                              maps_service_reverse_geocode_cb
                                              callback,
                                              void *user_data, int *request_id);
+typedef int (*maps_plugin_multi_reverse_geocode_f) (const maps_coordinates_list_h maps_list,
+                                                       const maps_preference_h preference,
+                                                       maps_service_multi_reverse_geocode_cb callback,
+                                                       void *user_data, int *request_id);
 
 /* Place */
 typedef int (*maps_plugin_search_place_f) (const maps_coordinates_h position,
@@ -117,6 +121,32 @@ typedef int (*maps_plugin_search_route_waypoints_f) (const maps_coordinates_h *
 /* Cancel Request */
 typedef int (*maps_plugin_cancel_request_f) (int request_id);
 
+/* Mapping */
+typedef int (*maps_plugin_set_map_view_f) (const map_view_h view);
+typedef int (*maps_plugin_render_map_f) (const maps_coordinates_h coordinates,
+                                       const double zoom_factor,
+                                       const double rotation_angle,
+                                       maps_plugin_render_map_cb callback,
+                                       void* user_data,
+                                       int* request_id);
+typedef int (*maps_plugin_move_center_f) (const int delta_x,
+                                         const int delta_y,
+                                         maps_plugin_render_map_cb callback,
+                                         void* user_data,
+                                         int* request_id);
+typedef int (*maps_plugin_draw_map_f) (Evas* canvas, const int x, const int y,
+                                      const int width, const int height);
+typedef int (*maps_plugin_on_object_f) (const map_object_h object,
+                              const map_object_operation_e operation);
+typedef int (*maps_plugin_screen_to_geography_f) (const int x, const int y,
+                                                 maps_coordinates_h*
+                                                 coordinates);
+typedef int (*maps_plugin_geography_to_screen_f) (const maps_coordinates_h
+                                                 coordinates,
+                                                 int* x, int* y);
+typedef int (*maps_plugin_get_min_zoom_level_f) (int *min_zoom_level);
+typedef int (*maps_plugin_get_max_zoom_level_f) (int *max_zoom_level);
+typedef int (*maps_plugin_get_center_f) (maps_coordinates_h *coordinates);
 
 namespace plugin {
 
@@ -144,6 +174,7 @@ namespace plugin {
                 maps_plugin_geocode_by_structured_address_f
                        maps_plugin_geocode_by_structured_address;
                maps_plugin_reverse_geocode_f maps_plugin_reverse_geocode;
+               maps_plugin_multi_reverse_geocode_f maps_plugin_multi_reverse_geocode;
 
                /* Place */
                maps_plugin_search_place_f maps_plugin_search_place;
@@ -160,13 +191,30 @@ namespace plugin {
                /* Cancel Request */
                maps_plugin_cancel_request_f maps_plugin_cancel_request;
 
+               /* Mapping */
+               maps_plugin_set_map_view_f maps_plugin_set_map_view;
+               maps_plugin_render_map_f maps_plugin_render_map;
+               maps_plugin_move_center_f maps_plugin_move_center;
+               maps_plugin_draw_map_f maps_plugin_draw_map;
+               maps_plugin_on_object_f maps_plugin_on_object;
+               maps_plugin_screen_to_geography_f
+                       maps_plugin_screen_to_geography;
+               maps_plugin_geography_to_screen_f
+                       maps_plugin_geography_to_screen;
+               maps_plugin_get_min_zoom_level_f maps_plugin_get_min_zoom_level;
+               maps_plugin_get_max_zoom_level_f maps_plugin_get_max_zoom_level;
+               maps_plugin_get_center_f maps_plugin_get_center;
+
        } interface_s;
 
        /* Plugin structure */
        typedef struct _plugin_s {
                interface_s interface;  /* Plugin interface function pointers */
                gpointer module;        /* Plugin module pointer, GMod */
+
+#ifdef _MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_
                GAsyncQueue *request_queue;     /* Queue of asynchronous requests */
+#endif /*_MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_*/
                GThread *thread;        /* Request queue thread: there is
                                           happening delivery of request from
                                           app to plugin */
@@ -177,7 +225,7 @@ namespace plugin {
                /* probably, it must be exchanged with event dispite of
                *  performance trade-off */
 
-               /*maps_string_hashtable_h capabilities; // The table of plugin
+               /*maps_int_hashtable_h capabilities; // The table of plugin
                * capabilities */
 
                GMutex pending_request_mutex;   /* Mutex for synchronizing the
@@ -224,4 +272,4 @@ namespace plugin {
        };
 };
 
-#endif                         /* __MAPS_SERVICE_PLUGIN_MODULE_H__ */
\ No newline at end of file
+#endif                         /* __MAPS_SERVICE_PLUGIN_MODULE_H__ */
index 016381bf059354243177ff15560c506d3fe156e6..28a59643705be7752ffe42a54747ea11e0f2c56d 100644 (file)
@@ -23,7 +23,10 @@ extern plugin::plugin_s *__extract_plugin(maps_service_h maps);
 volatile int session::command::command_request_id = 1;
 session::command session::command::empty_instance;
 
-session::command::command(maps_service_h ms) : m(ms), my_req_id(0)
+session::command::command(maps_service_h ms)
+       : m(ms)
+       , my_req_id(0)
+       , is_merged(false)
 {
 }
 
@@ -41,6 +44,7 @@ session::command &session::command::operator =(const command &src)
        if (this != (&src)) {
                m = src.m;
                my_req_id = src.my_req_id;
+               is_merged = src.is_merged;
        }
        return *this;
 }
@@ -80,6 +84,33 @@ plugin::plugin_s *session::command::plugin() const
        return __extract_plugin(m);
 }
 
+session::command_type_e session::command::get_type() const
+{
+       /* Default command type */
+       return MAPS_DATA_COMMAND;
+}
+
+int session::command::get_priority() const
+{
+       /* Default command priority */
+       return 1;
+}
+
+void session::command::merge(const command *c)
+{
+       /* empty */
+}
+
+bool session::command::merged() const
+{
+       return is_merged;
+}
+
+
+void session::command::set_merged()
+{
+       is_merged = true;
+}
 /*----------------------------------------------------------------------------*/
 
 session::command_handler::command_handler(plugin::plugin_s *p, void *ud,
index 1caad947b05bf08e5b13ae4cec1f7030ab8b66f6..60b33f4ee07bd360349d0bf5a04af5eafa3b7728 100644 (file)
 
 namespace session
 {
+       typedef enum _command_type_e {
+               MAPS_DATA_COMMAND,
+               MAP_VIEW_SET_CENTER_COMMAND,
+               MAP_VIEW_MOVE_CENTER_COMMAND,
+               MAP_VIEW_ZOOM_COMMAND,
+               MAP_VIEW_ROTATE_COMMAND,
+               MAP_VIEW_ZOOM_ROTATE_COMMAND,
+               MAP_VIEW_READY_COMMAND,
+               MAPS_UNDEF_COOMAND = -1
+       } command_type_e;
 
 /*----------------------------------------------------------------------------*/
 
@@ -31,6 +41,7 @@ namespace session
                maps_service_h m;
        protected:
                int my_req_id;
+               bool is_merged;
        public:
                static volatile int command_request_id;
        public:
@@ -57,6 +68,14 @@ namespace session
                maps_plugin_h handle() const;
        public:
                plugin::plugin_s *plugin()const;
+       public:
+               virtual command_type_e get_type() const;
+               virtual int get_priority() const;
+               virtual void merge(const command *c);
+       public:
+               bool merged() const;
+       protected:
+               void set_merged();
        };
 
 /*----------------------------------------------------------------------------*/
@@ -127,4 +146,4 @@ namespace session
        };
 }
 
-#endif                         /* __MAPS_SERVICE_SESSION_COMMAND_H__ */
\ No newline at end of file
+#endif                         /* __MAPS_SERVICE_SESSION_COMMAND_H__ */
index d6fdcf9207d61561fa3f560582f91cbcc850ec9c..c3078391a80d597c512b5110fe48caae7fbe5f38 100644 (file)
 
 session::command_queue *session::command_queue::interface()
 {
-       if (is_async()) {
 #ifdef _MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_
+       if (is_async()) {
                static command_queue_async async_queue;
                return &async_queue;
-#else
-               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;
        }
+#else
+       static command_queue_sync sync_queue;
+       return &sync_queue;
+#endif /* _MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_ */
 }
 
 /*----------------------------------------------------------------------------*/
@@ -92,11 +91,158 @@ session::command *session::command_queue_async::pop(plugin::plugin_s *p)
        /* 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,
-               300 * G_TIME_SPAN_MILLISECOND);
+                                       /*300 * G_TIME_SPAN_MILLISECOND);*/
+                                       /* Small timeout is better for UI */
+                                       10 * G_TIME_SPAN_MILLISECOND);
        return (c) ? c : command::empty_ptr();
 }
 
-void session::command_queue_async::process(plugin::plugin_s *p)
+void session::command_queue_async::process(plugin::plugin_s* p)
+{
+       if (not p or not p->request_queue)
+               return;
+
+       queue_autoref(p->request_queue);
+       pop(p)->run();
+}
+
+void session::command_queue_async::clear(plugin::plugin_s* p)
+{
+       if (not p or not p->request_queue)
+               return;
+
+       queue_autoref(p->request_queue);
+       while (g_async_queue_length(p->request_queue))
+               pop(p)->destroy();
+}
+
+
+/*----------------------------------------------------------------------------*/
+
+session::command_queue* session::command_queue_view::interface()
+{
+       static command_queue_view view_queue;
+       return &view_queue;
+}
+
+/*static int __dbg_queue_length = 0;*/
+
+gint session::command_queue_view::iterate(gconstpointer a,
+                                         gconstpointer b,
+                                         gpointer user_data)
+{
+       /*__dbg_queue_length ++;*/
+
+       /* Extracting command data from params */
+       command *ca = (command *)a;
+       command *cb = (command *)b;
+       command *c_new = (command *)user_data;
+
+       /* 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()) {
+                       ca->merge(c_new);
+                       //c_new->set_merged();
+               } else if(cb->get_type() == c_new->get_type()) {
+                       cb->merge(c_new);
+                       //c_new->set_merged();
+               }
+       }
+
+       /* Sorting the commands in the que with their prioirties:
+        * the lower priority, the far the command from the queue front
+        *
+        * https://developer.gnome.org/glib/stable/
+        *      glib-Asynchronous-Queues.html#g-async-queue-sort */
+       const int pa = ca->get_priority();
+       const int pb = cb->get_priority();
+       return (pa < pb ? +1 : pa == pb ? 0 : -1);
+}
+
+int session::command_queue_view::push(command* c)
+{
+       /*g_print("session::command_queue_view::push "
+                       "pushed a command: %p\n", c);*/
+       if(c == command::empty_ptr())
+               return MAPS_ERROR_NONE;
+
+       if (!c || !c->plugin() || !c->plugin()->request_queue)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+
+       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);
+               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,
+                           session::command_queue_view::iterate, c);
+       /*g_print("Queue Length: %d\n", __dbg_queue_length);*/
+
+       /* If the command was merged, it is not needed any more.
+        * If the command data was not merged to the existing command instance
+        * of the same type, we should:
+        *   a. add this command to the queue and
+        *   b. sort the queue once again without any attempt to update
+        *  existing commands
+        *
+        * https://developer.gnome.org/glib/stable/
+        *      glib-Asynchronous-Queues.html#g-async-queue-push-sorted */
+       if(c->merged())
+               delete c;
+       else
+               g_async_queue_push_sorted (c->plugin()->request_queue, c,
+                                          session::command_queue_view::iterate,
+                                          NULL);
+
+       return MAPS_ERROR_NONE;
+}
+
+session::command* session::command_queue_view::pop(plugin::plugin_s* p)
+{
+       /*g_print("session::command_queue_view::pop\n");*/
+       if (!p || !p->request_queue)
+               return command::empty_ptr();
+
+       queue_autoref(p->request_queue);
+
+       /*
+        * Pops data from the queue.
+        * If the queue is empty, blocks for timeout microseconds, or until data
+        * becomes available.
+        * If no data is received before the timeout, NULL is returned.
+        * 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,
+                                       /*300 * G_TIME_SPAN_MILLISECOND);*/
+                                       /* Small timeout is better for UI */
+                                       10 * G_TIME_SPAN_MILLISECOND);
+       /*if(c)
+               g_print("session::command_queue_view::pop "
+                       "extracted a command: %p\n", c);*/
+       return (c) ? c : command::empty_ptr();
+}
+
+void session::command_queue_view::process(plugin::plugin_s *p)
 {
        if (!p || !p->request_queue)
                return;
@@ -105,7 +251,7 @@ void session::command_queue_async::process(plugin::plugin_s *p)
        pop(p)->run();
 }
 
-void session::command_queue_async::clear(plugin::plugin_s *p)
+void session::command_queue_view::clear(plugin::plugin_s *p)
 {
        if (!p || !p->request_queue)
                return;
@@ -114,4 +260,5 @@ void session::command_queue_async::clear(plugin::plugin_s *p)
        while (g_async_queue_length(p->request_queue))
                pop(p)->destroy();
 }
+
 #endif /* _MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_ */
index 11d2ebb1c9ff2b912f405fe3d4884737523e0dab..643f44185e10a470f5e4f7ea37f2c80651a84ee5 100644 (file)
@@ -19,6 +19,8 @@
 
 #include "module.h"
 
+/*#define _MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_*/
+
 namespace session
 {
 
@@ -33,10 +35,12 @@ namespace session
                virtual void clear(plugin::plugin_s *p) = 0;
        public:
                static command_queue *interface();
+#ifdef _MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_
                static bool is_async()
                {
-                       return false;
+                       return true;
                }
+#endif /*_MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_*/
        };
 
        class command_queue_sync:public command_queue
@@ -61,7 +65,6 @@ namespace session
  * This is the implementation of asynchronous queue.
  * In order to pass code coverage tests it is blocked.
  */
-/*#define _MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_*/
 #ifdef _MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_
        class command_queue_async:public command_queue
        {
@@ -80,7 +83,34 @@ namespace session
 
                friend class command_queue;
        };
-#endif /* _MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_ */
+
+       /*
+        * This queue is intended to process mainly the commands, assigned to
+        * user gestures
+        */
+       class command_queue_view : public command_queue
+       {
+       private:
+               command_queue_view()
+               {
+               }
+               virtual ~command_queue_view()
+               {
+               }
+       public:
+               static command_queue* interface();
+       private:
+               virtual int push(command *c);
+               virtual command *pop(plugin::plugin_s *p);
+               virtual void process(plugin::plugin_s *p);
+               virtual void clear(plugin::plugin_s *p);
+
+               friend class command_queue;
+       private:
+               static gint iterate(gconstpointer a,
+                                   gconstpointer b,
+                                   gpointer user_data);
+       };
 
        class queue_autoref
        {
@@ -96,6 +126,7 @@ namespace session
                        g_async_queue_unref(q);
                }
        };
+#endif /* _MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_ */
 
 };
 
old mode 100755 (executable)
new mode 100644 (file)
index 81d49ae..df86e07
 #include "maps_place_private.h"
 #include "maps_route_private.h"
 #include "empty_module.h"
+#include "maps_extra_types_private.h"
+
+extern int _map_view_move_center(map_view_h view,
+                                const int delta_x,
+                                const int delta_y);
+
+extern int _map_view_set_zoom_rotate(map_view_h view,
+                                    const bool zoom_changed,
+                                    const double zoom_factor,
+                                    const bool rotation_changed,
+                                    const double rotation_angle);
 
 static int __put_to_hashtable(session::command_handler *ch,
                              maps_service_data_e feature,
-                             const char *feature_str,
-                             maps_string_hashtable_h t)
+                             maps_int_hashtable_h t)
 {
-       if (!ch || !feature_str || !t)
+       if (!ch || !t)
                return MAPS_ERROR_INVALID_PARAMETER;
        bool supported = false;
        ch->plugin()->interface.maps_plugin_is_data_supported(feature,
-               &supported);
-       return (supported) ? maps_string_hashtable_set(t, feature_str,
-               feature_str) : MAPS_ERROR_NONE;
+                                                             &supported);
+       if(supported)
+               return  maps_int_hashtable_set(t, feature, feature);
+       return MAPS_ERROR_NONE;
 }
 
 /*----------------------------------------------------------------------------*/
@@ -439,6 +450,117 @@ void session::command_reverse_geocode_handler::foreach_reverse_geocode_cb(
        pr.remove(handler->user_req_id);
 }
 
+/*----------------------------------------------------------------------------*/
+/*typedef int (*maps_plugin_multi_reverse_geocode_f) (maps_service_h maps,
+* maps_coordinates_list_h maps_list, maps_preference_h preference,
+* maps_service_multi_reverse_geocode_cb callback, void * user_data, int *request_id) */
+session::command_multi_reverse_geocode::command_multi_reverse_geocode(
+                       maps_service_h ms, const maps_coordinates_list_h list, const maps_item_hashtable_h pref,
+                       maps_service_multi_reverse_geocode_cb cb, void *ud, int *request_id)
+ : command(ms)
+ , maps_list(NULL)
+ , preference(NULL)
+ , callback(cb)
+ , user_data(ud)
+ , error(0)
+{
+       *request_id = command::command_request_id++;
+       my_req_id = *request_id;
+
+       int list_size = 0;
+       maps_coordinates_list_get_length(list, &list_size);
+       if (list_size < 2 || list_size > 100)
+               error = MAPS_ERROR_INVALID_PARAMETER;
+
+       if (pref && (maps_item_hashtable_clone(pref, &preference) != MAPS_ERROR_NONE))
+               error = MAPS_ERROR_INVALID_PARAMETER;
+
+       maps_list = list;
+}
+
+session::command_multi_reverse_geocode::~command_multi_reverse_geocode()
+{
+       maps_item_hashtable_destroy(preference);
+}
+
+int session::command_multi_reverse_geocode::run()
+{
+       if (error != MAPS_ERROR_NONE)
+               return error;
+
+       pending_request pr(plugin());
+
+       /* Get the plugin interface function */
+       maps_plugin_multi_reverse_geocode_f func =
+               interface()->maps_plugin_multi_reverse_geocode;
+
+       command_multi_reverse_geocode_handler *handler = NULL;
+       if (func) {
+               /* No need to create the handler when the function is NULL */
+               pr.add(my_req_id);
+               handler = new command_multi_reverse_geocode_handler(plugin(), callback, user_data, my_req_id);
+
+               if (handler) {
+                       /* Run the plugin interface function */
+                       error = func(maps_list, preference,
+                                               command_multi_reverse_geocode_handler::foreach_multi_reverse_geocode_cb,
+                                               handler, &handler->plg_req_id);
+
+                       pr.update(my_req_id, handler);
+
+                       MAPS_LOGD("session::command_multi_reverse_geocode::run: %d", my_req_id);
+               }
+               else {
+                       error = MAPS_ERROR_OUT_OF_MEMORY;
+               }
+       }
+       else {
+               /* Plugin Function is NULL: use default empty function */
+               /*
+               func = plugin::get_empty_interface().
+                       maps_plugin_multi_reverse_geocode;
+               */
+               MAPS_LOGE("MAPS_ERROR_NOT_SUPPORTED: Can't get any plugin");
+               error = MAPS_ERROR_NOT_SUPPORTED;
+       }
+
+       const int ret = error;
+       destroy();
+       return ret;
+}
+
+session::command_multi_reverse_geocode_handler::command_multi_reverse_geocode_handler(
+                       plugin::plugin_s *p, maps_service_multi_reverse_geocode_cb cb, void *ud, int urid)
+ : command_handler(p, ud, urid)
+ , callback(cb)
+{
+}
+
+bool session::command_multi_reverse_geocode_handler::foreach_multi_reverse_geocode_cb(
+                       maps_error_e error, int request_id, int total, maps_coordinates_list_h address_list, void *user_data)
+{
+       command_multi_reverse_geocode_handler *handler =
+               (command_multi_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",
+                       request_id, handler->plg_req_id);
+       }
+
+       /* Make a user's copy of result data */
+       maps_coordinates_list_h cloned_result = NULL;
+       cloned_result = address_list;
+
+       /* Send data to user */
+       const bool b = handler->callback(error, handler->user_req_id, total, cloned_result, handler->user_data);
+       /*if(index>=(total-1)) */
+
+       pending_request pr(handler->plugin());
+       pr.remove(handler->user_req_id);
+
+       return b;
+}
+
 /*----------------------------------------------------------------------------*/
 /*typedef int (*maps_plugin_search_place_f)(maps_service_h maps,
 * maps_coordinates_h position, int distance, maps_item_hashtable_h preference,
@@ -542,33 +664,23 @@ void session::command_search_place_handler::set_supported_data(maps_place_h
        if (!place || !plugin())
                return;
 
-       maps_string_hashtable_h data_supported = NULL;
-       if (maps_string_hashtable_create(&data_supported) != MAPS_ERROR_NONE)
+       maps_int_hashtable_h data_supported = NULL;
+       if (maps_int_hashtable_create(&data_supported) != MAPS_ERROR_NONE)
                return;
 
-       __put_to_hashtable(this, MAPS_PLACE_ADDRESS, _S(MAPS_PLACE_ADDRESS),
-               data_supported);
-       __put_to_hashtable(this, MAPS_PLACE_RATING, _S(MAPS_PLACE_RATING),
-               data_supported);
-       __put_to_hashtable(this, MAPS_PLACE_CATEGORIES,
-               _S(MAPS_PLACE_CATEGORIES), data_supported);
-       __put_to_hashtable(this, MAPS_PLACE_ATTRIBUTES,
-               _S(MAPS_PLACE_ATTRIBUTES), data_supported);
-       __put_to_hashtable(this, MAPS_PLACE_CONTACTS, _S(MAPS_PLACE_CONTACTS),
-               data_supported);
-       __put_to_hashtable(this, MAPS_PLACE_EDITORIALS,
-               _S(MAPS_PLACE_EDITORIALS), data_supported);
-       __put_to_hashtable(this, MAPS_PLACE_REVIEWS, _S(MAPS_PLACE_REVIEWS),
-               data_supported);
-       __put_to_hashtable(this, MAPS_PLACE_IMAGE, _S(MAPS_PLACE_IMAGE),
-               data_supported);
-       __put_to_hashtable(this, MAPS_PLACE_SUPPLIER, _S(MAPS_PLACE_SUPPLIER),
-               data_supported);
-       __put_to_hashtable(this, MAPS_PLACE_RELATED, _S(MAPS_PLACE_RELATED),
-               data_supported);
+       __put_to_hashtable(this, MAPS_PLACE_ADDRESS, data_supported);
+       __put_to_hashtable(this, MAPS_PLACE_RATING, data_supported);
+       __put_to_hashtable(this, MAPS_PLACE_CATEGORIES, data_supported);
+       __put_to_hashtable(this, MAPS_PLACE_ATTRIBUTES, data_supported);
+       __put_to_hashtable(this, MAPS_PLACE_CONTACTS, data_supported);
+       __put_to_hashtable(this, MAPS_PLACE_EDITORIALS, data_supported);
+       __put_to_hashtable(this, MAPS_PLACE_REVIEWS, data_supported);
+       __put_to_hashtable(this, MAPS_PLACE_IMAGE, data_supported);
+       __put_to_hashtable(this, MAPS_PLACE_SUPPLIER, data_supported);
+       __put_to_hashtable(this, MAPS_PLACE_RELATED, data_supported);
 
        _maps_place_set_supported_data(place, data_supported);
-       maps_string_hashtable_destroy(data_supported);
+       maps_int_hashtable_destroy(data_supported);
 }
 
 bool session::command_search_place_handler::foreach_place_cb(maps_error_e error,
@@ -673,12 +785,14 @@ int session::command_search_by_area_place::run()
 
                        /* Run the plugin interface function */
                        error = func(boundary, filter,
-                               preference, command_search_place_handler::foreach_place_cb,
+                               preference,
+                               command_search_place_handler::foreach_place_cb,
                                handler, &handler->plg_req_id);
 
                        pr.update(my_req_id, handler);
 
-                       MAPS_LOGD("session::command_search_by_area_place::run: %d", my_req_id);
+                       MAPS_LOGD("session::command_search_by_area_place::run: %d",
+                                 my_req_id);
                }
                else {
                        error = MAPS_ERROR_OUT_OF_MEMORY;
@@ -762,9 +876,11 @@ int session::command_search_by_address_place::run()
                                                           my_req_id);
                if (handler) {
                        /* Run the plugin interface function */
-                       error = func(address.c_str(), boundary, filter, preference,
-                                        command_search_place_handler::foreach_place_cb, handler,
-                                        &handler->plg_req_id);
+                       error = func(address.c_str(), boundary, filter,
+                                    preference,
+                                    command_search_place_handler::foreach_place_cb,
+                                    handler,
+                                    &handler->plg_req_id);
 
                        pr.update(my_req_id, handler);
 
@@ -859,7 +975,8 @@ int session::command_search_route::run()
 
                        pr.update(my_req_id, handler);
 
-                       MAPS_LOGD("session::command_search_route::run: %d", my_req_id);
+                       MAPS_LOGD("session::command_search_route::run: %d",
+                                 my_req_id);
                }
                else {
                        error = MAPS_ERROR_OUT_OF_MEMORY;
@@ -949,12 +1066,14 @@ int session::command_search_route_waypoints::run()
                if (handler) {
                        /* Run the plugin interface function */
                        error = func(waypoint_list, waypoint_num, 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_place::run: %d", my_req_id);
+                       MAPS_LOGD("session::command_search_place::run: %d",
+                                 my_req_id);
                }
                else {
                        error = MAPS_ERROR_OUT_OF_MEMORY;
@@ -990,19 +1109,16 @@ void session::command_search_route_handler::set_supported_data(maps_route_h
        if (!route || !plugin())
                return;
 
-       maps_string_hashtable_h data_supported = NULL;
-       if (maps_string_hashtable_create(&data_supported) != MAPS_ERROR_NONE)
+       maps_int_hashtable_h data_supported = NULL;
+       if (maps_int_hashtable_create(&data_supported) != MAPS_ERROR_NONE)
                return;
 
-       __put_to_hashtable(this, MAPS_ROUTE_PATH, _S(MAPS_ROUTE_PATH),
-               data_supported);
-       __put_to_hashtable(this, MAPS_ROUTE_SEGMENTS_PATH,
-               _S(MAPS_ROUTE_SEGMENTS_PATH), data_supported);
-       __put_to_hashtable(this, MAPS_ROUTE_SEGMENTS_MANEUVERS,
-               _S(MAPS_ROUTE_SEGMENTS_MANEUVERS), data_supported);
+       __put_to_hashtable(this, MAPS_ROUTE_PATH, data_supported);
+       __put_to_hashtable(this, MAPS_ROUTE_SEGMENTS_PATH, data_supported);
+       __put_to_hashtable(this, MAPS_ROUTE_SEGMENTS_MANEUVERS, data_supported);
 
        _maps_route_set_supported_data(route, data_supported);
-       maps_string_hashtable_destroy(data_supported);
+       maps_int_hashtable_destroy(data_supported);
 }
 
 bool session::command_search_route_handler::foreach_route_cb(maps_error_e error,
@@ -1016,9 +1132,9 @@ bool session::command_search_route_handler::foreach_route_cb(maps_error_e error,
                (command_search_route_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",
-                       request_id, handler->plg_req_id);
+               MAPS_LOGE("\n\nERROR! Incorrect request "
+                         "id [%d] come from the plugin; expected [%d]\n\n",
+                         request_id, handler->plg_req_id);
        }
 
        /* Make a user's copy of result data */
@@ -1055,8 +1171,284 @@ int session::command_cancel_request::run()
                (pr.contains(request_id)) ? interface()->
                maps_plugin_cancel_request(pr.
                extract_plg_id(request_id)) : MAPS_ERROR_NOT_FOUND;
+       destroy();
+       return error;
+}
+
+
+/*----------------------------------------------------------------------------*/
+/*
+ *             Mapping API commands
+ */
+/*----------------------------------------------------------------------------*/
+
+session::command_view_set_center::command_view_set_center(maps_service_h ms,
+                                                          map_view_h view,
+                                               const maps_coordinates_h coords)
+       : command(ms)
+       , v(view)
+       , c(NULL)
+{
+       maps_coordinates_clone(coords, &c);
+}
+
+session::command_view_set_center::~command_view_set_center()
+{
+       maps_coordinates_destroy(c);
+}
+
+int session::command_view_set_center::run()
+{
+       { /* TODO: remove it in release */
+               double lat = 0, lon = 0;
+               maps_coordinates_get_latitude_longitude(c, &lat, &lon);
+               MAPS_LOGD("session::command_view_set_center::run lat,lon=%f,%f",
+                         lat, lon);
+       }
+
+       if(!v)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       int error = MAPS_ERROR_NONE;
+       do {
+               error = map_view_set_center(v, c);
+               if(error != MAPS_ERROR_NONE)
+                       break;
+
+       } while(false);
 
        const int ret = error;
        destroy();
        return ret;
 }
+
+session::command_type_e session::command_view_set_center::get_type() const
+{
+       return MAP_VIEW_SET_CENTER_COMMAND;
+}
+
+int session::command_view_set_center::get_priority() const
+{
+       return 3;
+}
+
+void session::command_view_set_center::merge(const command *c)
+{
+       if (!c || (get_type() != c->get_type())) return;
+       command_view_set_center *cmd = (command_view_set_center *)c;
+       if (v == cmd->v) {
+               double lat = .0;
+               double lon = .0;
+               maps_coordinates_get_latitude_longitude(cmd->c, &lat, &lon);
+               maps_coordinates_set_latitude_longitude(this->c, lat, lon);
+               cmd->set_merged();
+       }
+}
+
+
+/*----------------------------------------------------------------------------*/
+
+
+session::command_view_move_center::command_view_move_center(maps_service_h ms,
+                                                          map_view_h view,
+                                                          const int delta_x,
+                                                          const int delta_y)
+       : command(ms)
+       , v(view)
+       , _delta_x(delta_x)
+       , _delta_y(delta_y)
+{
+}
+
+session::command_view_move_center::~command_view_move_center()
+{
+}
+
+int session::command_view_move_center::run()
+{
+       MAPS_LOGD("session::command_view_move_center::run "
+                 "delta_x = %d, delta_y = %d",
+                 _delta_x, _delta_y);
+
+       if(!v)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       int error = MAPS_ERROR_NONE;
+       do {
+               error = _map_view_move_center(v, _delta_x, _delta_y);
+               if(error != MAPS_ERROR_NONE)
+                       break;
+
+       } while(false);
+
+       const int ret = error;
+       destroy();
+       return ret;
+}
+
+session::command_type_e session::command_view_move_center::get_type() const
+{
+       return MAP_VIEW_MOVE_CENTER_COMMAND;
+}
+
+int session::command_view_move_center::get_priority() const
+{
+       return 3;
+}
+
+void session::command_view_move_center::merge(const command *c)
+{
+       if (!c || (get_type() != c->get_type())) return;
+       command_view_move_center *cmd = (command_view_move_center *)c;
+       if (v == cmd->v) {
+               _delta_x += cmd->_delta_x;
+               _delta_y += cmd->_delta_y;
+               cmd->set_merged();
+       }
+}
+
+/*----------------------------------------------------------------------------*/
+
+int session::command_view_zoom::run()
+{
+       MAPS_LOGD ("session::command_view_zoom::run factor = %f", zoom_factor);
+
+       if (!v)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       const int ret = map_view_set_zoom_factor (v, zoom_factor);
+
+       destroy ();
+       return ret;
+}
+
+session::command_type_e session::command_view_zoom::get_type() const
+{
+       return MAP_VIEW_ZOOM_COMMAND;
+}
+
+int session::command_view_zoom::get_priority() const
+{
+       return 2;
+}
+
+void session::command_view_zoom::merge(const command *c)
+{
+       if (!c || (get_type() != c->get_type())) return;
+       command_view_zoom *cmd = (command_view_zoom *)c;
+       if (v == cmd->v) {
+               zoom_factor = cmd->zoom_factor;
+               cmd->set_merged ();
+       }
+}
+
+/*----------------------------------------------------------------------------*/
+int session::command_view_rotate::run()
+{
+       MAPS_LOGD ("session::command_view_rotate::run angle = %f",
+                 rotation_angle);
+
+       if (!v)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       const int ret = map_view_set_orientation(v, rotation_angle);
+
+       destroy ();
+       return ret;
+}
+
+session::command_type_e session::command_view_rotate::get_type() const
+{
+       return MAP_VIEW_ROTATE_COMMAND;
+}
+
+int session::command_view_rotate::get_priority() const
+{
+       return 2;
+}
+
+void session::command_view_rotate::merge(const command *c)
+{
+       if (!c || (get_type() != c->get_type())) return;
+       command_view_rotate *cmd = (command_view_rotate *)c;
+       if (v == cmd->v) {
+               rotation_angle += cmd->rotation_angle;
+               cmd->set_merged();
+       }
+}
+
+/*----------------------------------------------------------------------------*/
+
+int session::command_view_zoom_rotate::run()
+{
+       MAPS_LOGD ("session::command_view_zoom_rotate::run "
+                  "factor = %f, angle = %f",
+                  zoom_factor, rotation_angle);
+
+       if (!v)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       const int ret = _map_view_set_zoom_rotate(v,
+                                                 true, zoom_factor,
+                                                 true, rotation_angle);
+
+       destroy ();
+       return ret;
+}
+
+session::command_type_e session::command_view_zoom_rotate::get_type() const
+{
+       return MAP_VIEW_ZOOM_ROTATE_COMMAND;
+}
+
+int session::command_view_zoom_rotate::get_priority() const
+{
+       return 2;
+}
+
+void session::command_view_zoom_rotate::merge(const command *c)
+{
+       if (!c || (get_type() != c->get_type())) return;
+       command_view_zoom_rotate *cmd = (command_view_zoom_rotate *)c;
+       if (v == cmd->v) {
+               zoom_factor = cmd->zoom_factor;
+               rotation_angle += cmd->rotation_angle;
+               cmd->set_merged();
+       }
+}
+
+/*----------------------------------------------------------------------------*/
+extern int __map_view_ready(map_view_h view);
+
+int session::command_view_ready::run()
+{
+       MAPS_LOGD ("session::command_view_ready::run");
+
+       if (!v)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       const int ret = __map_view_ready(v);
+
+       destroy ();
+       return ret;
+}
+
+
+session::command_type_e session::command_view_ready::get_type() const
+{
+       return MAP_VIEW_READY_COMMAND;
+}
+
+int session::command_view_ready::get_priority() const
+{
+       return 1;
+}
+
+void session::command_view_ready::merge(const command *c)
+{
+       /*g_print("+");*/
+       if (!c || (get_type() != c->get_type())) return;
+       command_view_ready *cmd = (command_view_ready *)c;
+       if (v == cmd->v)
+               cmd->set_merged ();
+}
index bf3425b1e5fda0aa646c609318e47988bafd9609..228ba90531a460f781d21a209001429c854a1861 100644 (file)
@@ -18,6 +18,7 @@
 #define __MAPS_SERVICE_SESSION_COMMANDS_H__
 
 #include "command.h"
+#include "map_view.h"
 
 namespace session
 {
@@ -253,6 +254,78 @@ namespace session
                friend class command_reverse_geocode;
        };
 
+/*----------------------------------------------------------------------------*/
+       /*typedef int (*maps_plugin_multi_reverse_geocode_f)(maps_service_h maps,
+       * maps_maps_h maps_list, maps_preference_h preference,
+       * maps_service_multi_reverse_geocode_cb callback, void *user_data, * int *request_id); */
+       class command_multi_reverse_geocode : public command
+       {
+       public:
+               const string address;
+               maps_coordinates_list_h maps_list;
+               maps_item_hashtable_h preference;
+               maps_service_multi_reverse_geocode_cb callback;
+               void *user_data;
+               int error;
+       public:
+               command_multi_reverse_geocode(maps_service_h ms,
+                                        const maps_coordinates_list_h maps_list,
+                                        const maps_item_hashtable_h preference,
+                                        maps_service_multi_reverse_geocode_cb callback,
+                                        void *user_data, int *request_id);
+               virtual ~command_multi_reverse_geocode();
+       private:
+               command_multi_reverse_geocode() : command(NULL)
+               {
+               }
+               command_multi_reverse_geocode(const command_multi_reverse_geocode &src)
+                        : command(NULL)
+               {
+               }
+               command_multi_reverse_geocode& operator=(
+                       const command_multi_reverse_geocode &src)
+               {
+                       return *this;
+               }
+       private:
+               virtual int run();
+       };
+
+       class command_multi_reverse_geocode_handler : public command_handler
+       {
+               maps_service_multi_reverse_geocode_cb callback;
+       public:
+               command_multi_reverse_geocode_handler(plugin::plugin_s *plugin,
+                                                maps_service_multi_reverse_geocode_cb callback,
+                                                void *user_data,
+                                                int user_req_id);
+               virtual ~command_multi_reverse_geocode_handler()
+               {
+               };
+       private:
+               command_multi_reverse_geocode_handler()
+                        : command_handler(NULL, NULL, 0)
+               {
+               }
+               command_multi_reverse_geocode_handler(
+                       command_multi_reverse_geocode_handler &src)
+                        : command_handler(NULL, NULL, 0)
+               {
+               }
+               command_multi_reverse_geocode_handler &operator=(
+                       const command_multi_reverse_geocode_handler &src)
+               {
+                       return *this;
+               }
+       private:
+               static bool foreach_multi_reverse_geocode_cb(maps_error_e result,
+                                                      int request_id,
+                                                          int total,
+                                                          maps_coordinates_list_h address_list,
+                                                      void *user_data);
+               friend class command_multi_reverse_geocode;
+       };
+
 /*----------------------------------------------------------------------------*/
        /*typedef int (*maps_plugin_search_place_f)(maps_service_h maps,
        * maps_coordinates_h position, int distance,
@@ -570,6 +643,138 @@ namespace session
        private:
                virtual int run();
        };
+
+
+/*----------------------------------------------------------------------------*/
+/*
+ *             Mapping API commands
+ */
+/*----------------------------------------------------------------------------*/
+
+       class command_view_set_center : public command {
+       private:
+               map_view_h v;
+       public:
+               maps_coordinates_h c;
+       public:
+               command_view_set_center(maps_service_h ms, map_view_h view,
+                                       const maps_coordinates_h coords);
+               virtual ~command_view_set_center();
+       private:
+               virtual int run();
+       private:
+               virtual command_type_e get_type() const;
+               virtual int get_priority() const;
+               virtual void merge(const command *c);
+       };
+
+       class command_view_move_center : public command {
+       private:
+               map_view_h v;
+       public:
+               int _delta_x;
+               int _delta_y;
+       public:
+               command_view_move_center(maps_service_h ms, map_view_h view,
+                                        const int delta_x, const int delta_y);
+               virtual ~command_view_move_center();
+       private:
+               virtual int run();
+       private:
+               virtual command_type_e get_type() const;
+               virtual int get_priority() const;
+               virtual void merge(const command *c);
+       };
+
+       class command_view_zoom : public command {
+       private:
+               map_view_h v;
+       public:
+               double zoom_factor;
+       public:
+               command_view_zoom(maps_service_h ms, map_view_h view,
+                                 const double  &factor) :
+                       command(ms), v(view), zoom_factor(factor)
+               {
+               }
+               virtual ~command_view_zoom()
+               {
+               }
+       private:
+               virtual int run();
+       private:
+               virtual command_type_e get_type() const;
+               virtual int get_priority() const;
+               virtual void merge(const command *c);
+       };
+
+       class command_view_rotate : public command {
+       private:
+               map_view_h v;
+       public:
+               double rotation_angle;
+       public:
+               command_view_rotate(maps_service_h ms, map_view_h view,
+                                   const double  &angle) :
+                       command(ms), v(view), rotation_angle(angle)
+               {
+               }
+               virtual ~command_view_rotate()
+               {
+               }
+       private:
+               virtual int run();
+       private:
+               virtual command_type_e get_type() const;
+               virtual int get_priority() const;
+               virtual void merge(const command *c);
+       };
+
+       class command_view_zoom_rotate : public command {
+       private:
+               map_view_h v;
+       public:
+               double zoom_factor;
+               double rotation_angle;
+       public:
+               command_view_zoom_rotate(maps_service_h ms, map_view_h view,
+                                        const double  &factor,
+                                        const double  &angle)
+                       : command(ms)
+                         , v(view)
+                         , zoom_factor(factor)
+                         , rotation_angle(angle)
+               {
+               }
+               virtual ~command_view_zoom_rotate()
+               {
+               }
+       private:
+               virtual int run();
+       private:
+               virtual command_type_e get_type() const;
+               virtual int get_priority() const;
+               virtual void merge(const command *c);
+       };
+
+       class command_view_ready : public command {
+       private:
+               map_view_h v;
+       public:
+               command_view_ready(maps_service_h ms, map_view_h view) :
+                       command(ms), v(view)
+               {
+               }
+               virtual ~command_view_ready()
+               {
+               }
+       private:
+               virtual int run();
+       private:
+               virtual command_type_e get_type() const;
+               virtual int get_priority() const;
+               virtual void merge(const command *c);
+       };
 }
 
 #endif                         /* __MAPS_SERVICE_SESSION_COMMANDS_H__ */
diff --git a/src/view/gesture_detector.cpp b/src/view/gesture_detector.cpp
new file mode 100644 (file)
index 0000000..63aa5cb
--- /dev/null
@@ -0,0 +1,230 @@
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include "gesture_detector.h"
+#include <glib.h>
+
+
+extern bool _map_view_is_gesture_available(map_view_h view,
+                                          map_gesture_e gesture);
+
+
+/*----------------------------------------------------------------------------*/
+
+
+view::gesture_detector::gesture_detector(map_view_h v)
+       : _view(v)
+       , _gp(this)
+       #ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+       , _tap_timer(NULL)
+       #endif
+       , _long_press_timer(NULL)
+{
+}
+
+view::gesture_detector::~gesture_detector()
+{
+       #ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+       stop_tap_timer();
+       #endif
+       stop_long_press_timer();
+}
+
+void view::gesture_detector::halt_gesture()
+{
+}
+
+void view::gesture_detector::reset()
+{
+       MAPS_LOGI("%c[%d;%d;%dm"
+                 "%s"
+                 "%c[%d;%d;%dm",
+                 0x1B, 1, 41, FG_GREEN,
+                 "RESET RUNTIME INFO",
+                 0x1B, 0, 0, 0);
+
+       /* Store the previous gesture data for possible future analysis */
+       _info_history = _info;
+
+       /* Save Map View state for complex multi-click gestures */
+       const map_state saved_state = _info._start_view_state;
+
+       /* Reset current gesture info */
+       _info.reset();
+
+       /* We would use this state in the complex gestures */
+       _info._start_view_state = saved_state;
+
+       /* There is definitelly not long enough for "long press" gesture */
+       stop_long_press_timer();
+
+       /*MAPS_LOGI("Historic timestamps: tap: %d, move: %d, up: %d",
+                 _info_history._finger_down[0]._timestamp,
+                 _info_history._finger_move[0]._timestamp,
+                 _info_history._finger_up[0]._timestamp);*/
+}
+
+void view::gesture_detector::tap(int finger_no, const touch_point &tp)
+{
+}
+
+void view::gesture_detector::up(int finger_no, const touch_point &tp)
+{
+}
+
+void view::gesture_detector::move(int finger_no, const touch_point &tp)
+{
+}
+
+#ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+void view::gesture_detector::on_tap_timer()
+{
+}
+
+void view::gesture_detector::start_tap_timer()
+{
+       log("START TAP TIMER", FG_MAGENTA);
+       if(_tap_timer)
+               stop_tap_timer();
+       _tap_timer = ecore_timer_add(__TAP_DURATION,
+                                       __on_tap_timer,
+                                       this);
+}
+
+void view::gesture_detector::stop_tap_timer()
+{
+       log("STOP TAP TIMER", FG_MAGENTA);
+       if(_tap_timer)
+               ecore_timer_del(_tap_timer);
+       _tap_timer = NULL;
+}
+
+Eina_Bool view::gesture_detector::__on_tap_timer(void *data)
+{
+       gesture_detector *d = (gesture_detector *)data;
+       if(!d)
+               return ECORE_CALLBACK_CANCEL;
+
+       d->log("------- TAP TIMER EVENT -------", FG_MAGENTA);
+       d->_tap_timer = NULL;
+       d->on_tap_timer();
+
+       return ECORE_CALLBACK_CANCEL;
+}
+#endif
+
+void view::gesture_detector::on_long_press_timer()
+{
+}
+
+void view::gesture_detector::start_long_press_timer()
+{
+       log("START LONG PRESS TIMER", FG_MAGENTA);
+       if(_long_press_timer)
+               stop_long_press_timer();
+       _long_press_timer = ecore_timer_add(__LONG_PRESS_DURATION,
+                                           __on_long_press_timer,
+                                           this);
+}
+
+void view::gesture_detector::stop_long_press_timer()
+{
+       log("STOP LONG PRESS TIMER", FG_MAGENTA);
+       if(_long_press_timer)
+               ecore_timer_del(_long_press_timer);
+       _long_press_timer = NULL;
+}
+
+Eina_Bool view::gesture_detector::__on_long_press_timer(void *data)
+{
+       gesture_detector *d = (gesture_detector *)data;
+       if(!d)
+               return ECORE_CALLBACK_CANCEL;
+
+       d->log("------- LONG PRESS TIMER EVENT -------", FG_MAGENTA);
+       d->_long_press_timer = NULL;
+       d->on_long_press_timer();
+
+       return ECORE_CALLBACK_CANCEL;
+}
+
+bool view::gesture_detector::is_gesture_available(map_gesture_e gesture)
+{
+       return _map_view_is_gesture_available(_view, gesture);
+}
+
+bool view::gesture_detector::finger_dragged_enough(int finger_no)
+{
+       const touch_point p1 = _info._finger_down[finger_no];
+       const touch_point p2 = _info._finger_move[finger_no];
+       return (get_trajectory_effective_length(p1, p2) >= __CLICK_AREA);
+}
+
+bool view::gesture_detector::finger_pressed_enough(int finger_no,
+                                                  unsigned int duration_min,
+                                                  unsigned int duration_max)
+{
+       unsigned int press_time = _info._finger_down[finger_no]._timestamp;
+       unsigned int up_time = _info._finger_up[finger_no]._timestamp;
+
+       unsigned int press_duration_tmp = up_time - press_time;
+       MAPS_LOGI("finger_pressed_enough: finger: %d, press: %d, up: %d [%d]",
+                 finger_no, press_time, up_time, press_duration_tmp);
+
+       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))
+               return true;
+       return false;
+}
+
+int view::gesture_detector::get_trajectory_effective_length(
+                                                       const touch_point &p1,
+                                                       const touch_point &p2)
+{
+       int dx = p2._x - p1._x;
+       int dy = p2._y - p1._y;
+       int etl = sqrt(dx * dx + dy * dy);
+       return etl;
+}
+
+void view::gesture_detector::log(const char *str, log_colors color)
+{
+       MAPS_LOGI("%c[%d;%d;%dm"
+                 "%s"
+                 "%c[%d;%d;%dm",
+                 0x1B, 1, 0, color,
+                 str,
+                 0x1B, 0, 0, 0);
+}
+
+
+void view::gesture_detector::log_map_center(int color)
+{
+       maps_coordinates_h central_coords = NULL;
+       map_view_get_center(_view, &central_coords);
+       double lat = .0, lon = .0;
+       maps_coordinates_get_latitude_longitude(central_coords, &lat, &lon);
+       maps_coordinates_destroy(central_coords);
+       MAPS_LOGI("%c[%d;%d;%dm"
+                 "central coordinates: (%f, %f)"
+                 "%c[%d;%d;%dm",
+                 0x1B, 1, 0, color,
+                 lat, lon,
+                 0x1B, 0, 0, 0);
+}
diff --git a/src/view/gesture_detector.h b/src/view/gesture_detector.h
new file mode 100644 (file)
index 0000000..b555090
--- /dev/null
@@ -0,0 +1,134 @@
+/* Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MAPS_VIEW_GESTURE_DETECTOR_H__
+#define __MAPS_VIEW_GESTURE_DETECTOR_H__
+
+
+#include "map_view.h"
+#include "runtime_data.h"
+#include "gesture_processor.h"
+
+
+namespace view
+{
+       class gesture_detector {
+       public:
+               map_view_h _view;
+
+               /* The gesture processing unit */
+               gesture_processor _gp;
+
+               #ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+               /* Tap gesture timer */
+               Ecore_Timer *_tap_timer;
+               #endif
+
+               /* Long press gesture timer */
+               Ecore_Timer *_long_press_timer;
+
+               /* The current gesture info */
+               runtime_touch_info _info;
+
+               /* The history includes the touch info from previous gesture */
+               runtime_touch_info _info_history;
+
+       protected:
+               static const int __MIL_SEC = 1;
+               static const int __SEC = 1000 * __MIL_SEC;
+
+               /* Half a second is a popular duration of double click in UI */
+               static const unsigned int __CLICK_DURATION = 500 * __MIL_SEC;
+               #ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+               static const unsigned int __DOUBLE_CLICK_DURATION = __CLICK_DURATION;
+               static const double __TAP_DURATION = 0.5;
+               #else
+               static const unsigned int __DOUBLE_CLICK_DURATION =
+                       2 * __CLICK_DURATION;
+               #endif
+               /* Half a second is a popular duration of double click in UI
+               * however, sometimes it is 1 second */
+               static const double __LONG_PRESS_DURATION = 0.5;
+
+       public:
+
+               /* May be same as hit test accuracy */
+               /*
+                * TODO: It is needed to calculate this value accordingly to the
+                *  device pixel dencity
+                */
+               static const int __CLICK_AREA = 50;
+
+       public:
+               gesture_detector(map_view_h v);
+               virtual ~gesture_detector();
+       public:
+               virtual void tap(int finger_no, const touch_point &tp);
+               virtual void move(int finger_no, const touch_point &tp);
+               virtual void up(int finger_no, const touch_point &tp);
+               #ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+               virtual void on_tap_timer();
+               #endif
+               virtual void on_long_press_timer();
+               virtual void halt_gesture();
+       protected:
+               virtual void reset();
+       public:
+               #ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+               static Eina_Bool __on_tap_timer(void *data);
+               void start_tap_timer();
+               void stop_tap_timer();
+               #endif
+               static Eina_Bool __on_long_press_timer(void *data);
+               void start_long_press_timer();
+               void stop_long_press_timer();
+       public:
+       protected:
+               bool is_gesture_available(map_gesture_e gesture);
+               bool finger_dragged_enough(int finger_no);
+               bool finger_pressed_enough(int finger_no,
+                                          unsigned int duration_min,
+                                          unsigned int duration_max);
+       public:
+               static int get_trajectory_effective_length(const touch_point
+                                                          &p1,
+                                                          const touch_point
+                                                          &p2);
+       public:
+               enum log_colors {
+                       FG_BLACK        = 30,
+                       FG_RED          = 31,
+                       FG_GREEN        = 32,
+                       FG_YELLOW       = 33,
+                       FG_BLUE         = 34,
+                       FG_MAGENTA      = 35,
+                       FG_CYAN         = 36,
+                       FG_WHITE        = 37,
+                       FG_LITE_BLACK   = 90,
+                       FG_LITE_RED     = 91,
+                       FG_LITE_GREEN   = 92,
+                       FG_LITE_YELLOW  = 93,
+                       FG_LITE_BLUE    = 94,
+                       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);
+       };
+};
+
+#endif                         /* __MAPS_VIEW_GESTURE_DETECTOR_H__ */
diff --git a/src/view/gesture_detector_script.cpp b/src/view/gesture_detector_script.cpp
new file mode 100644 (file)
index 0000000..596444b
--- /dev/null
@@ -0,0 +1,404 @@
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include "gesture_detector_script.h"
+#include <glib.h>
+
+
+view::gesture_detector_script::gesture_detector_script(map_view_h v)
+       : gesture_detector(v)
+{
+}
+
+view::gesture_detector_script::~gesture_detector_script()
+{
+}
+
+void view::gesture_detector_script::tap(int finger_no, const touch_point &tp)
+{
+       if(_info._fingers_pressed == 0) {
+
+               /* This is the begining position of each gesture,
+                *  so we'd better to store the initial state of
+                *  the Map View */
+               _info._start_view_state.capture(_view);
+
+               /* Processing of single finger gesture:
+                * - long press
+                */
+
+               _info._fingers_pressed = 1;
+               _info._finger_down[0] = tp;
+               _info._is_finger_pressed[0] = true;
+
+               /* Check if it is a long press gesure */
+               test_long_press_gesture();
+
+       } else { /* TODO: els if(_info._fingers_pressed == 1) */
+               /* Processing of multi-finger gesture:
+                * - none
+                */
+
+               _info._fingers_pressed ++;
+               _info._finger_down[finger_no] = tp;
+               _info._is_finger_pressed[finger_no] = true;
+       }
+}
+
+void view::gesture_detector_script::up(int finger_no, const touch_point &tp)
+{
+       if(_info._fingers_pressed == 1) {
+               /* Processing of single finger gesture:
+                * - tap
+                * - double tap
+                */
+
+               _info._finger_up[0] = tp;
+
+               /* Check if it is a tap or double tap gesture */
+               if(!test_panning_gesture_finished())
+                       if(!test_two_finger_tap_gesture())
+                               if(!test_double_tap_gesture())
+                                       test_tap_gesture();
+
+               /* This is the end of each gesture */
+               reset();
+
+       } else { /* TODO: els if(_info._fingers_pressed == 2) */
+               /* Processing of multi-finger gesture:
+                * - 2-finger tap
+                */
+
+               _info._finger_move[finger_no] = tp;
+               _info._finger_up[finger_no] = tp;
+
+               /* Check if it is a two finger tap gesture */
+               test_two_finger_tap_gesture();
+
+
+               /* Remove the info about lifted finger */
+               _info._fingers_pressed --;
+               _info._finger_down[finger_no].reset();
+               _info._is_finger_pressed[finger_no] = false;
+
+               /* TODO:
+                *
+                *  [IMPORTANT!!!!]
+                *
+                *  Arrange remaining info, so the indexes of fingers
+                *  on the canvas are the same as indexes in the gesture
+                *  processor
+                *  */
+       }
+}
+
+void view::gesture_detector_script::move(int finger_no, const touch_point &tp)
+{
+       if(_info._fingers_pressed == 1) {
+               /* Processing of single finger gesture:
+                * - pan
+                * - flick
+                */
+
+               _info._prev_finger_down[0] = _info._finger_move[0];
+               _info._finger_move[0] = tp;
+
+               /* Check if it is a pan or flick gesture */
+               if(!test_flick_gesture())
+                       test_pan_gesture();
+
+
+       } else {
+               /* Processing of multi-finger gesture:
+                * - zoom
+                * - rotate
+                * - pinch
+                */
+
+               _info._prev_finger_down[finger_no] =
+                       _info._finger_move[finger_no];
+               _info._finger_move[finger_no] = tp;
+
+               /* Check if it is a zoom or rotate or pinch gesture */
+               #ifndef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+               if(!test_pinch_gesture())
+               #endif
+                       test_zoom_rotate_gesture();
+       }
+
+}
+
+
+void view::gesture_detector_script::on_long_press_timer()
+{
+       MAPS_LOGI("GESTURE LONG PRESS PRE-DETECTED");
+
+       /* TODO: think about concurent access to following member variables */
+
+       if(_info._fingers_pressed != 1)
+               return;
+
+       /*if(_info._cur_gesture != MAP_GESTURE_LONG_PRESS)*/
+               /*return ECORE_CALLBACK_CANCEL;*/ /* Another gesture happend */
+
+       /* Check if the gesture event is short enough */
+       if(finger_dragged_enough(0))
+               return;
+
+       _info._cur_gesture = MAP_GESTURE_LONG_PRESS;
+       MAPS_LOGI("GESTURE LONG PRESS DETECTED");
+       _gp.on_long_press();
+}
+
+bool view::gesture_detector_script::test_long_press_gesture()
+{
+       /* Check if the gesture is available */
+       if (!is_gesture_available(MAP_GESTURE_LONG_PRESS))
+               return false;
+
+       /* Note, We expect, that the gesture is done with a single finger */
+       if(_info._fingers_pressed != 1)
+               return false;
+
+       /* Start long press timer */
+       /*_info._cur_gesture = MAP_GESTURE_LONG_PRESS;*/
+       start_long_press_timer();
+
+       return false;
+}
+
+bool view::gesture_detector_script::test_double_tap_gesture()
+{
+       /* Check if the gesture is available */
+       if (!is_gesture_available(MAP_GESTURE_DOUBLE_TAP))
+               return false;
+
+       /* If a single finger taped twice on the Map View
+        *  and it happed whithin a short time frame,
+        *  than it is likely a double tap gesture;
+        *  The time frame is calculated as the current time - previous click
+        *  time */
+
+       /* Note, We expect, that the gesture is done with a single finger */
+       if(_info._fingers_pressed != 1)
+               return false;
+
+
+       const touch_point prev_up = _info_history._finger_up[0];
+       if(prev_up._timestamp == 0)
+               return false; /* It is very first up of the Map View ever */
+
+       const touch_point cur_up = _info._finger_up[0];
+       const unsigned int time = cur_up._timestamp - prev_up._timestamp;
+       if((time > 0) && (time < __CLICK_DURATION)) {
+               _info._cur_gesture = MAP_GESTURE_DOUBLE_TAP;
+               MAPS_LOGI("GESTURE DOUBLE TAP DETECTED");
+               _gp.on_double_tap();
+               return true;
+       }
+       return false;
+}
+
+bool view::gesture_detector_script::test_panning_gesture_finished()
+{
+#ifndef _MOVE_CENTER_COMMAND_DEFINED_
+       return false;
+#endif /* _MOVE_CENTER_COMMAND_DEFINED_ */
+       if(_info._cur_gesture == MAP_GESTURE_SCROLL) {
+               /* Finalize the panning gesture */
+               MAPS_LOGI("GESTURE PAN FINISHED");
+               _gp.on_panning_finished(0);
+               return true;
+       }
+
+       return false;
+}
+
+bool view::gesture_detector_script::test_tap_gesture()
+{
+       /* Check if the gesture is available */
+       if (!is_gesture_available(MAP_GESTURE_TAP))
+               return false;
+
+       /* If a single finger touched a map view,
+        * and lifted before long press gesture is detected,
+        * than it is a tap gesture */
+
+       /* Note, We expect, that the gesture is done with a single finger */
+       if(_info._fingers_pressed != 1)
+               return false;
+
+       /* Check if the gesture event is short enough */
+       touch_point p1 = _info._finger_down[0];
+       touch_point p2 = _info._finger_up[0];
+       unsigned int time = p2._timestamp - p1._timestamp;
+       if((time > 0) && (time < __CLICK_DURATION)) {
+               /* Check if it is a click, but not the movement */
+               if(get_trajectory_effective_length(p1, p2) < __CLICK_AREA) {
+                       _info._cur_gesture = MAP_GESTURE_TAP;
+                       MAPS_LOGI("GESTURE TAP DETECTED");
+                       _gp.on_tap();
+                       return true;
+               }
+       }
+       return false;
+}
+
+bool view::gesture_detector_script::test_two_finger_tap_gesture()
+{
+       /* Check if the gesture is available */
+       if (!is_gesture_available(MAP_GESTURE_2_FINGER_TAP))
+               return false;
+
+       /* If Two fingers tapped a map view, than it is detected as
+        *  corresponding "two-finger-tap gesture */
+
+
+       if((_info._fingers_pressed != 2) && (_info._fingers_pressed != 1))
+               return false;
+
+       if(_info._finger_down[1].empty())
+               return false; /* The second finger was not pressed */
+
+       const touch_point f1_start = _info._finger_down[0];
+       const touch_point f1_finish = _info._finger_up[0];
+       const touch_point f2_start = _info._finger_down[1];
+       const touch_point f2_finish = _info._finger_up[1];
+
+       switch(_info._fingers_pressed) {
+       case 1: {
+               long long time = f1_finish._timestamp - f2_start._timestamp;
+               if(time < 0)
+                       time *= -1;
+               if(time > __CLICK_DURATION)
+                       return false;
+
+               break;
+       }
+       case 2: {
+               long long time = f1_finish._timestamp - f1_start._timestamp;
+               if(time < 0)
+                       time *= -1;
+               if(time > __CLICK_DURATION)
+                       return false;
+
+               break;
+       }
+       default:
+               return false;
+       }
+
+       if(!f1_start.empty() && !f1_finish.empty())
+               if(get_trajectory_effective_length(f1_start, f1_finish)
+                  > __CLICK_AREA)
+                       return false;
+
+       if(!f2_start.empty() && !f2_finish.empty())
+               if(get_trajectory_effective_length(f2_start, f2_finish)
+                  > __CLICK_AREA)
+                       return false;
+
+       _info._cur_gesture = MAP_GESTURE_2_FINGER_TAP;
+       MAPS_LOGI("GESTURE TWO FINGER TAP DETECTED");
+       _gp.on_two_finger_tap();
+       return true;
+}
+
+bool view::gesture_detector_script::test_flick_gesture()
+{
+       /* Check if the gesture is available */
+       if (!is_gesture_available(MAP_GESTURE_FLICK))
+               return false;
+
+       /* If a finger is moved rapidely left-to-right or right-to-left,
+        *  than it is considered as flicj gesture */
+
+       /* TODO: */
+       /*_info._cur_gesture = MAP_GESTURE_FLICK;*/
+       /*MAPS_LOGI("GESTURE FLICK DETECTED");*/
+       return false;
+}
+
+bool view::gesture_detector_script::test_pan_gesture()
+{
+       /* Check if the gesture is available */
+       if (!is_gesture_available(MAP_GESTURE_SCROLL))
+               return false;
+
+       /* If a single finger is moved on the map view, than it is recognized
+        *  as a pan gesture */
+
+       /* Note, We expect, that the gesture is done with a single finger */
+       if(_info._fingers_pressed != 1)
+               return false;
+
+       /* Check If the effective trajectory is more than the limit */
+       if (_info._cur_gesture != MAP_GESTURE_SCROLL)
+               if(!finger_dragged_enough(0))
+                       return false;
+
+       /* No special checks are need here */
+       _info._cur_gesture = MAP_GESTURE_SCROLL;
+       MAPS_LOGI("GESTURE PAN DETECTED");
+       _gp.on_pan(0);
+       return true;
+}
+
+bool view::gesture_detector_script::test_zoom_rotate_gesture()
+{
+#ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+       if (!is_gesture_available(MAP_GESTURE_ZOOM))
+#else
+       /* Check if the gesture is available */
+       if ((!is_gesture_available(MAP_GESTURE_ZOOM))
+           && (!is_gesture_available(MAP_GESTURE_ROTATE)))
+#endif
+               return false;
+
+       /* It two fingetrs are moving in arbitrary trajectories,
+        *  than it is a zoom and/or rotate gesture */
+
+       /* Note, We expect, that the gesture is done with a pair of fingers */
+       if(_info._fingers_pressed != 2)
+               return false;
+
+       if(_info._cur_gesture != MAP_GESTURE_ZOOM)
+               if(!finger_dragged_enough(0) && finger_dragged_enough(1))
+                       return false;
+
+       /* No special checks are need here */
+       _info._cur_gesture = MAP_GESTURE_ZOOM;
+       MAPS_LOGI("GESTURE ZOOM & ROTATE DETECTED");
+       _gp.on_zoom_rotate();
+       return true;
+}
+
+#ifndef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+bool view::gesture_detector_script::test_pinch_gesture()
+{
+       /* Check if the gesture is available */
+       if (!is_gesture_available(MAP_GESTURE_PINCH))
+               return false;
+
+       /* If two or more fingers moved rapidly toward each other,
+        *  than it is recognized as pinch gesture */
+
+       /*_info._cur_gesture = MAP_GESTURE_PINCH;*/
+       /*MAPS_LOGI("GESTURE PINCH DETECTED");*/
+       return false;
+}
+#endif
diff --git a/src/view/gesture_detector_script.h b/src/view/gesture_detector_script.h
new file mode 100644 (file)
index 0000000..3a150bf
--- /dev/null
@@ -0,0 +1,60 @@
+/* Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MAPS_VIEW_GESTURE_DETECTOR_SCRIPT_H__
+#define __MAPS_VIEW_GESTURE_DETECTOR_SCRIPT_H__
+
+
+#include "map_view.h"
+#include "runtime_data.h"
+#include "gesture_detector.h"
+
+
+namespace view
+{
+       /* This class defines the automate, aimed at recognition of user
+        *  gestures on the base of gesture info, sich as a number of fingers
+        *  involved, the initial and current position of the fingers on the
+        *  Map View, the time diration of the gesture etc.
+        *  Note, it is enoug for the automate to process only each finger
+        *  the "tap", "move" and "up" events.
+        *  If the supported gesture is detected, the gesture_detector_script invokes
+        *  appropriate processing by gesture_processor.
+        */
+       class gesture_detector_script : public gesture_detector {
+       public:
+               gesture_detector_script(map_view_h v);
+               virtual ~gesture_detector_script();
+       public:
+               virtual void tap(int finger_no, const touch_point &tp);
+               virtual void move(int finger_no, const touch_point &tp);
+               virtual void up(int finger_no, const touch_point &tp);
+               virtual void on_long_press_timer();
+       private:
+               bool test_long_press_gesture();
+               bool test_double_tap_gesture();
+               bool test_tap_gesture();
+               bool test_two_finger_tap_gesture();
+               bool test_flick_gesture();
+               bool test_pan_gesture();
+               bool test_panning_gesture_finished();
+               bool test_zoom_rotate_gesture();
+               #ifndef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+               bool test_pinch_gesture();
+               #endif
+       };
+};
+
+#endif                         /* __MAPS_VIEW_GESTURE_DETECTOR_SCRIPT_H__ */
diff --git a/src/view/gesture_detector_statemachine.cpp b/src/view/gesture_detector_statemachine.cpp
new file mode 100644 (file)
index 0000000..95017a8
--- /dev/null
@@ -0,0 +1,907 @@
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include "gesture_detector_statemachine.h"
+#include <glib.h>
+
+
+view::gesture_detector_statemachine::gesture_detector_statemachine(map_view_h v)
+       : gesture_detector(v)
+         , _current_state(STATE_NONE)
+{
+       for(int i = 0; i < MAX_FINGERS; i ++)
+               is_panning[i] = false;
+}
+
+view::gesture_detector_statemachine::~gesture_detector_statemachine()
+{
+}
+
+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;
+               _info._prev_finger_down[0] = tp;
+               _info._is_finger_pressed[0] = true;
+
+               _info._fingers_pressed = _info.calc_finger_pressed();
+
+               if(_info._fingers_pressed > 2)
+                       log("ERROR! Too many fingers pressed!!!", FG_RED);
+
+               /* Run state machine */
+               state_machine_on_event(FINGER_DOWN);
+               break;
+
+       case 1: /* Second finger pressed */
+               _info._finger_down[1] = tp;
+               _info._is_finger_pressed[1] = true;
+               _info._finger_move[1] = tp;
+               _info._prev_finger_down[1] = tp;
+
+               _info._fingers_pressed = _info.calc_finger_pressed();
+
+               if(_info._fingers_pressed > 2)
+                       log("ERROR! Too many fingers pressed!!!", FG_RED);
+
+               /* Run state machine */
+               state_machine_on_event(FINGER2_DOWN);
+               break;
+
+       default:
+               break;
+       }
+
+       #ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+       stop_tap_timer();
+       #endif
+
+       MAPS_LOGI("%c[%d;%d;%dm"
+                 "Fingers pressed [after press]: %d"
+                 "%c[%d;%d;%dm",
+                 0x1B, 1, 0, FG_LITE_WHITE,
+                 _info._fingers_pressed,
+                 0x1B, 0, 0, 0);
+}
+
+void view::gesture_detector_statemachine::up(int finger_no,
+                                            const touch_point &tp)
+{
+       switch(finger_no) {
+
+       case 0: /* Up the single finger */
+               _info._finger_up[0] = tp;
+
+               /* Run state machine */
+               state_machine_on_event(FINGER_UP);
+
+               /* Remove the info about lifted finger */
+               _info._is_finger_pressed[0] = false;
+
+               _info._fingers_pressed = _info.calc_finger_pressed();
+
+               if(_info._fingers_pressed < 0)
+                       log("ERROR! Too few fingers pressed!!!", FG_RED);
+
+               /* This is the end of the gesture */
+               if(_info._fingers_pressed <= 0)
+                       reset();
+               break;
+
+       case 1: /* Up the second finger */
+
+               _info._finger_move[1] = tp;
+               _info._finger_up[1] = tp;
+
+               /* Run state machine */
+               state_machine_on_event(FINGER2_UP);
+
+               /* Remove the info about lifted finger */
+               _info._is_finger_pressed[1] = false;
+
+               _info._fingers_pressed = _info.calc_finger_pressed();
+
+               if(_info._fingers_pressed < 0)
+                       log("ERROR! Too few fingers pressed!!!", FG_RED);
+
+               /* This is the end of the gesture */
+               if(_info._fingers_pressed <= 0)
+                       reset();
+               break;
+
+       default:
+               break;
+       }
+
+       stop_long_press_timer();
+
+       MAPS_LOGI("%c[%d;%d;%dm"
+                 "Fingers pressed [after unpress]: %d"
+                 "%c[%d;%d;%dm",
+                 0x1B, 1, 0, FG_LITE_WHITE,
+                 _info._fingers_pressed,
+                 0x1B, 0, 0, 0);
+}
+
+void view::gesture_detector_statemachine::move(int finger_no,
+                                              const touch_point &tp)
+{
+       /* There can not be a long press any more */
+       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;
+
+               /* Run state machine */
+               state_machine_on_event(FINGER_MOVE);
+               break;
+
+       case 1: /* Moving the second finger */
+               _info._prev_finger_down[1] = _info._finger_move[1];
+               _info._finger_move[1] = tp;
+
+               /* Run state machine */
+               state_machine_on_event(FINGER2_MOVE);
+               break;
+       default:
+               break;
+       }
+}
+
+void view::gesture_detector_statemachine::start_panning(int finger_no)
+{
+       if(!is_panning[finger_no]) {
+               /*_info._prev_finger_down[finger_no] =
+                       _info._finger_move[finger_no];*/
+               is_panning[finger_no] = true;
+       }
+}
+
+void view::gesture_detector_statemachine::finish_panning(int finger_no)
+{
+       if(is_panning[finger_no]) {
+               _gp.on_panning_finished(finger_no);
+
+               _info._start_view_state.capture(_view);
+               _info._finger_down[finger_no] = _info._finger_move[finger_no];
+       }
+       is_panning[finger_no] = false;
+}
+
+#ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+void view::gesture_detector_statemachine::on_tap_timer()
+{
+       /* TODO: think about concurent access to following member variables */
+
+       /* Run state machine */
+       state_machine_on_event(TAP_TIMER);
+}
+#endif
+
+void view::gesture_detector_statemachine::on_long_press_timer()
+{
+       /* TODO: think about concurent access to following member variables */
+
+       /* Run state machine */
+       state_machine_on_event(LONG_PRESS_TIMER);
+}
+
+void view::gesture_detector_statemachine::halt_gesture()
+{
+       _current_state = STATE_NONE;
+       g_usleep(5 * 1000);
+       reset();
+}
+
+void view::gesture_detector_statemachine::state_machine_on_event(view_event_e
+                                                                event)
+{
+       log_event(event);
+       detector_states_e old_state = _current_state;
+
+       switch(_current_state) {
+
+       case STATE_NONE: {
+
+               _info._start_view_state.capture(_view);
+               log_map_center(FG_WHITE);
+
+               switch(event) {
+               case FINGER_DOWN:
+                       _current_state = STATE_PRESSED;
+                       start_long_press_timer();
+                       break;
+
+               default:
+                       log_state(event, _current_state);
+                       break;
+               }
+
+               break;
+       }
+
+       case STATE_PRESSED: {
+               switch(event) {
+               case FINGER_MOVE:
+                       _current_state = STATE_MOVING;
+                       break;
+               case FINGER_UP: {
+                       if(finger_pressed_enough(0, 0, __CLICK_DURATION)) {
+                               _current_state = STATE_CLICKED;
+                               #ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+                               start_tap_timer();
+                               #else
+                               detected_tap(); /* Tap */
+                               #endif
+                       } else
+                               _current_state = STATE_NONE;
+                       break;
+               }
+               case LONG_PRESS_TIMER:
+                       _current_state = STATE_LONG_PRESSED;
+                       detected_long_press();  /* Long Press */
+                       break;
+               case FINGER2_DOWN:
+                       _current_state = STATE_2FINGERS_PRESSED;
+                       break;
+               default:
+                       log_state(event, _current_state);
+                       break;
+               }
+               break;
+       }
+
+       case STATE_CLICKED: {
+               switch(event) {
+               case FINGER_DOWN: {
+                       /* Calculate the time between clicks */
+                       unsigned int last_click_time =
+                               _info_history._finger_up[0]._timestamp;
+                       unsigned int cur_time =
+                               _info._finger_down[0]._timestamp;
+                       unsigned int duration = cur_time - last_click_time;
+
+                       /* Decide if we can have a souble click, or just a
+                        *  second click */
+                       if(duration < __DOUBLE_CLICK_DURATION)
+                               _current_state = STATE_SECOND_PRESSED;
+                       else
+                               _current_state = STATE_PRESSED;
+
+                       /* Start timer expecting the long press */
+                       start_long_press_timer();
+                       break;
+               }
+               #ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+               case TAP_TIMER:
+                       stop_long_press_timer();
+                       _current_state = STATE_NONE;
+                       detected_tap(); /* Tap */
+                       break;
+               #endif
+               default:
+                       log_state(event, _current_state);
+                       break;
+               }
+               break;
+       }
+
+       case STATE_LONG_PRESSED: {
+               switch(event) {
+               case FINGER_UP:
+                       _current_state = STATE_NONE;
+                       break;
+               case FINGER_MOVE:
+                       _current_state = STATE_MOVING;
+                       break;
+               case FINGER2_DOWN:
+                       _current_state = STATE_2FINGERS_PRESSED;
+                       break;
+               default:
+                       log_state(event, _current_state);
+                       break;
+               }
+               break;
+       }
+
+       case STATE_SECOND_PRESSED: {
+               switch(event) {
+               case FINGER_UP: {
+
+                       /* 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)) {
+
+                               /* Switching to Double Tap state */
+                               _current_state = STATE_SECOND_CLICKED;
+
+                               detected_double_tap();  /* Double Tap */
+
+                               /*
+                                * No need to expect other events here.
+                                * Immediatelly switching to the initial State
+                                */
+                               _current_state = STATE_NONE;
+
+                       } else {
+                               /* Seems like it is a simple click */
+                               _current_state = STATE_CLICKED;
+                               #ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+                               stop_long_press_timer();
+                               start_tap_timer();
+                               #else
+                               detected_tap(); /* Tap */
+                               #endif
+                       }
+
+                       break;
+               }
+               #ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+               case TAP_TIMER:
+                       _current_state = STATE_NONE;
+                       detected_tap(); /* Tap */
+                       break;
+               #endif
+               case LONG_PRESS_TIMER:
+                       _current_state = STATE_SECOND_LONG_PRESSED;
+                       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)) {
+                               #ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+                               map_view_screen_to_geography(_view, p1._x, p1._y, &_info._start_view_state._center);
+                               #endif
+                               _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 */
+                       }
+                       break;
+               }
+               case FINGER2_DOWN:
+                       _current_state = STATE_2FINGERS_PRESSED;
+                       break;
+               default:
+                       log_state(event, _current_state);
+                       break;
+               }
+
+               break;
+       }
+
+       case STATE_SECOND_CLICKED: {
+               /* Empty */
+               _current_state = STATE_NONE;
+               break;
+       }
+
+       case STATE_SECOND_LONG_PRESSED: {
+               switch(event) {
+               case FINGER_UP:
+                       _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)) {
+                               #ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+                               map_view_screen_to_geography(_view, p1._x, p1._y, &_info._start_view_state._center);
+                               #endif
+                               _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 */
+                       }
+                       break;
+               }
+               case FINGER_DOWN:
+                       _current_state = STATE_2FINGERS_PRESSED;
+                       break;
+               default:
+                       log_state(event, _current_state);
+                       break;
+               }
+               break;
+       }
+
+       case STATE_MOVING: {
+
+               if(event != FINGER_MOVE)
+                       finish_panning(0);
+
+               switch(event) {
+               case FINGER_MOVE:
+                       _current_state = STATE_MOVING;
+                       detected_pan();         /* Pan */
+                       break;
+               case FINGER_UP:
+
+                       /* When two fingers untouched simultaneously,
+                        * Ecore sends finger1_up and then finger2_up
+                        * sequentially.
+                        * The finger1_up switches the detector from
+                        * STATE_2FINGERS_MOVING to STATE_MOVING.
+                        * Now we are receiving finger2_up and should switch to
+                        * the initial state.
+                        */
+
+                       _current_state = STATE_NONE;
+                       break;
+               case FINGER2_DOWN:
+                       _current_state = STATE_2FINGERS_PRESSED;
+                       break;
+               default:
+                       log_state(event, _current_state);
+                       break;
+               }
+               break;
+       }
+
+       case STATE_FINGER2_MOVING: {
+
+               if(event != FINGER2_MOVE)
+                       finish_panning(1);
+
+               switch(event) {
+               case FINGER2_MOVE:
+                       _current_state = STATE_FINGER2_MOVING;
+                       detected_finger2_pan();         /* Pan (finger2) */
+                       break;
+               case FINGER2_UP:
+                       _current_state = STATE_NONE;
+                       break;
+               case FINGER_DOWN:
+                       _current_state = STATE_2FINGERS_PRESSED;
+                       break;
+
+               default:
+                       log_state(event, _current_state);
+                       break;
+               }
+               break;
+       }
+
+       case STATE_2FINGERS_PRESSED: {
+               switch(event) {
+               case FINGER_UP:
+                       _current_state = STATE_FINGER2_PRESSED;
+                       break;
+               case FINGER2_UP:
+                       _current_state = STATE_FINGER1_PRESSED;
+                       break;
+               case FINGER_MOVE:
+               case FINGER2_MOVE:
+                       _current_state = STATE_2FINGERS_MOVING;
+                       detected_zoom_rotate();         /* Zoom, Rotate etc */
+                       break;
+               case LONG_PRESS_TIMER:
+                       /* Just ignoring this event */
+                       _current_state = STATE_2FINGERS_PRESSED;
+                       break;
+               default:
+                       log_state(event, _current_state);
+                       break;
+               }
+               break;
+       }
+
+       case STATE_FINGER2_PRESSED: {
+               switch(event) {
+               case FINGER2_UP:
+
+                       if(finger_pressed_enough(0, 0, __CLICK_DURATION)
+                          &&  finger_pressed_enough(1, 0, __CLICK_DURATION)){
+                               _current_state = STATE_2FINGERS_CLICKED;
+                               detected_2finger_tap(); /* 2Finger Tap */
+                       }
+
+                       /* Nothing to do here: switching to initial state */
+                       _current_state = STATE_NONE;
+                       break;
+               case FINGER2_MOVE:
+                       _current_state = STATE_FINGER2_MOVING;
+                       detected_finger2_pan(); /* Pan (by second finger) */
+                       break;
+               case FINGER_DOWN:
+                       _current_state = STATE_2FINGERS_PRESSED;
+                       break;
+               case LONG_PRESS_TIMER:
+                       /* Just ignoring this event */
+                       _current_state = STATE_FINGER2_PRESSED;
+                       break;
+               default:
+                       log_state(event, _current_state);
+                       break;
+               }
+               break;
+       }
+
+       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;
+                               detected_2finger_tap(); /* 2Finger Tap */
+                       }
+
+                       /* No need to expect other events here.
+                       *  Immediatelly switching to the initial State */
+                       _current_state = STATE_NONE;
+                       break;
+               case FINGER2_DOWN:
+                       _current_state = STATE_2FINGERS_PRESSED;
+                       break;
+               case FINGER_MOVE:
+                       _current_state = STATE_MOVING;
+                       detected_pan(); /* Pan */
+                       break;
+
+               default:
+                       log_state(event, _current_state);
+                       break;
+               }
+               break;
+       }
+
+       case STATE_2FINGERS_CLICKED: {
+               /* Empty */
+               break;
+       }
+
+       case STATE_2FINGERS_MOVING: {
+
+               if((event != FINGER_MOVE) && (event != FINGER2_MOVE))
+                       /* Finish zooming */
+                       _info._start_view_state.capture(_view);
+
+               switch(event) {
+               case FINGER_MOVE:
+                       _current_state = STATE_2FINGERS_MOVING;
+                       detected_zoom_rotate();         /* Zoom, Rotate etc */
+                       break;
+               case FINGER2_MOVE:
+                       _current_state = STATE_2FINGERS_MOVING;
+                       detected_zoom_rotate();         /* Zoom, Rotate etc */
+                       break;
+               case FINGER_UP:
+                       _current_state = STATE_FINGER2_MOVING;
+                       break;
+               case FINGER2_UP:
+                       _current_state = STATE_MOVING;
+                       break;
+               default:
+                       log_state(event, _current_state);
+                       break;
+               }
+               break;
+       }
+
+       case STATE_MOVING_AFTER_SECOND_PRESS: {
+               switch(event) {
+               case FINGER_UP:
+                       _current_state = STATE_NONE;
+                       break;
+               case FINGER2_DOWN:
+                       _current_state = STATE_2FINGERS_PRESSED;
+                       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);
+                       break;
+               }
+               break;
+       }
+
+       default:
+               log_state(event, _current_state);
+               _current_state = STATE_NONE;
+               break;
+       }
+
+       string s_old = get_state_str(old_state);
+       string s = get_state_str(_current_state);
+       MAPS_LOGI("%c[%d;%d;%dm"
+                 "switched from %s[%d] to %s[%d]"
+                 "%c[%d;%d;%dm",
+                 0x1B, 1, 0, FG_LITE_CYAN,
+                 s_old.c_str(), old_state,
+                 s.c_str(), _current_state,
+                 0x1B, 0, 0, 0);
+
+       /* DEBUG: trace current central coordinates */
+       log_map_center();
+}
+
+void view::gesture_detector_statemachine::detected_tap()       /* Tap */
+{
+       if (!is_gesture_available(MAP_GESTURE_TAP))
+               return;
+
+       log("GESTURE TAP DETECTED", FG_GREEN);
+       _gp.on_tap();
+}
+
+void view::gesture_detector_statemachine::detected_long_press()        /* Long Press */
+{
+       if (!is_gesture_available(MAP_GESTURE_LONG_PRESS))
+               return;
+
+       log("GESTURE LONG PRESS DETECTED", FG_GREEN);
+       _gp.on_long_press();
+}
+
+void view::gesture_detector_statemachine::detected_double_tap()        /* Double Tap */
+{
+       if (!is_gesture_available(MAP_GESTURE_DOUBLE_TAP))
+               return;
+
+       log("GESTURE DOUBLE TAP DETECTED", FG_GREEN);
+       _gp.on_double_tap();
+}
+
+void view::gesture_detector_statemachine::detected_second_long_press() /* Second Long Press */
+{
+       if (!is_gesture_available(MAP_GESTURE_LONG_PRESS))
+               return;
+
+       log("GESTURE SECOND LONG PRESS DETECTED", FG_GREEN);
+       _gp.on_long_press();
+}
+
+void view::gesture_detector_statemachine::detected_single_finger_zoom()        /* Single Finger Zoom */
+{
+       if (!is_gesture_available(MAP_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(MAP_GESTURE_SCROLL))
+               return;
+
+       log("GESTURE PAN DETECTED", FG_GREEN);
+       start_panning(0);
+       _gp.on_pan(0);
+}
+
+void view::gesture_detector_statemachine::detected_finger2_pan()       /* Pan (second finger)*/
+{
+       if (!is_gesture_available(MAP_GESTURE_SCROLL))
+               return;
+
+       log("GESTURE FINGER2 PAN DETECTED", FG_GREEN);
+       start_panning(1);
+       _gp.on_pan(1);
+}
+
+/* Zoom, Rotate etc */
+void view::gesture_detector_statemachine::detected_zoom_rotate()
+{
+#ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+       if (!is_gesture_available(MAP_GESTURE_ZOOM))
+#else
+       if (!is_gesture_available(MAP_GESTURE_ZOOM)
+           && !is_gesture_available(MAP_GESTURE_ROTATE))
+#endif
+               return;
+
+       log("GESTURE ZOOM ROTATE DETECTED", FG_GREEN);
+       _gp.on_zoom_rotate();
+}
+
+#ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+void view::gesture_detector_statemachine::detected_flick()
+{
+       if (!is_gesture_available(MAP_GESTURE_FLICK))
+               return;
+
+       log("GESTURE FLICK DETECTED", FG_GREEN);
+       _gp.on_flick();
+}
+#endif
+
+void view::gesture_detector_statemachine::detected_2finger_tap()       /* 2Finger Tap */
+{
+       if (!is_gesture_available(MAP_GESTURE_2_FINGER_TAP))
+               return;
+
+       log("GESTURE 2 FINGER TAP DETECTED", FG_GREEN);
+       _gp.on_two_finger_tap();
+}
+
+string view::gesture_detector_statemachine::get_state_str(detector_states_e
+                                                         state)
+{
+       string s;
+       switch(state) {
+       case STATE_NONE:
+               s = "STATE_NONE";
+               break;
+       case STATE_PRESSED:
+               s = "STATE_PRESSED";
+               break;
+       case STATE_CLICKED:
+               s = "STATE_CLICKED";
+               break;
+       case STATE_LONG_PRESSED:
+               s = "STATE_LONG_PRESSED";
+               break;
+       case STATE_SECOND_PRESSED:
+               s = "STATE_SECOND_PRESSED";
+               break;
+       case STATE_SECOND_CLICKED:
+               s = "STATE_SECOND_CLICKED";
+               break;
+       case STATE_SECOND_LONG_PRESSED:
+               s = "STATE_SECOND_LONG_PRESSED";
+               break;
+       case STATE_MOVING:
+               s = "STATE_MOVING";
+               break;
+       case STATE_FINGER2_MOVING:
+               s = "STATE_FINGER2_MOVING";
+               break;
+       case STATE_FINGER2_PRESSED:
+               s = "STATE_FINGER2_PRESSED";
+               break;
+       case STATE_FINGER1_PRESSED:
+               s = "STATE_FINGER1_PRESSED";
+               break;
+       case STATE_2FINGERS_PRESSED:
+               s = "STATE_2FINGERS_PRESSED";
+               break;
+       case STATE_2FINGERS_CLICKED:
+               s = "STATE_2FINGERS_CLICKED";
+               break;
+       case STATE_2FINGERS_MOVING:
+               s = "STATE_2FINGERS_MOVING";
+               break;
+       case STATE_MOVING_AFTER_SECOND_PRESS:
+               s = "STATE_MOVING_AFTER_SECOND_PRESS";
+               break;
+       default:
+               s = "UNKNOWN";
+               break;
+       }
+       return s;
+}
+
+string view::gesture_detector_statemachine::get_event_str(view_event_e event)
+{
+       string e;
+       switch(event) {
+       case FINGER_DOWN:
+               e = "FINGER_DOWN";
+               break;
+       case FINGER_MOVE:
+               e = "FINGER_MOVE";
+               break;
+       case FINGER_UP:
+               e = "FINGER_UP";
+               break;
+       case FINGER2_DOWN:
+               e = "FINGER2_DOWN";
+               break;
+       case FINGER2_MOVE:
+               e = "FINGER2_MOVE";
+               break;
+       case FINGER2_UP:
+               e = "FINGER2_UP";
+               break;
+       case LONG_PRESS_TIMER:
+               e = "LONG_PRESS_TIMER";
+               break;
+       #ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+       case TAP_TIMER:
+               e = "TAP_TIMER";
+               break;
+       #endif
+       default:
+               e = "UNKNOWN";
+               break;
+       }
+       return e;
+}
+
+void view::gesture_detector_statemachine::log_event(view_event_e event)
+{
+       string e = get_event_str(event);
+       log(e.c_str(), FG_BLUE);
+}
+
+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);
+
+       MAPS_LOGE("%c[%d;%d;%dm"
+                 "DEFAULT: state: %s[%d],\tevent: %s[%d]"
+                 "%c[%d;%d;%dm",
+                 0x1B, 1, 0, FG_RED,
+                 s.c_str(), state, e.c_str(), event,
+                 0x1B, 0, 0, 0);
+}
diff --git a/src/view/gesture_detector_statemachine.h b/src/view/gesture_detector_statemachine.h
new file mode 100644 (file)
index 0000000..1c70e40
--- /dev/null
@@ -0,0 +1,134 @@
+/* Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MAPS_VIEW_GESTURE_DETECTOR_STATEMACHINE_H__
+#define __MAPS_VIEW_GESTURE_DETECTOR_STATEMACHINE_H__
+
+
+#include "map_view.h"
+#include "runtime_data.h"
+#include "gesture_detector.h"
+
+
+namespace view
+{
+       enum view_event_e {
+               FINGER_DOWN,
+               FINGER_MOVE,
+               FINGER_UP,
+               FINGER2_DOWN,
+               FINGER2_MOVE,
+               FINGER2_UP,
+               #ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+               TAP_TIMER,
+               #endif
+               LONG_PRESS_TIMER
+       };
+
+       enum detector_states_e {
+               /* Initial state */
+               STATE_NONE,
+
+               /* After finger down */
+               STATE_PRESSED,
+
+               /* After finger down, no significant move, finger up */
+               STATE_CLICKED,
+
+               /* After finger down and hold */
+               STATE_LONG_PRESSED,
+
+               /* Finger down and recently was click */
+               STATE_SECOND_PRESSED,
+
+               /* Second click */
+               STATE_SECOND_CLICKED,
+
+               /* Click and then finger down and hold for awhile */
+               STATE_SECOND_LONG_PRESSED,
+
+               /* Moving single finger */
+               STATE_MOVING,
+
+               /* Moving the second finger after the first one was untouched */
+               STATE_FINGER2_MOVING,
+
+               /* Both Finger 1 and 2 are pressed */
+               STATE_FINGER2_PRESSED,
+
+               /* Finger 1 or finger 2 was up */
+               STATE_FINGER1_PRESSED,
+
+               /* Both fingers are pressed now */
+               STATE_2FINGERS_PRESSED,
+
+               /* Clicked with two fingers */
+               STATE_2FINGERS_CLICKED,
+
+               /* Moving Finger1 or 2 when both pressed */
+               STATE_2FINGERS_MOVING,
+
+               /* Moving after first click */
+               STATE_MOVING_AFTER_SECOND_PRESS
+       };
+
+
+       class gesture_detector_statemachine : public gesture_detector {
+       public:
+               /* Current state of detector state machine */
+               detector_states_e _current_state;
+
+               bool is_panning[MAX_FINGERS];
+
+       public:
+               gesture_detector_statemachine(map_view_h v);
+               virtual ~gesture_detector_statemachine();
+       public:
+               virtual void tap(int finger_no, const touch_point &tp);
+               virtual void move(int finger_no, const touch_point &tp);
+               virtual void up(int finger_no, const touch_point &tp);
+               #ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+               virtual void on_tap_timer();
+               #endif
+               virtual void on_long_press_timer();
+               virtual void halt_gesture();
+       public:
+               void state_machine_on_event(view_event_e event);
+       private:
+               void detected_tap();    /* Tap */
+               void detected_long_press();     /* Long Press */
+               void detected_double_tap();     /* Double Tap */
+               void detected_second_long_press();      /* Second Long Press */
+               void detected_single_finger_zoom();     /* Single Finger Zoom */
+               void detected_pan();            /* Pan */
+               void detected_finger2_pan();    /* Pan (by second finger) */
+               void detected_zoom_rotate();            /* Zoom, Rotate etc */
+               void detected_2finger_tap();    /* 2Finger Tap */
+               #ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+               void detected_flick();
+               #endif
+       private:
+               void start_panning(int finger_no);
+               void finish_panning(int finger_no);
+
+       private:
+               void log_state(view_event_e event, detector_states_e state);
+               void log_event(view_event_e event);
+               string get_state_str(detector_states_e state);
+               string get_event_str(view_event_e event);
+       };
+};
+
+#endif                         /* __MAPS_VIEW_GESTURE_DETECTOR_STATEMACHINE_H__ */
diff --git a/src/view/gesture_processor.cpp b/src/view/gesture_processor.cpp
new file mode 100644 (file)
index 0000000..99b321f
--- /dev/null
@@ -0,0 +1,1287 @@
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include "gesture_processor.h"
+#include "commands.h"
+#include <glib.h>
+#include <math.h>  /* for sqrt */
+#include "gesture_detector_statemachine.h"
+
+
+
+/*----------------------------------------------------------------------------*/
+
+
+/* Using protected functions of Map View */
+extern bool _map_view_is_gesture_available(map_view_h view,
+                                          map_gesture_e gesture);
+extern map_action_e _map_view_get_gesture_action(map_view_h view,
+                                             map_gesture_e gesture);
+extern void *_map_view_get_maps_service_ptr(map_view_h view);
+
+extern map_object_h _map_object_hit_test(map_view_h view,
+                                                  const int x,
+                                                  const int y,
+                                                  map_gesture_e gesture);
+
+extern int _map_event_data_set_gesture_type(map_event_data_h event,
+                                        const map_gesture_e gesture_type);
+
+extern int _map_event_data_set_xy(map_event_data_h event,
+                                      const int x, const int y);
+
+extern int _map_event_data_set_center(map_event_data_h event,
+                                     const maps_coordinates_h center);
+
+extern int _map_event_data_set_fingers(map_event_data_h event,
+                                           const int fingers);
+
+extern int _map_event_data_set_zoom_factor(map_event_data_h event,
+                                               const double zoom_factor);
+
+extern int _map_event_data_set_rotation_angle(map_event_data_h event,
+                                                  const double rotation_angle);
+
+extern map_event_data_h _map_view_create_event_data(map_event_type_e
+                                                        type);
+extern void _map_view_invoke_event_callback(map_view_h view,
+                                           map_event_data_h event_data);
+
+
+#ifdef _MOVE_CENTER_COMMAND_DEFINED_
+extern int _map_view_set_center_directly(const map_view_h view,
+                                 const maps_coordinates_h coordinates);
+extern int _map_view_get_plugin_center(const map_view_h view,
+                                      maps_coordinates_h *center);
+#endif /* _MOVE_CENTER_COMMAND_DEFINED_ */
+
+/* ---------------------------------------------------------------------------*/
+
+
+view::zoom_calculator::zoom_calculator(const touch_point &start_tp_f1,
+                                       const touch_point &cur_tp_f1,
+                                       const touch_point &start_tp_f2,
+                                       const touch_point &cur_tp_f2)
+       : _start_tp_f1(start_tp_f1)
+         , _cur_tp_f1(cur_tp_f1)
+         , _start_tp_f2(start_tp_f2)
+         , _cur_tp_f2(cur_tp_f2)
+         , _new_zoom_factor(.0)
+         , _new_rotation_angle(.0)
+         , _zoom_happend(false)
+         , _rotation_happend(false)
+{
+       /* Finding the start radius */
+       const int start_dx = _start_tp_f2._x - _start_tp_f1._x;
+       const int start_dy = _start_tp_f2._y - _start_tp_f1._y;
+       const double start_r =
+               sqrt(start_dx * start_dx + start_dy * start_dy) / 2;
+
+       /* Finding the cur radius */
+       const int cur_dx = _cur_tp_f2._x - _cur_tp_f1._x;
+       const int cur_dy = _cur_tp_f2._y - _cur_tp_f1._y;
+       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 1
+               if (cur_r > start_r)
+                       _new_zoom_factor = (cur_r / start_r) - 1;
+               else
+                       _new_zoom_factor = -((start_r / cur_r) - 1);
+               #else
+               _new_zoom_factor = cur_r / start_r;
+               #endif
+               _zoom_happend = true;
+       }
+
+       /* Calculating the rotation angle */
+       const double start_angle = atan2(start_dy, start_dx);
+       const double cur_angle = atan2(cur_dy, cur_dx);
+       _new_rotation_angle = (cur_angle - start_angle) * 180. / M_PI;
+       _rotation_happend = true;
+}
+
+
+/* ---------------------------------------------------------------------------*/
+
+
+view::gesture_processor::gesture_processor(gesture_detector *gd)
+       : _gd(gd)
+{
+}
+
+view::gesture_processor::~gesture_processor()
+{
+}
+
+
+/* TODO: | DEBUG ONLY | REMOVE WHEN NO NEEDED */
+map_object_h view::gesture_processor::__DEBUG_add_marker(const int x,
+                                                        const int y,
+                                                        const map_marker_type_e type)
+
+{
+       maps_coordinates_h coords = NULL;
+       map_view_screen_to_geography(_gd->_view, x,  y, &coords);
+       map_object_h marker = NULL;
+       map_object_create_marker(coords,
+                                "/tmp/maps/icon_bluestar.png",
+                                type,
+                                &marker);
+       map_view_add_object(_gd->_view, marker);
+       maps_coordinates_destroy(coords);
+       return marker;
+}
+
+map_object_h view::gesture_processor::__DEBUG_add_geo_marker(
+                                       const maps_coordinates_h coords,
+                                       const map_marker_type_e type)
+
+{
+       return NULL;
+       map_object_h marker = NULL;
+       map_object_create_marker(coords,
+                                "/tmp/maps/icon_redstar.png",
+                                type,
+                                &marker);
+       map_view_add_object(_gd->_view, marker);
+       return marker;
+}
+/* ----- | DEBUG ONLY | REMOVE WHEN NO NEEDED */
+
+extern session::command_queue *__map_view_select_q();
+
+session::command_queue *view::gesture_processor::q()
+{
+       /* This is a thread-friendly mode, when all heavy computations
+        *  are performed in the "idle" mode.
+        *  This mode is good for apps, which has other active widgets in
+        *  addition to Map View.
+        */
+       /* return session::command_queue_view::interface(); */
+
+
+       /* This is a draw-enforcing mode, when the rendering and drawing
+        *  of the map is happening as fast as it possible.
+        *  This mode is good when the Map View is a single active widget
+        *  of the App */
+       /*return session::command_queue_sync::interface();*/
+
+       /* Will use the same queue as used in Map View */
+       return __map_view_select_q();
+}
+
+void *view::gesture_processor::get_maps()
+{
+       return _map_view_get_maps_service_ptr(_gd->_view);
+}
+
+session::command *view::gesture_processor::construct_gesture_command(
+                                               map_gesture_e gesture,
+                                               const maps_coordinates_h c,
+                                               const bool zoom_changed,
+                                               const double zoom,
+                                               const bool rotation_changed,
+                                               const double angle)
+{
+       /* Check if the gesture is available */
+       if (!_map_view_is_gesture_available(_gd->_view, gesture)) {
+               return session::command::empty_ptr();
+       }
+
+       /* Perform gesture action */
+       switch(_map_view_get_gesture_action(_gd->_view, gesture)) {
+       case MAP_ACTION_SCROLL: {
+               maps_coordinates_h coords = c;
+               maps_coordinates_h center_clone = NULL;
+               if(!coords) {
+                       map_view_get_center(_gd->_view, &center_clone);
+                       coords = center_clone;
+               }
+               session::command *cmd =
+                       new session::command_view_set_center(get_maps(),
+                                                            _gd->_view,
+                                                            coords);
+               maps_coordinates_destroy(center_clone);
+               return cmd;
+       }
+#ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+       case MAP_ACTION_ZOOM: {
+               MAPS_LOGD("MAP_ACTION_ZOOM");
+               double zoom_factor = zoom;
+               if(zoom_factor == .0 || !zoom_changed)
+                       map_view_get_zoom_factor(_gd->_view, &zoom_factor);
+               return new session::command_view_zoom(get_maps(), _gd->_view,
+                                                       zoom_factor);
+       }
+       case MAP_ACTION_ZOOM_IN: {
+               MAPS_LOGD("MAP_ACTION_ZOOM_IN");
+               double zoom_factor = zoom;
+               if (zoom_factor == .0 || !zoom_changed)
+                       map_view_get_zoom_factor(_gd->_view, &zoom_factor);
+               return new session::command_view_zoom(get_maps(), _gd->_view,
+                                                       zoom_factor + 1.);
+       }
+       case MAP_ACTION_ZOOM_OUT: {
+               MAPS_LOGD("MAP_ACTION_ZOOM_OUT");
+               double zoom_factor = zoom;
+               if (zoom_factor == .0 || !zoom_changed)
+                       map_view_get_zoom_factor(_gd->_view, &zoom_factor);
+               return new session::command_view_zoom(get_maps(), _gd->_view,
+                                                       zoom_factor - 1.);
+       }
+       case MAP_ACTION_ZOOM_AND_SCROLL: {
+               MAPS_LOGD("MAP_ACTION_ZOOM_AND_SCROLL");
+               double cur_zoom_factor;
+               map_view_get_zoom_factor(_gd->_view, &cur_zoom_factor);
+
+               double new_zoom_factor = zoom;
+               if (new_zoom_factor == .0 || !zoom_changed)
+                       map_view_get_zoom_factor(_gd->_view, &new_zoom_factor);
+
+               if (new_zoom_factor == cur_zoom_factor) new_zoom_factor++;
+               map_view_set_zoom_factor(_gd->_view, new_zoom_factor);
+
+               maps_coordinates_h coords = c;
+               maps_coordinates_h center_clone = NULL;
+               if(!coords) {
+                       map_view_get_center(_gd->_view, &center_clone);
+                       coords = center_clone;
+               }
+               session::command *cmd =
+                       new session::command_view_set_center(get_maps(),
+                                                            _gd->_view,
+                                                            coords);
+               maps_coordinates_destroy(center_clone);
+               return cmd;
+       }
+       case MAP_ACTION_ZOOM_AND_ROTATE: {
+               MAPS_LOGD("MAP_ACTION_ZOOM_AND_ROTATE");
+               double zoom_factor = zoom;
+               if(zoom_factor == .0 || !zoom_changed)
+                       map_view_get_zoom_factor(_gd->_view, &zoom_factor);
+               double rotation_angle = angle;
+               if(rotation_angle == .0 || !rotation_changed)
+                       map_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);
+       }
+       case MAP_ACTION_ROTATE: {
+               MAPS_LOGD("MAP_ACTION_ROTATE");
+               double rotation_angle = angle;
+               if(rotation_angle == .0 || !rotation_changed)
+                       map_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);
+       }
+#else
+       case MAP_ACTION_ZOOM:
+       case MAP_ACTION_ROTATE: {
+               if(zoom_changed & rotation_changed) {
+                       double zoom_factor = zoom;
+                       if(zoom_factor == .0)
+                               map_view_get_zoom_factor(_gd->_view,
+                                                        &zoom_factor);
+                       double rotation_angle = angle;
+                       if(rotation_angle == .0)
+                               map_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) {
+                       double zoom_factor = zoom;
+                       if(zoom_factor == .0)
+                               map_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) {
+                       double rotation_angle = angle;
+                       if(rotation_angle == .0)
+                               map_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);
+               }
+       }
+#endif
+       case MAP_ACTION_NONE:
+               MAPS_LOGI("GESTURE: This Gesture is assigned with no Action");
+       default:
+               return session::command::empty_ptr();
+       }
+}
+
+void view::gesture_processor::on_long_press()
+{
+       /* Assumed that we can tap only with a single finger */
+       touch_point tp = _gd->_info._finger_move[0];
+
+#ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+       /* Check if any object was affected */
+       map_object_h hit = _map_object_hit_test(_gd->_view,
+                                               tp._x,
+                                               tp._y,
+                                               MAP_GESTURE_LONG_PRESS);
+       if (hit) return;
+
+       /* Enqueue the detected command */
+       maps_coordinates_h c = NULL;
+       map_view_screen_to_geography(_gd->_view, tp._x, tp._y, &c);
+       q()->push(construct_gesture_command(MAP_GESTURE_LONG_PRESS, c,
+                                           false, .0, false, .0));
+#else
+       /* Enqueue the detected command */
+       maps_coordinates_h c = NULL;
+       map_view_screen_to_geography(_gd->_view, tp._x, tp._y, &c);
+       q()->push(construct_gesture_command(MAP_GESTURE_LONG_PRESS, c,
+                                           false, .0, false, .0));
+
+       double lat = .0;
+       double lon = .0;
+       maps_coordinates_get_latitude_longitude(c, &lat, &lon);
+       MAPS_LOGI("GESTURE PRESS coordinates: %f, %f", lat, lon);
+
+       /* Check if any object was affected */
+       _map_object_hit_test(_gd->_view,
+                                 tp._x,
+                                 tp._y,
+                                 MAP_GESTURE_LONG_PRESS);
+#endif
+
+       /* Invoke user registered event callback */
+       map_event_data_h ed =
+               _map_view_create_event_data(MAP_EVENT_GESTURE);
+       if(ed) {
+               _map_event_data_set_gesture_type(ed, MAP_GESTURE_LONG_PRESS);
+               _map_event_data_set_xy(ed, tp._x, tp._y);
+               _map_event_data_set_center(ed, c);
+               _map_event_data_set_fingers(ed, 1);
+               _map_view_invoke_event_callback(_gd->_view, ed);
+       }
+
+       maps_coordinates_destroy(c);
+}
+
+void view::gesture_processor::on_double_tap()
+{
+#ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+       /* Assumed that we can tap only with a single finger */
+       touch_point tp = _gd->_info_history._finger_up[0];
+
+       /* Check if any object was affected */
+       map_object_h hit = _map_object_hit_test(_gd->_view,
+                                               tp._x,
+                                               tp._y,
+                                               MAP_GESTURE_DOUBLE_TAP);
+       if (hit) return;
+
+       /* Enqueue the detected command */
+       maps_coordinates_h c = NULL;
+       map_view_screen_to_geography(_gd->_view, tp._x, tp._y, &c);
+       q()->push(construct_gesture_command(MAP_GESTURE_DOUBLE_TAP, c,
+                                           false, .0, false, .0));
+#else
+       /* Default double tap effect is zoom level up */
+       double new_zoom_factor = 1. + int(_gd->_info._start_view_state._zoom_factor);
+
+       /* TODO: it also may be cashed in the _info._start_view_state */
+       int max_zoom_level = 0;
+       map_view_get_max_zoom_level(_gd->_view, &max_zoom_level);
+
+       if(new_zoom_factor > max_zoom_level)
+               new_zoom_factor = max_zoom_level;
+
+       /* Enqueue the detected command */
+       q()->push(construct_gesture_command(MAP_GESTURE_DOUBLE_TAP,
+                                           NULL,
+                                           true, new_zoom_factor,
+                                           false, .0));
+
+       /* Assumed that we can double tap only with a single finger */
+       touch_point tp = _gd->_info._finger_move[0];
+
+       /* Check if any object was affected */
+       _map_object_hit_test(_gd->_view,
+                                 tp._x,
+                                 tp._y,
+                                 MAP_GESTURE_DOUBLE_TAP);
+#endif
+
+       /* Invoke user registered event callback */
+       map_event_data_h ed =
+               _map_view_create_event_data(MAP_EVENT_GESTURE);
+       if(ed) {
+               _map_event_data_set_gesture_type(ed,
+                                                     MAP_GESTURE_DOUBLE_TAP);
+               _map_event_data_set_xy(ed, tp._x, tp._y);
+               _map_event_data_set_fingers(ed, 1);
+               _map_view_invoke_event_callback(_gd->_view, ed);
+       }
+}
+
+void view::gesture_processor::on_tap()
+{
+#ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+       /* Assumed that we can tap only with a single finger */
+       touch_point tp = _gd->_info_history._finger_up[0];
+
+       /* Check if any object was affected */
+       map_object_h hit = _map_object_hit_test(_gd->_view,
+                                               tp._x,
+                                               tp._y,
+                                               MAP_GESTURE_TAP);
+       if (hit) return;
+
+       /* Enqueue the detected command */
+       maps_coordinates_h c = NULL;
+       map_view_screen_to_geography(_gd->_view, tp._x, tp._y, &c);
+       q()->push(construct_gesture_command(MAP_GESTURE_TAP, c,
+                                           false, .0, false, .0));
+       maps_coordinates_destroy(c);
+#else
+       /* Assumed that we can tap only with a single finger */
+       touch_point tp = _gd->_info._finger_move[0];
+
+       /* TODO: Soon it might be a good time to reject the
+       *  use case "tap for set center", because
+       *  it may lead to inconvenient sharpy UX */
+
+       /* Enqueue the detected command */
+       maps_coordinates_h c = NULL;
+       map_view_screen_to_geography(_gd->_view, tp._x, tp._y, &c);
+       q()->push(construct_gesture_command(MAP_GESTURE_TAP, c,
+                                           false, .0, false, .0));
+       maps_coordinates_destroy(c);
+
+       /* Check if any object was affected */
+       _map_object_hit_test(_gd->_view,
+                                 tp._x,
+                                 tp._y,
+                                 MAP_GESTURE_TAP);
+#endif
+
+       /* Invoke user registered event callback */
+       map_event_data_h ed =
+               _map_view_create_event_data(MAP_EVENT_GESTURE);
+       if(ed) {
+               _map_event_data_set_gesture_type(ed, MAP_GESTURE_TAP);
+               _map_event_data_set_xy(ed, tp._x, tp._y);
+               _map_event_data_set_fingers(ed, 1);
+               _map_view_invoke_event_callback(_gd->_view, ed);
+       }
+}
+
+void view::gesture_processor::on_two_finger_tap()
+{
+       MAPS_LOGW("\nON TWO FINGER TAP\n");
+
+#ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+       const touch_point tp_f1 = _gd->_info._finger_move[0];
+       const touch_point tp_f2 = _gd->_info._finger_move[1];
+       const touch_point gesture_center = calc_center(tp_f1, tp_f2);
+
+       /* Enqueue the detected command */
+       maps_coordinates_h c = NULL;
+       map_view_screen_to_geography(_gd->_view, gesture_center._x,
+                                               gesture_center._y, &c);
+
+       /* Enqueue the detected command */
+       q()->push(construct_gesture_command(MAP_GESTURE_2_FINGER_TAP, c,
+                                           false, .0, false, .0));
+#else
+       /* Default double tap effect is zoom level up */
+       double new_zoom_factor =
+               -1. + int(_gd->_info._start_view_state._zoom_factor);
+
+       /* DEBUG */
+       _gd->_info._start_view_state.trace();
+       _gd->_info_history._start_view_state.trace();
+
+       /* TODO: it also may be cashed in the _info._start_view_state */
+       int min_zoom_level = 0;
+       int error = map_view_get_min_zoom_level(_gd->_view, &min_zoom_level);
+       if(error != MAPS_ERROR_NONE)
+               MAPS_LOGE("ERROR [%d]: map_view_get_min_zoom_level", error);
+
+       if(new_zoom_factor < min_zoom_level) {
+               MAPS_LOGI("\t ...Correcting to min zoom level %d, "
+                         "from predicted factor %f, "
+                         "view: %p\n",
+                         min_zoom_level, new_zoom_factor, _gd->_view);
+               new_zoom_factor = min_zoom_level;
+       }
+
+       MAPS_LOGI("\t new zoom factor: %f\n", new_zoom_factor);
+
+       /* Enqueue the detected command */
+       q()->push(construct_gesture_command(MAP_GESTURE_2_FINGER_TAP,
+                                           NULL,
+                                           true, new_zoom_factor,
+                                           false, .0));
+
+       const touch_point tp = _gd->_info._finger_move[0];
+
+#if 0
+       /* TODO: desicde if two-finger tap is applicable for object hit test */
+       /* Check if any object was affected */
+       _map_object_hit_test(_gd->_view,
+                                 tp._x,
+                                 tp._y,
+                                 MAP_GESTURE_2_FINGER_TAP);
+#endif
+#endif
+
+       /* Invoke user registered event callback */
+       map_event_data_h ed =
+               _map_view_create_event_data(MAP_EVENT_GESTURE);
+       if(ed) {
+               _map_event_data_set_gesture_type(ed, MAP_GESTURE_2_FINGER_TAP);
+
+#ifndef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+               /* Calculate proper coordinates: center between fingers */
+               const touch_point tp_f1 = _gd->_info._finger_move[0];
+               const touch_point tp_f2 = _gd->_info._finger_move[1];
+               const touch_point gesture_center = calc_center(tp_f1, tp_f2);
+#endif
+               _map_event_data_set_xy(ed, gesture_center._x,
+                                          gesture_center._y);
+
+               _map_event_data_set_fingers(ed, 2);
+               _map_view_invoke_event_callback(_gd->_view, ed);
+       }
+}
+
+void view::gesture_processor::on_flick()
+{
+}
+
+void view::gesture_processor::on_panning_finished(int finger_no)
+{
+#ifndef _MOVE_CENTER_COMMAND_DEFINED_
+       return;
+#endif /* _MOVE_CENTER_COMMAND_DEFINED_ */
+
+       /* Obtain fresh central coordinates of the map in the Plugin */
+       maps_coordinates_h c = NULL;
+       _map_view_get_plugin_center(_gd->_view, &c);
+
+       /* Directly set the updated center of the map */
+       _map_view_set_center_directly(_gd->_view, c);
+
+       maps_coordinates_destroy(c);
+
+#if 0
+       /* Assumed that we can tap only with a single finger */
+       const touch_point cur_tp = _gd->_info._finger_move[finger_no];
+       const touch_point start_tp = _gd->_info._finger_down[finger_no];
+
+       /* Calculate the new center of the map by adding the delta
+       * to the original center (e.g. the center of the map before the event
+       * has started) */
+
+       /* a. Calculating the delta of the gesture */
+       int delta_x = cur_tp._x - start_tp._x;
+       int delta_y = cur_tp._y - start_tp._y;
+
+       /* b. Get the initial screen coordinates of the center */
+       int center_x = 0;
+       int center_y = 0;
+       map_view_geography_to_screen(_gd->_view,
+                                    _gd->_info._start_view_state._center,
+                                    &center_x,
+                                    &center_y);
+
+       /* c. Apply the delta to the intital center coordinates */
+       center_x -= delta_x;
+       center_y -= delta_y;
+
+       /* d. Converting screent coordinates of new center to
+       * the geographical */
+       maps_coordinates_h c = NULL;
+       map_view_screen_to_geography(_gd->_view, center_x, center_y, &c);
+
+       /* Directly set the updated center of the map */
+       _map_view_set_center_directly(_gd->_view, c);
+
+       maps_coordinates_destroy(c);
+#endif
+}
+
+void view::gesture_processor::on_pan(int finger_no)
+{
+       /* Assumed that we can tap only with a single finger */
+       const touch_point cur_tp = _gd->_info._finger_move[finger_no];
+
+
+       /* Calculate the new center of the map by adding the delta
+       * to the original center (e.g. the center of the map before the event
+       * has started) */
+
+
+#ifdef _MOVE_CENTER_COMMAND_DEFINED_
+       touch_point prev_tp = _gd->_info._prev_finger_down[finger_no];
+       if(prev_tp.empty())
+               prev_tp = _gd->_info._finger_down[finger_no];
+
+       /* a. Calculating the delta of the gesture */
+       int delta_x = cur_tp._x - prev_tp._x;
+       int delta_y = cur_tp._y - prev_tp._y;
+
+       /* b. Enque the command to move the center */
+       q()->push(new session::command_view_move_center(get_maps(),
+                                                       _gd->_view,
+                                                       -delta_x,
+                                                       -delta_y));
+
+
+#else
+       const touch_point start_tp = _gd->_info._finger_down[finger_no];
+
+       /* a. Calculating the delta of the gesture */
+       int delta_x = cur_tp._x - start_tp._x;
+       int delta_y = cur_tp._y - start_tp._y;
+
+       /* b. Get the initial screen coordinates of the center */
+       int center_x = 0;
+       int center_y = 0;
+       map_view_geography_to_screen(_gd->_view,
+                                    _gd->_info._start_view_state._center,
+                                    &center_x,
+                                    &center_y);
+
+       /* c. Apply the delta to the intital center coordinates */
+       center_x -= delta_x;
+       center_y -= delta_y;
+
+       /* d. Converting screent coordinates of new center to
+       * the geographical */
+       maps_coordinates_h c = NULL;
+       map_view_screen_to_geography(_gd->_view, center_x, center_y, &c);
+
+       /* e. Construct the corresponding command */
+       q()->push(construct_gesture_command(MAP_GESTURE_SCROLL, c,
+                                           false, .0, false, .0));
+       maps_coordinates_destroy(c);
+#endif /* _MOVE_CENTER_COMMAND_DEFINED_ */
+
+#if 0
+       /* TODO: desicde if panning is applicable for object hit test */
+       /* Check if any object was affected */
+       _map_object_hit_test(_gd->_view,
+                                 tp._x,
+                                 tp._y,
+                                 MAP_GESTURE_SCROLL);
+#endif
+
+       /* Invoke user registered event callback */
+       map_event_data_h ed =
+               _map_view_create_event_data(MAP_EVENT_GESTURE);
+       if(ed) {
+               _map_event_data_set_gesture_type(ed, MAP_GESTURE_SCROLL);
+               _map_event_data_set_xy(ed, cur_tp._x, cur_tp._y);
+               _map_event_data_set_fingers(ed, 1);
+               _map_view_invoke_event_callback(_gd->_view, ed);
+       }
+}
+
+view::touch_point view::gesture_processor::calc_center(
+                                               const touch_point &tp1,
+                                               const touch_point &tp2) const
+{
+       const unsigned int timestamp = (tp2._timestamp > tp1._timestamp)
+               ? tp2._timestamp
+               : tp1._timestamp;
+       return touch_point(tp1._x + (tp2._x - tp1._x) / 2,
+                          tp1._y + (tp2._y - tp1._y) / 2,
+                          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;
+       map_view_get_geometry(_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;
+       map_view_get_min_zoom_level(_gd->_view, &min_zoom_level);
+       map_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 {
+               map_event_data_h ed =
+                       _map_view_create_event_data(MAP_EVENT_GESTURE);
+               if(!ed)
+                       break;
+               _map_event_data_set_gesture_type(ed,
+                                               MAP_GESTURE_SINGLE_FINGER_ZOOM);
+               _map_event_data_set_zoom_factor(ed, new_zoom_factor);
+               _map_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;*/
+               _map_event_data_set_xy(ed, cur_center._x, cur_center._y);
+               _map_view_invoke_event_callback(_gd->_view, ed);
+       } while(false);
+
+#ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+       /* Enqueue the detected zomm command */
+       q()->push(construct_gesture_command(MAP_GESTURE_SINGLE_FINGER_ZOOM,
+                                           _gd->_info._start_view_state._center,
+                                           true,
+                                           new_zoom_factor,
+                                           false,
+                                           .0));
+#else
+       /* Enqueue the detected zomm command */
+       q()->push(construct_gesture_command(MAP_GESTURE_SINGLE_FINGER_ZOOM,
+                                           NULL,
+                                           true,
+                                           new_zoom_factor,
+                                           false,
+                                           .0));
+#endif
+}
+
+void view::gesture_processor::on_zoom_rotate()
+{
+       gesture_detector::log("view::gesture_processor::on_zoom_rotate",
+                             gesture_detector::FG_LITE_GREEN);
+       /* Assumed that we can zoom&rotate using only a pair of fingers */
+
+       /* 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];
+
+
+       /* Second finger effective way by now */
+       const touch_point start_tp_f2 = _gd->_info._finger_down[1];
+       const touch_point cur_tp_f2 = _gd->_info._finger_move[1];
+
+       /***********************/
+       MAPS_LOGI("%c[%d;%d;%dm"
+                 "Finger1: start(%d, %d), cur(%d, %d)\t"
+                 "Finger2: 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,
+                 start_tp_f2._x, start_tp_f2._y, cur_tp_f2._x, cur_tp_f2._y,
+                 0x1B, 0, 0, 0);
+       /***********************/
+
+
+       /* Calculating the current zoom factor, accordingly to effecitve ways
+        *  of fingers */
+       zoom_calculator zc(start_tp_f1, cur_tp_f1, start_tp_f2, cur_tp_f2);
+       double new_zoom_factor = zc.get_zoom_factor();
+       double new_rotation_angle = zc.get_rotation_angle();
+
+
+       /* Analyse zoom factor changes */
+       bool zoom_changed = false;
+       if(zc.zoom_happend()) {
+               #if 1
+               /* Apply newly calculated zoom factor */
+               new_zoom_factor += _gd->_info._start_view_state._zoom_factor;
+               #else
+               /* Apply newly calculated zoom factor */
+               if(new_zoom_factor > 1.)
+                       new_zoom_factor =
+                               _gd->_info._start_view_state._zoom_factor
+                               + new_zoom_factor - 1.;
+               else if(new_zoom_factor != 0.) {
+                        new_zoom_factor =
+                                _gd->_info._start_view_state._zoom_factor
+                                - (1. - new_zoom_factor);
+               }
+               else
+                        new_zoom_factor =
+                                _gd->_info._start_view_state._zoom_factor;
+               #endif
+
+               /* 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;
+               map_view_get_min_zoom_level(_gd->_view, &min_zoom_level);
+               map_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;
+
+               /* Check if the zoom changed relatively to initial state */
+               zoom_changed = _gd->_info._start_view_state._zoom_factor
+                       != new_zoom_factor;
+       }
+
+       /* Analyze rotation angle changes */
+       bool rotation_changed = false;
+       if(zc.rotation_happend()) {
+               /* Apply newly calculated rotation angle */
+               new_rotation_angle =
+                       _gd->_info._start_view_state._rotation_angle
+                       + new_rotation_angle;
+
+               /* Correct the rotation angle to normalize it
+                *  inside the diapazone of 0..360 degree */
+               new_rotation_angle -= 360. * (int(new_rotation_angle) / 360);
+               new_rotation_angle += 360. * (int(new_rotation_angle) / 360);
+
+               /* Check if the angle changed relatively to initial state */
+               rotation_changed =  _gd->_info._start_view_state._rotation_angle
+                       != new_rotation_angle;
+       }
+
+#ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+       if(!zoom_changed && !rotation_changed)
+               return; // Seems nothing changed, we can return
+
+       do {
+               map_event_data_h ed =
+                       _map_view_create_event_data(MAP_EVENT_GESTURE);
+               if(!ed)
+                       break;
+               _map_event_data_set_gesture_type(ed, MAP_GESTURE_ZOOM);
+               _map_event_data_set_zoom_factor(ed, new_zoom_factor);
+               _map_event_data_set_rotation_angle(ed, new_rotation_angle);
+               _map_event_data_set_fingers(ed, 2);
+
+               /* Find the current center of the gesture */
+               const touch_point cur_center = calc_center(cur_tp_f1,
+                                                          cur_tp_f2);
+               _map_event_data_set_xy(ed,
+                                           cur_center._x,
+                                           cur_center._y);
+               _map_view_invoke_event_callback(_gd->_view, ed);
+       } while(false);
+#else
+       /* Invoke user registered event callback for ZOOM */
+       do {
+               if(!zoom_changed)
+                       break;
+               map_event_data_h ed =
+                       _map_view_create_event_data(MAP_EVENT_GESTURE);
+               if(!ed)
+                       break;
+               _map_event_data_set_gesture_type(ed, MAP_GESTURE_ZOOM);
+               _map_event_data_set_zoom_factor(ed, new_zoom_factor);
+               _map_event_data_set_fingers(ed, 2);
+
+               /* Find the current center of the gesture */
+               const touch_point cur_center = calc_center(cur_tp_f1,
+                                                          cur_tp_f2);
+               _map_event_data_set_xy(ed,
+                                           cur_center._x,
+                                           cur_center._y);
+               _map_view_invoke_event_callback(_gd->_view, ed);
+       } while(false);
+
+       /* Invoke user registered event callback for ROTATION */
+       do {
+               if(rotation_changed)
+                       break;
+
+               map_event_data_h ed =
+                       _map_view_create_event_data(MAP_EVENT_GESTURE);
+               if(!ed)
+                       break;
+               _map_event_data_set_gesture_type(ed, MAP_GESTURE_ROTATE);
+               _map_event_data_set_rotation_angle(ed, new_rotation_angle);
+               _map_event_data_set_fingers(ed, 2);
+
+               /* Find the current center of the gesture */
+               const touch_point cur_center = calc_center(cur_tp_f1,
+                                                          cur_tp_f2);
+               _map_event_data_set_xy(ed,
+                                           cur_center._x,
+                                           cur_center._y);
+               _map_view_invoke_event_callback(_gd->_view, ed);
+       } while(false);
+
+
+       if(!zoom_changed && !rotation_changed)
+               return; // Seems nothing changed, we can return
+#endif
+
+       /* Ignore center move if zoom is not available */
+       const bool movable_center =
+               _map_view_is_gesture_available(_gd->_view, MAP_GESTURE_ZOOM);
+       if(!movable_center) {
+               q()->push(construct_gesture_command(MAP_GESTURE_ZOOM,
+                                                   NULL,
+                                                   zoom_changed,
+                                                   new_zoom_factor,
+                                                   rotation_changed,
+                                                   new_rotation_angle));
+               return;
+       }
+
+
+       /* Shift center accordingly to performed zoom and/or rotation:
+        *  - get the original gesture center coordinates
+        *  - get the current gesture center coordinates
+        *  - calculate the coordinates delta
+        *  - move map center to the opposite value of this delta
+        *  Now we have a map, perfectly responding to the
+        *  double finger zoom and/or rotate action */
+
+
+       /* a. Find delta in screen coordinates */
+       const touch_point start_center = calc_center(start_tp_f1, start_tp_f2);
+       const touch_point cur_center = calc_center(cur_tp_f1, cur_tp_f2);
+       const int delta_x = cur_center._x - start_center._x;
+       const int delta_y = cur_center._y - start_center._y;
+
+
+       /* b. Get the initial screen coordinates of the center */
+       int center_x = 0;
+       int center_y = 0;
+       map_view_geography_to_screen(_gd->_view,
+                                    _gd->_info._start_view_state._center,
+                                    &center_x,
+                                    &center_y);
+
+
+       /* c. Apply the delta to the intital center coordinates */
+       center_x -= delta_x;
+       center_y -= delta_y;
+
+
+       /* d. Converting screent coordinates of new center to
+       * the geographical */
+       maps_coordinates_h new_center = NULL;
+       map_view_screen_to_geography(_gd->_view,
+                                    center_x,
+                                    center_y,
+                                    &new_center);
+
+       /* e. Enque the command to move the center */
+       q()->push(new session::command_view_set_center(get_maps(),
+                                                              _gd->_view,
+                                                              new_center));
+
+       /* f. Enqueue the detected zomm command */
+       q()->push(construct_gesture_command(MAP_GESTURE_ZOOM,
+                                           new_center,
+                                           zoom_changed,
+                                           new_zoom_factor,
+                                           rotation_changed,
+                                           new_rotation_angle));
+
+       maps_coordinates_destroy(new_center);
+}
+
+void view::gesture_processor::on_pinch()
+{
+}
+
+
+
+/* ---------------------------------------------------------------------------*/
+/*    VIEW EVENT STREAM                                                       */
+/* ---------------------------------------------------------------------------*/
+
+
+view::finger_event_stream::finger_event_stream(map_view_h v)
+       : _d(NULL)
+{
+       /* TODO: extract in dedicated factory in map_view.cpp */
+       /* Issuing an instance of gestuer detector */
+       _d = new gesture_detector_statemachine(v);
+       /*_d = new inertial_gesture(v);*/
+       /*_d = new gesture_detector(v);*/
+
+       /* All fingers are un-pressed initially */
+       for(int i = 0; i < MAX_FINGERS; i ++) {
+               _finger_pressed[i] = false;
+               _finger_moving[i] = false;
+       }
+}
+
+
+void view::finger_event_stream::set_gesture_detector(gesture_detector *d)
+{
+       if(!d)
+               return;
+       if(d != _d) {
+               _d->halt_gesture();
+               delete _d;
+               _d = d;
+       }
+}
+
+view::finger_event_stream::~finger_event_stream()
+{
+       if(_d) {
+               _d->halt_gesture();
+               delete _d;
+       }
+       _d = NULL;
+}
+
+void view::finger_event_stream::tap(Evas_Event_Mouse_Down *ev)
+{
+       MAPS_LOGI("finger_event_stream::tap");
+       if(!ev)
+               return;
+
+       /*
+        *  The Ecore sends "move" event before "press" event
+        *  so we have to skip this "late" event "press" for the sake of
+        *  detector simplicity
+        */
+       if(_finger_pressed[0]) {
+               MAPS_LOGI("finger_event_stream::tap [SKIPED]");
+               return;
+       }
+
+       /* Current touch point info */
+       const touch_point tp(ev->canvas.x, ev->canvas.y, ev->timestamp);
+
+       _finger_pressed[0] = true;
+       _finger_down[0] = tp;
+
+       /* Process first finger press */
+       _d->tap(0, tp);
+}
+
+void view::finger_event_stream::move(Evas_Event_Mouse_Move *ev)
+{
+       if(!ev)
+               return;
+
+       /* Current touch point info */
+       const touch_point tp(ev->cur.canvas.x, ev->cur.canvas.y, ev->timestamp);
+
+       MAPS_LOGI("finger_event_stream::move to (%d, %d)", tp._x, tp._y);
+
+       /*
+        *  The Ecore sends "move" event before "press" event
+        *  so we have to emulate the "press" for the sake of
+        *  detector simplicity
+        */
+       if(!_finger_pressed[0]) {
+               MAPS_LOGI("finger_event_stream::tap [CORRECTION]");
+               _finger_pressed[0] = true;
+               _finger_down[0] = tp;
+
+               /* Emulate finger press */
+               _d->tap(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]
+           && 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]
+          || finger_dragged_enough(0, tp)) {
+
+               _finger_moving[0] = true;
+
+               /* Process finger move */
+               _d->move(0, tp);
+       } else {
+               MAPS_LOGI("finger_event_stream::move "
+                         "Not Moved Enough [SKIPED]");
+               return;
+       }
+}
+
+void view::finger_event_stream::up(Evas_Event_Mouse_Up *ev)
+{
+       MAPS_LOGI("finger_event_stream::up");
+       if(!ev)
+               return;
+
+       /* Process finger up */
+       _d->up(0, view::touch_point(ev->canvas.x, ev->canvas.y, ev->timestamp));
+
+       _finger_pressed[0] = false;
+       _finger_moving[0] = false;
+       _finger_down[0].reset();
+}
+
+void view::finger_event_stream::multi_tap(Evas_Event_Multi_Down *ev)
+{
+       MAPS_LOGI("finger_event_stream::multi_tap");
+       if(!ev)
+               return;
+
+       const int finger_no = ev->device;
+       if(finger_no > MAX_FINGERS)
+               return;
+
+       /* Current touch point info */
+       const touch_point tp(ev->canvas.x, ev->canvas.y, ev->timestamp);
+
+       /*
+        *  The Ecore sends "move" event before "press" event
+        *  so we have to skip this "late" event "press" for the sake of
+        *  detector simplicity
+        */
+       if(_finger_pressed[finger_no]) {
+               MAPS_LOGI("finger_event_stream::multi_tap [SKIPED]");
+               return;
+       }
+
+       _finger_pressed[finger_no] = true;
+       _finger_down[finger_no] = tp;
+
+       /* Process finger press */
+       _d->tap(finger_no, tp);
+}
+
+void view::finger_event_stream::multi_move(Evas_Event_Multi_Move *ev)
+{
+       if(!ev)
+               return;
+
+       const int finger_no = ev->device;
+       if(finger_no > MAX_FINGERS)
+               return;
+
+       /* Current touch point info */
+       const touch_point tp(ev->cur.canvas.x, ev->cur.canvas.y, ev->timestamp);
+
+       MAPS_LOGI("finger_event_stream::multi_move to (%d, %d)", tp._x, tp._y);
+
+       /*
+        *  The Ecore sends "move" event before "press" event
+        *  so we have to emulate the "press" for the sake of
+        *  detector simplicity
+        */
+       if(!_finger_pressed[finger_no]) {
+               MAPS_LOGI("finger_event_stream::multi_tap [CORRECTION]");
+               _finger_pressed[finger_no] = true;
+               _finger_down[finger_no] = tp;
+
+               /* Emulate finger press */
+               _d->tap(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]
+           && 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]
+          || finger_dragged_enough(finger_no, tp)) {
+               _finger_moving[finger_no] = true;
+
+               /* Process finger move */
+               _d->move(finger_no, tp);
+       } else {
+               MAPS_LOGI("finger_event_stream::multi_move "
+                         "Not Moved Enough [SKIPED]");
+               return;
+       }
+}
+
+void view::finger_event_stream::multi_up(Evas_Event_Multi_Up *ev)
+{
+       MAPS_LOGI("finger_event_stream::multi_up");
+       if(!ev)
+               return;
+
+       const int finger_no = ev->device;
+       if(finger_no > MAX_FINGERS)
+               return;
+
+       /* Process finger up */
+       _d->up(ev->device, view::touch_point(ev->canvas.x,
+                                           ev->canvas.y,
+                                           ev->timestamp));
+
+       _finger_pressed[finger_no] = false;
+       _finger_moving[finger_no] = false;
+       _finger_down[finger_no].reset();
+}
+
+
+bool view::finger_event_stream::finger_dragged_enough(int finger_no,
+                                                     const touch_point &tp)
+{
+       const touch_point start = _finger_down[finger_no];
+       const int trajectory =
+               gesture_detector::get_trajectory_effective_length(tp, start);
+       return (trajectory >= gesture_detector::__CLICK_AREA);
+}
diff --git a/src/view/gesture_processor.h b/src/view/gesture_processor.h
new file mode 100644 (file)
index 0000000..2ddf27b
--- /dev/null
@@ -0,0 +1,161 @@
+/* Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MAPS_VIEW_GESTURE_PROCESSOR_H__
+#define __MAPS_VIEW_GESTURE_PROCESSOR_H__
+
+
+#include <Ecore.h>
+#include <Evas.h>
+#include "map_view.h"
+#include "command.h"
+#include "command_queue.h"
+#include "runtime_data.h"
+
+
+/* Select the way of panning: shift center on delta coordinates or move to the
+ * specified central coordinate.
+ * If the following MACRO is defined, the shift is performed
+ */
+#define _MOVE_CENTER_COMMAND_DEFINED_
+
+
+namespace view
+{
+
+       /* The service class, allowing to calculate the zoom and rotation
+        *  changes, caused bu two-finger gesture.
+        *  Briefly speaking, the zoom equals to a current distance between two
+        *  fingers, divided on distance, between two fingers in the begining of
+        *  the gesture.
+        *  The rotation angle is an angle between imaginary lines,
+        *  connecting finger positions on the Map View; first line connects
+        *  finger positions in the beginning of the gesture, while the second
+        *  line connects the current finger positions.
+        */
+       class zoom_calculator {
+       protected:
+               touch_point _start_tp_f1;
+               touch_point _cur_tp_f1;
+               touch_point _start_tp_f2;
+               touch_point _cur_tp_f2;
+               double _new_zoom_factor;
+               double _new_rotation_angle;
+               bool _zoom_happend;
+               bool _rotation_happend;
+       public:
+               zoom_calculator(const touch_point &start_tp_f1,
+                               const touch_point &cur_tp_f1,
+                               const touch_point &start_tp_f2,
+                               const touch_point &cur_tp_f2);
+               ~zoom_calculator() {}
+       public:
+               double get_zoom_factor() const
+               {
+                       return _new_zoom_factor;
+               }
+               double get_rotation_angle() const
+               {
+                       return _new_rotation_angle;
+               }
+               bool zoom_happend() const
+               {
+                       return _zoom_happend;
+               }
+               bool rotation_happend() const
+               {
+                       return _rotation_happend;
+               }
+       };
+
+
+       /* -------------------------------------------------------------------*/
+
+
+       /* This class prepares and sends session::commands, assigned with a
+        *  gestures.
+        *  Note, it doesn't know how to recognize gestures - it is the
+        *  responsibility of gesture_detector. */
+       class gesture_processor {
+       public:
+               class gesture_detector *_gd;
+       public:
+               gesture_processor(class gesture_detector *gd);
+               ~gesture_processor();
+       public:
+               void on_long_press();
+               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();
+               session::command *construct_gesture_command(
+                                               map_gesture_e gesture,
+                                               const maps_coordinates_h c,
+                                               const bool zoom_changed,
+                                               const double zoom,
+                                               const bool rotation_changed,
+                                               const double angle);
+       protected:
+               touch_point calc_center(const touch_point &tp1,
+                                       const touch_point &tp2) const;
+       protected:
+               /* TODO: | DEBUG ONLY | REMOVE WHEN NO NEEDED */
+               map_object_h __DEBUG_add_marker(
+                                       const int x, const int y,
+                                       const map_marker_type_e type);
+               map_object_h __DEBUG_add_geo_marker(
+                                       const maps_coordinates_h coords,
+                                       const map_marker_type_e type);
+               /* ----- | DEBUG ONLY | REMOVE WHEN NO NEEDED */
+       };
+
+
+       /* -------------------------------------------------------------------*/
+
+
+       class finger_event_stream {
+       private:
+               class gesture_detector *_d;
+               bool _finger_pressed[MAX_FINGERS];
+               bool _finger_moving[MAX_FINGERS];
+               touch_point _finger_down[MAX_FINGERS];
+       public:
+               finger_event_stream(map_view_h v);
+               ~finger_event_stream();
+       public:
+
+               void tap(Evas_Event_Mouse_Down *ev);
+               void move(Evas_Event_Mouse_Move *ev);
+               void up(Evas_Event_Mouse_Up *ev);
+               void multi_tap(Evas_Event_Multi_Down *ev);
+               void multi_move(Evas_Event_Multi_Move *ev);
+               void multi_up(Evas_Event_Multi_Up *ev);
+       private:
+               bool finger_dragged_enough(int finger_no,
+                                          const touch_point &tp);
+       public:
+               void set_gesture_detector(class gesture_detector *d);
+       };
+};
+
+#endif                         /* __MAPS_VIEW_GESTURE_PROCESSOR_H__ */
diff --git a/src/view/inertial_camera.cpp b/src/view/inertial_camera.cpp
new file mode 100644 (file)
index 0000000..1f8cd29
--- /dev/null
@@ -0,0 +1,232 @@
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include "inertial_camera.h"
+#include "maps_util.h"
+#include <glib.h>
+
+
+view::inertial_camera::inertial_camera(map_view_h view)
+       : _view(view)
+         , target_zoom_factor(.0)
+         , target_rotation_angle(.0)
+         , target_center(NULL)
+         , cur_zoom_factor(.0)
+         , cur_rotation_angle(.0)
+         , cur_center(NULL)
+         , transiting(false)
+{
+}
+
+view::inertial_camera::inertial_camera(const inertial_camera &src)
+       : _view(NULL)
+         , target_zoom_factor(.0)
+         , target_rotation_angle(.0)
+         , target_center(NULL)
+         , cur_zoom_factor(.0)
+         , cur_rotation_angle(.0)
+         , cur_center(NULL)
+         , transiting(false)
+{
+}
+
+view::inertial_camera &view::inertial_camera::operator=(const inertial_camera
+                                                       &src)
+{
+       return *this;
+}
+
+view::inertial_camera::~inertial_camera()
+{
+       maps_coordinates_destroy(target_center);
+       maps_coordinates_destroy(cur_center);
+}
+
+void view::inertial_camera::set_cur_state()
+{
+       if(!_view)
+               return;
+
+       if(!cur_center)
+               maps_coordinates_destroy(cur_center);
+       map_view_get_center(_view, &cur_center);
+       map_view_get_zoom_factor(_view, &cur_zoom_factor);
+       map_view_get_orientation(_view, &cur_rotation_angle);
+}
+
+void view::inertial_camera::set_targets(const maps_coordinates_h center,
+                                       const double &zoom_factor,
+                                       const double &rotation_angle)
+{
+       if(!_view)
+               return;
+
+       /* Store the targets */
+       if(!target_center)
+               maps_coordinates_destroy(target_center);
+       maps_coordinates_clone(center, &target_center);
+
+       target_zoom_factor = zoom_factor;
+       target_rotation_angle = rotation_angle;
+
+       /* Store current state */
+       if(!transiting)
+               set_cur_state();
+
+       /* Start transition */
+       transiting = true;
+}
+
+void view::inertial_camera::set_center_target(const maps_coordinates_h center)
+{
+       if(!_view)
+               return;
+
+       /* Store the target */
+       if(!target_center)
+               maps_coordinates_destroy(target_center);
+       maps_coordinates_clone(center, &target_center);
+
+       /* Store current state */
+       if(!transiting)
+               set_cur_state();
+
+       /* Start transition */
+       transiting = true;
+}
+
+void view::inertial_camera::set_zoom_target(const double &zoom_factor)
+{
+       if(!_view)
+               return;
+
+       /* Store the target */
+       target_zoom_factor = zoom_factor;
+
+       /* Store current state */
+       if(!transiting)
+               set_cur_state();
+
+       /* Start transition */
+       transiting = true;
+}
+
+void view::inertial_camera::set_rotation_target(const double &rotation_angle)
+{
+       if(!_view)
+               return;
+
+       /* Store the target */
+       target_rotation_angle = rotation_angle;
+
+       /* Store current state */
+       if(!transiting)
+               set_cur_state();
+
+       /* Start transition */
+       transiting = true;
+}
+
+double view::inertial_camera::calc_next_step(const double &start,
+                                            const double &finish,
+                                            const double step_ratio) const
+{
+       if(start == finish)
+               return start;
+
+       /* Expanential transition */
+       double step = (finish - start) * step_ratio;
+       double new_pos = start + step;
+       if(finish > start) {
+               new_pos = MAX(new_pos, start);
+               new_pos = MIN(new_pos, finish);
+       } else {
+               new_pos = MIN(new_pos, start);
+               new_pos = MAX(new_pos, finish);
+       }
+       return new_pos;
+}
+
+void view::inertial_camera::next_transition_step()
+{
+       if(!_view)
+               return;
+
+       transiting = false;
+
+       double prev_lat = .0;
+       double prev_lon = .0;
+       double target_lat = .0;
+       double target_lon = .0;
+       maps_coordinates_get_latitude_longitude(cur_center, &prev_lat, &prev_lon);
+       maps_coordinates_get_latitude_longitude(target_center, &target_lat, &target_lon);
+
+#ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+       /* Transiting map center */
+       double next_lat = calc_next_step(prev_lat, target_lat, .15);
+       if (next_lat != prev_lat) transiting = true;
+
+       double next_lon = calc_next_step(prev_lon, target_lon, .15);
+       if (next_lon != prev_lon) transiting = true;
+
+       if (transiting)
+       {
+               int tx, ty, nx, ny;
+               maps_coordinates_s next_center_s = { next_lat, next_lon };
+               map_view_geography_to_screen(_view, &next_center_s, &nx, &ny);
+               map_view_geography_to_screen(_view, target_center, &tx, &ty);
+               if (nx == tx && ny == ty) {
+                       transiting = false;
+                       next_lat = target_lat;
+                       next_lon = target_lon;
+               }
+       }
+#else
+       /* Transiting map center */
+       double next_lat = calc_next_step(prev_lat, target_lat, .5);
+       if(ABS(next_lat - prev_lat) > __GEO_ACCURACY)
+               transiting = true;
+       else
+               next_lat = target_lat;
+
+       double next_lon = calc_next_step(prev_lon, target_lon, .5);
+       if(ABS(next_lon - prev_lon) > __GEO_ACCURACY)
+               transiting = true;
+       else
+               next_lon = target_lon;
+#endif
+
+       maps_coordinates_set_latitude_longitude(cur_center, next_lat, next_lon);
+
+       /* 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)
+               transiting = true;
+       else
+               cur_zoom_factor = target_zoom_factor;
+
+       /* Transizint orientation */
+       cur_rotation_angle = calc_next_step(cur_rotation_angle,
+                                           target_rotation_angle,
+                                           .5);
+       if(ABS(cur_rotation_angle - target_rotation_angle) > __ROTATE_ACCURACY)
+               transiting = true;
+       else
+               cur_rotation_angle = target_rotation_angle;
+}
diff --git a/src/view/inertial_camera.h b/src/view/inertial_camera.h
new file mode 100644 (file)
index 0000000..9d8816f
--- /dev/null
@@ -0,0 +1,75 @@
+/* Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MAPS_VIEW_INERTIAL_CAMERA_H__
+#define __MAPS_VIEW_INERTIAL_CAMERA_H__
+
+
+#include "map_view.h"
+
+namespace view
+{
+       class inertial_camera {
+       protected:
+               map_view_h _view;
+
+               /* Targets */
+               double target_zoom_factor;
+               double target_rotation_angle;
+               maps_coordinates_h target_center;
+
+               /* Current state of transition (or begining) */
+               double cur_zoom_factor;
+               double cur_rotation_angle;
+               maps_coordinates_h cur_center;
+
+               /* Is transition performing right now */
+               bool transiting;
+       protected:
+               static const double __GEO_ACCURACY = 0.00001;
+               static const double __ZOOM_ACCURACY = 0.1;
+               static const double __ROTATE_ACCURACY = 0.5;
+       public:
+               inertial_camera(map_view_h view);
+               ~inertial_camera();
+       private:
+               inertial_camera(const inertial_camera &src);
+               inertial_camera &operator=(const inertial_camera &src);
+       public:
+               void set_targets(const maps_coordinates_h center,
+                                const double &zoom_factor,
+                                const double &rotation_angle);
+               void set_center_target(const maps_coordinates_h center);
+               void set_zoom_target(const double &zoom_factor);
+               void set_rotation_target(const double &rotation_angle);
+
+               void next_transition_step();
+
+               bool is_transiting() const { return transiting; }
+               void set_transiting(bool b) { transiting = b; }
+               maps_coordinates_h get_cur_center() const { return cur_center; }
+               double get_cur_zoom_factor() const { return cur_zoom_factor; }
+               double get_cur_rotation_angle() const {
+                       return cur_rotation_angle; }
+
+       protected:
+               double calc_next_step(const double &start,
+                                    const double &finish,
+                                    const double step_ratio) const;
+               void set_cur_state();
+       };
+};
+
+#endif /* __MAPS_VIEW_INERTIAL_CAMERA_H__ */
diff --git a/src/view/inertial_gesture.cpp b/src/view/inertial_gesture.cpp
new file mode 100644 (file)
index 0000000..25214d2
--- /dev/null
@@ -0,0 +1,258 @@
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include "inertial_gesture.h"
+#include "maps_util.h"
+#include <glib.h>
+#include "gesture_detector_statemachine.h"
+#include <unistd.h>
+#include <time.h>
+
+extern void _map_view_set_idle_listener(map_view_h view,
+                                       void (*callback)(void *user_data),
+                                       void *user_data);
+
+extern void _map_view_halt_inertial_camera(map_view_h view);
+
+view::inertial_gesture::inertial_gesture(map_view_h view)
+       : gesture_detector(view)
+         , _d(NULL)
+         , transiting(false)
+{
+       reset();
+
+       _d = new gesture_detector_statemachine(view);
+
+       _map_view_set_idle_listener(view, on_idle, this);
+}
+
+view::inertial_gesture::~inertial_gesture()
+{
+       _map_view_set_idle_listener(_view, NULL, NULL);
+
+       if(_d)
+               delete _d;
+       _d = NULL;
+}
+
+view::inertial_gesture::inertial_gesture(const inertial_gesture &src)
+       : gesture_detector(NULL)
+         , _d(NULL)
+         , transiting(false)
+{
+}
+
+view::inertial_gesture &view::inertial_gesture::operator=(const inertial_gesture
+                                                         &src)
+{
+       return *this;
+}
+
+void view::inertial_gesture::tap(int finger_no, const touch_point &tp)
+{
+       MAPS_LOGI("TRANSITION finger %d tap time: %d",
+                 finger_no, tp._timestamp);
+
+       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);
+
+                       const touch_point tp(_cur_x[i], _cur_y[i], timestamp);
+                       MAPS_LOGI("TRANSITION finger %d up FAKE BRAKE time: %d",
+                                 i, tp._timestamp);
+                       _d->up(i, tp);
+               }
+
+               _map_view_halt_inertial_camera(_view);
+               _d->halt_gesture();
+               reset();
+       }
+
+       #ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+       _down[finger_no] = tp;
+       #endif
+       _last[finger_no] = tp;
+       _prev[finger_no] = tp;
+       _cur_x[finger_no] = tp._x;
+       _cur_y[finger_no] = tp._y;
+
+       if(_d)
+               _d->tap(finger_no, tp);
+}
+
+void view::inertial_gesture::move(int finger_no, const touch_point &tp)
+{
+       MAPS_LOGI("TRANSITION finger %d move", finger_no);
+
+       _prev[finger_no] = _last[finger_no];
+       _last[finger_no] = tp;
+       _cur_x[finger_no] = tp._x;
+       _cur_y[finger_no] = tp._y;
+
+       if(_d)
+               _d->move(finger_no, tp);
+}
+
+void view::inertial_gesture::up(int finger_no, const touch_point &tp)
+{
+       MAPS_LOGI("TRANSITION finger %d up time: %d",
+                 finger_no, tp._timestamp);
+
+       _last[finger_no] = tp;
+
+       const int delta_x = _last[finger_no]._x - _prev[finger_no]._x;
+       const int delta_y = _last[finger_no]._y - _prev[finger_no]._y;
+       unsigned int dt =
+               _last[finger_no]._timestamp - _prev[finger_no]._timestamp;
+
+       #ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+       int trajectory = get_trajectory_effective_length(_down[finger_no], tp);
+       MAPS_LOGD("trajectory=%d", trajectory);
+       if (trajectory <= 5) dt = 0;
+       #endif
+
+       if(dt == 0) {
+               _derivative_x[finger_no] = .0;
+               _derivative_y[finger_no] = .0;
+       } else {
+               _derivative_x[finger_no] = 40. * (delta_x) / dt;
+               _derivative_y[finger_no] = 40. * (delta_y) / dt;
+       }
+       _dt[finger_no] = MIN(1.*dt, 1.);
+
+       /* Continue "move" with negative acceleration */
+       transiting_part[finger_no] = true;
+       transiting_start[finger_no] = get_cur_time();
+       transiting = true;
+}
+
+void view::inertial_gesture::next_transition_step()
+{
+       MAPS_LOGI("TRANSITION get next transition step");
+       transiting = false;
+
+       //static const double dt = 1.;
+       for(int i = 0; i < MAX_FINGERS; i ++) {
+               if(!transiting_part[i])
+                       continue;
+
+               transiting_part[i] = false;
+
+               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) {
+                       _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]) {
+                       MAPS_LOGI("TRANSITION finger %d move FAKE time: %d",
+                                 i, tp._timestamp);
+                       _d->move(i, tp);
+               } else {
+                       MAPS_LOGI("TRANSITION finger %d up FAKE time: %d",
+                                 i, tp._timestamp);
+                       _d->up(i, tp);
+               }
+
+               transiting = true; /* There were changes, so may be one more
+                                     step in transient is needed */
+       }
+
+       if(!transiting)
+               reset();
+}
+
+double view::inertial_gesture::get_next_point(const double &start,
+                                             const double &derivative,
+                                             const double &dt)
+{
+       /* Simple square parabola */
+       return (start + derivative * dt);
+}
+
+double view::inertial_gesture::get_next_derivative(const double &derivative,
+                                                  const double &dt)
+{
+       /* Simple square parabola */
+       /*if(derivative > 0)
+               return (derivative + __ACCEL * dt);
+       else
+               return (derivative - __ACCEL * dt);*/
+
+       /* Exponential spped down */
+       if(_d->_info._fingers_pressed <= 1)
+               return (derivative * .9);
+       else
+               return (derivative * .5);
+}
+
+unsigned int view::inertial_gesture::get_cur_time()
+{
+       struct timespec ts;
+       unsigned int theTick = 0U;
+       clock_gettime(CLOCK_REALTIME, &ts);
+       theTick  = ts.tv_nsec / 1000000;
+       theTick += ts.tv_sec * 1000;
+       return theTick;
+}
+
+unsigned int view::inertial_gesture::get_transition_time(int finger_no) const
+{
+       return get_cur_time() - transiting_start[finger_no];
+}
+
+void view::inertial_gesture::on_idle(void *data)
+{
+       inertial_gesture *ig = (inertial_gesture *)data;
+       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 ++) {
+               transiting_part[i] = false;
+               transiting_start[i] = 0;
+       }
+}
diff --git a/src/view/inertial_gesture.h b/src/view/inertial_gesture.h
new file mode 100644 (file)
index 0000000..ab43758
--- /dev/null
@@ -0,0 +1,67 @@
+/* Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MAPS_VIEW_INERTIAL_GESTURE_H__
+#define __MAPS_VIEW_INERTIAL_GESTURE_H__
+
+
+#include "gesture_detector.h"
+
+namespace view
+{
+       class inertial_gesture : public gesture_detector {
+       protected:
+               gesture_detector *_d;
+               #ifdef IMPROVEMENT_OF_GESTURES_AND_ACTIONS
+               touch_point _down[MAX_FINGERS];
+               #endif
+               touch_point _last[MAX_FINGERS];
+               touch_point _prev[MAX_FINGERS];
+               double _cur_x[MAX_FINGERS];
+               double _cur_y[MAX_FINGERS];
+               double _derivative_x[MAX_FINGERS];
+               double _derivative_y[MAX_FINGERS];
+               bool transiting;
+               bool transiting_part[MAX_FINGERS];
+               unsigned transiting_start[MAX_FINGERS];
+               double _dt[MAX_FINGERS];
+       private:
+               static const double __ACCURACY = 1;
+       public:
+               inertial_gesture(map_view_h view);
+               ~inertial_gesture();
+       private:
+               inertial_gesture(const inertial_gesture &src);
+               inertial_gesture &operator=(const inertial_gesture &src);
+       public:
+               virtual void tap(int finger_no, const touch_point &tp);
+               virtual void move(int finger_no, const touch_point &tp);
+               virtual void up(int finger_no, const touch_point &tp);
+       public:
+               static void on_idle(void *data);
+       protected:
+               void next_transition_step();
+               double get_next_point(const double &start,
+                                     const double &derivative,
+                                     const double &dt);
+               double get_next_derivative(const double &derivative,
+                                          const double &dt);
+               static unsigned int get_cur_time();
+               unsigned int get_transition_time(int finger_no) const;
+               void reset();
+       };
+};
+
+#endif                         /* __MAPS_VIEW_INERTIAL_GESTURE_H__ */
diff --git a/src/view/marker_constructor.cpp b/src/view/marker_constructor.cpp
new file mode 100644 (file)
index 0000000..2632d6d
--- /dev/null
@@ -0,0 +1,97 @@
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include "marker_constructor.h"
+
+extern int _map_object_create(const map_object_type_e type,
+                             map_object_h *object);
+
+int _map_object_marker_set_type(map_object_h marker,
+                               const map_marker_type_e type);
+
+int view::marker_constructor::get_size_x()
+{
+       return 16;
+}
+
+int view::marker_constructor::get_size_y()
+{
+       return 16;
+}
+
+map_object_h view::marker_constructor::construct(maps_coordinates_h coordinates,
+                                               const char *image_file_path,
+                                               map_marker_type_e type)
+{
+       if (!coordinates || !image_file_path) {
+               __error = MAPS_ERROR_INVALID_PARAMETER;
+               return NULL;
+       }
+
+       if ((type < MAP_MARKER_POI) || (type > MAP_MARKER_NONE)) {
+               __error = MAPS_ERROR_INVALID_PARAMETER;
+               return NULL;
+       }
+
+       __error = MAPS_ERROR_NONE;
+
+       map_object_h marker = NULL;
+       do {
+               /* 1. Create a visual object for marker */
+               __error = _map_object_create(MAP_OBJECT_MARKER,
+                                            &marker);
+               if (__error != MAPS_ERROR_NONE)
+                       break;
+
+               /* 2. Set the marker image file pathe */
+               __error = map_object_marker_set_image_file(marker,
+                                                           image_file_path);
+               if (__error != MAPS_ERROR_NONE)
+                       break;
+
+               /* 3. Set the marker type */
+               __error = _map_object_marker_set_type(marker, type);
+               if (__error != MAPS_ERROR_NONE)
+                       break;
+
+               /* 4 Move the marker to the given coordinates */
+               __error = map_object_marker_set_coordinates(marker,
+                                                                coordinates);
+               if (__error != MAPS_ERROR_NONE)
+                       break;
+
+               /* 5 Set marker size */
+               __error = map_object_marker_resize(marker,
+                                                  get_size_x(),
+                                                  get_size_y());
+               if (__error != MAPS_ERROR_NONE)
+                       break;
+
+               /* 6. Make the Marker visible */
+               __error = map_object_set_visible(marker, true);
+               if (__error != MAPS_ERROR_NONE)
+                       break;
+
+               /* SUCCESS */
+               return marker;
+
+       } while(false);
+
+       /* FAILURE: Releasing objects */
+       map_object_destroy(marker);
+       return NULL;
+}
diff --git a/src/view/marker_constructor.h b/src/view/marker_constructor.h
new file mode 100644 (file)
index 0000000..9c4ef72
--- /dev/null
@@ -0,0 +1,46 @@
+/* Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MAPS_VIEW_MARKER_CONSTRUCTOR_H__
+#define __MAPS_VIEW_MARKER_CONSTRUCTOR_H__
+
+
+#include "map_object.h"
+
+namespace view
+{
+       class marker_constructor {
+       private:
+               int __error;
+       public:
+               marker_constructor()
+                       : __error(MAPS_ERROR_NONE)
+               {
+               }
+       public:
+               map_object_h construct(maps_coordinates_h coordinates,
+                                      const char *image_file_path,
+                                      map_marker_type_e type);
+               int get_error() const
+               {
+                       return __error;
+               }
+       public:
+               static int get_size_x();
+               static int get_size_y();
+       };
+};
+
+#endif                         /* __MAPS_VIEW_MARKER_CONSTRUCTOR_H__ */
diff --git a/src/view/poly_shape_hit_test.cpp b/src/view/poly_shape_hit_test.cpp
new file mode 100644 (file)
index 0000000..e0e27d6
--- /dev/null
@@ -0,0 +1,160 @@
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include "poly_shape_hit_test.h"
+#include <climits>
+#include <math.h>
+
+
+void view::poly_shape_hit_test::add_point(const float x, const float y)
+{
+       __x.push_back(x);
+       __y.push_back(y);
+}
+
+bool view::poly_shape_hit_test::hit_test(const float x,
+                              const float y,
+                              const bool polygon) const
+{
+       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))
+               return false;
+
+       /* 2. Check if the point near the polyline */
+       if(hit_test_polyline(x, y, polygon))
+               return true;
+
+       /* 3. Check if the point near the vertices */
+       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))
+                       return true;
+
+       return false;
+}
+
+bool view::poly_shape_hit_test::hit_test_bounding_box(const float x,
+                                                     const float y) const
+{
+       float x_min = 1. * FLT_MAX;
+       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)
+                       x_min = __x[i];
+               if(__x[i] > x_max)
+                       x_max = __x[i];
+               if(__y[i] < y_min)
+                       y_min = __y[i];
+               if(__y[i] > y_max)
+                       y_max = __y[i];
+       }
+       x_min -= accuracy;
+       x_max += accuracy;
+       y_min -= accuracy;
+       y_max += accuracy;
+
+       return ((x >= x_min) && (x <= x_max)
+               && (y >= y_min) && (y <= y_max));
+}
+
+bool view::poly_shape_hit_test::hit_test_segment(const float x1, const float y1,
+                                      const float x2, const float y2,
+                                      const float x, const float y) const
+{
+       float a = x2 - x1;
+       float b = y2 - y1;
+       float c = sqrt(a * a + b * b);
+       if(c == 0)
+               return false;
+       float sina = b / c;
+       float cosa = a / c;
+
+       float x_shifted = x - x1;
+       float y_shifted = y - y1;
+       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)
+          && (y_rotated >= (-1. * accuracy))
+          && (y_rotated <=  accuracy))
+               return true;
+       return false;
+}
+
+bool view::poly_shape_hit_test::hit_test_polyline(const float x, const float y,
+                                       const bool polygon) const
+{
+       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],
+                                   __x[i], __y[i], x, y))
+                       return true;
+       }
+
+       if(polygon) {
+               /* Final section */
+               if(hit_test_segment(__x[__x.size() - 1], __y[__x.size() - 1],
+                                   __x[0], __y[0], x, y))
+                       return true;
+       }
+
+       return false;
+}
+
+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 ++) {
+               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)
+                   && (y >= cur_y_min) && (y <= cur_y_max))
+                       return true;
+       }
+       return false;
+}
+
+/*
+ * PNPOLY
+ * http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
+ */
+bool view::poly_shape_hit_test::pnpoly(const float x, const float y) const
+{
+       int i, j, c = 0;
+       const int nvert = int(__x.size());
+       for (i = 0, j = nvert-1; i < nvert; j = i++) {
+               if ( ((__y[i] > y) != (__y[j] > y)) &&
+                    (x < (__x[j] - __x[i]) * (y - __y[i])
+                     / (__y[j] - __y[i]) + __x[i]) ) {
+                       c = !c;
+               }
+       }
+       return (c != 0);
+}
diff --git a/src/view/poly_shape_hit_test.h b/src/view/poly_shape_hit_test.h
new file mode 100644 (file)
index 0000000..993721e
--- /dev/null
@@ -0,0 +1,48 @@
+/* Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MAPS_VIEW_POLY_SHAPE_HIT_TEST_H__
+#define __MAPS_VIEW_POLY_SHAPE_HIT_TEST_H__
+
+
+#include <maps_util.h>
+
+
+namespace view
+{
+       class poly_shape_hit_test {
+       private:
+               vector<float> __x;
+               vector<float> __y;
+               float accuracy;
+       public:
+               poly_shape_hit_test() : accuracy(10.) {}
+       public:
+               void add_point(const float x, const float y);
+               bool hit_test(const float x, const float y,
+                             const bool polygon) const;
+       protected:
+               bool hit_test_bounding_box(const float x, const float y) const;
+               bool hit_test_polyline(const float x, const float y,
+                                      const bool polygon) const;
+               bool hit_test_segment(const float x1, const float y1,
+                                     const float x2, const float y2,
+                                     const float x, const float y) const;
+               bool hit_test_vertices(const float x, const float y) const;
+               bool pnpoly(const float x, const float y) const;
+       };
+};
+
+#endif                         /* __MAPS_VIEW_POLY_SHAPE_HIT_TEST_H__ */
diff --git a/src/view/polygon_constructor.cpp b/src/view/polygon_constructor.cpp
new file mode 100644 (file)
index 0000000..b7f26ed
--- /dev/null
@@ -0,0 +1,69 @@
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include "polygon_constructor.h"
+
+extern int _map_object_create(const map_object_type_e type,
+                             map_object_h *object);
+
+map_object_h view::polygon_constructor::construct(const maps_coordinates_list_h
+                                                 coordinates,
+                                                 const unsigned char r,
+                                                 const unsigned char g,
+                                                 const unsigned char b,
+                                                 const unsigned char a)
+{
+       if (!coordinates) {
+               __error = MAPS_ERROR_INVALID_PARAMETER;
+               return NULL;
+       }
+
+       __error = MAPS_ERROR_NONE;
+
+       map_object_h polygon = NULL;
+       do {
+               /* 1. Create a visual object for marker */
+               __error = _map_object_create(MAP_OBJECT_POLYGON,
+                                                &polygon);
+               if (__error != MAPS_ERROR_NONE)
+                       break;
+
+               /* 2. Set the polygon points */
+               __error = map_object_polygon_set_polygon(polygon, coordinates);
+               if (__error != MAPS_ERROR_NONE)
+                       break;
+
+               /* 3. Set the polygon color */
+               __error = map_object_polygon_set_fill_color(polygon,
+                                                                r, g, b, a);
+               if (__error != MAPS_ERROR_NONE)
+                       break;
+
+               /* 5. Set the polygon visible */
+               __error = map_object_set_visible(polygon, true);
+               if (__error != MAPS_ERROR_NONE)
+                       break;
+
+               /* SUCCESS */
+               return polygon;
+
+       } while(false);
+
+       /* FAILURE: Releasing objects */
+       map_object_destroy(polygon);
+       return NULL;
+}
diff --git a/src/view/polygon_constructor.h b/src/view/polygon_constructor.h
new file mode 100644 (file)
index 0000000..21b8bbf
--- /dev/null
@@ -0,0 +1,45 @@
+/* Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MAPS_VIEW_POLYGON_CONSTRUCTOR_H__
+#define __MAPS_VIEW_POLYGON_CONSTRUCTOR_H__
+
+
+#include "map_object.h"
+
+namespace view
+{
+       class polygon_constructor {
+       private:
+               int __error;
+       public:
+               polygon_constructor()
+                       : __error(MAPS_ERROR_NONE)
+               {
+               }
+       public:
+               map_object_h construct(const maps_coordinates_list_h coordinates,
+                                      const unsigned char r,
+                                      const unsigned char g,
+                                      const unsigned char b,
+                                      const unsigned char a);
+               int get_error() const
+               {
+                       return __error;
+               }
+       };
+};
+
+#endif                         /* __MAPS_VIEW_POLYGON_CONSTRUCTOR_H__ */
diff --git a/src/view/polyline_constructor.cpp b/src/view/polyline_constructor.cpp
new file mode 100644 (file)
index 0000000..f4aae36
--- /dev/null
@@ -0,0 +1,76 @@
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include "polyline_constructor.h"
+
+extern int _map_object_create(const map_object_type_e type,
+                             map_object_h *object);
+
+map_object_h view::polyline_constructor::construct(const maps_coordinates_list_h
+                                                  coordinates,
+                                                  const unsigned char r,
+                                                  const unsigned char g,
+                                                  const unsigned char b,
+                                                  const unsigned char a,
+                                                  const int width)
+{
+       if (!coordinates || (width <= 0)) {
+               __error = MAPS_ERROR_INVALID_PARAMETER;
+               return NULL;
+       }
+
+       __error = MAPS_ERROR_NONE;
+
+       map_object_h polyline = NULL;
+       do {
+               /* 1. Create a visual object for polyline */
+               __error = _map_object_create(MAP_OBJECT_POLYLINE,
+                                                &polyline);
+               if (__error != MAPS_ERROR_NONE)
+                       break;
+
+               /* 2. Set the polyline points */
+               __error = map_object_polyline_set_polyline(polyline,
+                                                          coordinates);
+               if (__error != MAPS_ERROR_NONE)
+                       break;
+
+               /* 3. Set the polyline color */
+               __error = map_object_polyline_set_color(polyline,
+                                                            r, g, b, a);
+               if (__error != MAPS_ERROR_NONE)
+                       break;
+
+               /* 4. Set the polyline width */
+               __error = map_object_polyline_set_width(polyline, width);
+               if (__error != MAPS_ERROR_NONE)
+                       break;
+
+               /* 5. Set the polyline visible */
+               __error = map_object_set_visible(polyline, true);
+               if (__error != MAPS_ERROR_NONE)
+                       break;
+
+               /* SUCCESS */
+               return polyline;
+
+       } while(false);
+
+       /* FAILURE: Releasing objects */
+       map_object_destroy(polyline);
+       return NULL;
+}
diff --git a/src/view/polyline_constructor.h b/src/view/polyline_constructor.h
new file mode 100644 (file)
index 0000000..a1620b5
--- /dev/null
@@ -0,0 +1,46 @@
+/* Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MAPS_VIEW_POLYLINE_CONSTRUCTOR_H__
+#define __MAPS_VIEW_POLYLINE_CONSTRUCTOR_H__
+
+
+#include "map_object.h"
+
+namespace view
+{
+       class polyline_constructor {
+       private:
+               int __error;
+       public:
+               polyline_constructor()
+                       : __error(MAPS_ERROR_NONE)
+               {
+               }
+       public:
+               map_object_h construct(const maps_coordinates_list_h coordinates,
+                                      const unsigned char r,
+                                      const unsigned char g,
+                                      const unsigned char b,
+                                      const unsigned char a,
+                                      const int width);
+               int get_error() const
+               {
+                       return __error;
+               }
+       };
+};
+
+#endif                         /* __MAPS_VIEW_POLYLINE_CONSTRUCTOR_H__ */
diff --git a/src/view/route_constructor.cpp b/src/view/route_constructor.cpp
new file mode 100644 (file)
index 0000000..8996f64
--- /dev/null
@@ -0,0 +1,339 @@
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include "route_constructor.h"
+#include <glib.h>
+
+#ifdef TIZEN_3_0_NEXT_MS
+extern int _map_object_create(const map_object_type_e type,
+                             map_object_h *object);
+extern int _map_object_route_set_content(map_object_h route,
+                                             const maps_route_h content);
+
+
+map_object_h view::route_constructor::construct(maps_route_h route)
+{
+       if (!route) {
+               __error = MAPS_ERROR_INVALID_PARAMETER;
+               return NULL;
+       }
+
+       __error = MAPS_ERROR_NONE;
+
+       map_object_h route_object = NULL;
+       do {
+               /* 1. Create a visual object for route */
+               __error = _map_object_create(MAP_OBJECT_ROUTE,
+                                                &route_object);
+               if (__error != MAPS_ERROR_NONE)
+                       break;
+
+               /* 2. Assign route object to route group */
+               __error =  _map_object_route_set_content(route_object,
+                                                             route);
+               if (__error != MAPS_ERROR_NONE)
+                       break;
+
+               /* 3. Set Route visible */
+               __error = map_object_set_visible(route_object, true);
+               if (__error != MAPS_ERROR_NONE)
+                       break;
+
+               /* SUCCESS */
+               return route_object;
+
+       } while(false);
+
+       /* FAILURE: Releasing objects */
+       map_object_destroy(route_object);
+       return NULL;
+}
+#endif /* TIZEN_3_0_NEXT_MS */
+
+
+       /* !!! The old route constructor will be deleted soom!!! */
+#if 0
+
+#include "marker_constructor.h"
+#include "polyline_constructor.h"
+
+extern int _map_object_group_set_route(map_object_h group,
+                                           const maps_route_h route);
+
+const char *view::route_constructor::get_start_marker_image()
+{
+       static const char *image = "start_marker.png";
+       return image;
+}
+
+const char *view::route_constructor::get_finish_marker_image()
+{
+       static const char *image = "finish_marker.png";
+       return image;
+}
+
+const char *view::route_constructor::get_default_marker_image()
+{
+       static const char *image = "route_marker.png";
+       return image;
+}
+
+
+int view::route_constructor::add_marker(map_object_h route_object,
+                                        const maps_coordinates_h coords,
+                                        map_marker_type_e type)
+{
+       if(!route_object || !coords)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       const char *image_file = NULL;
+       switch(type) {
+       case MAP_MARKER_START:
+               image_file = get_start_marker_image();
+               break;
+       case MAP_MARKER_FINISH:
+               image_file = get_finish_marker_image();
+               break;
+       default:
+               image_file = get_default_marker_image();
+               break;
+       }
+
+       marker_constructor mc;
+       map_object_h marker = mc.construct(coords, image_file, type);
+       if(!marker)
+               return mc.get_error();
+       return map_object_group_add_object(route_object, marker);
+}
+
+bool view::route_constructor::add_trajectory_markers(int index,
+                                                    int total,
+                                                    void *data,
+                                                    void *user_data)
+{
+       if(!data || !user_data)
+               return false;
+       add_marker(user_data, data, MAP_MARKER_NONE);
+       return true;
+}
+
+int view::route_constructor::add_trajectory(map_object_h route_object,
+                                           maps_item_list_h points)
+{
+       if(!route_object || !points)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       polyline_constructor pc;
+       map_object_h polyline = pc.construct(points, 255, 0, 0, 0, 1);
+       if(!polyline)
+               return pc.get_error();
+       int e = map_object_group_add_object(route_object, polyline);
+
+       maps_item_list_foreach(points,
+                          maps_item_no_clone,
+                          add_trajectory_markers,
+                          route_object);
+       return e;
+}
+
+void view::route_constructor::add_start_marker(map_object_h route_object,
+                                              maps_route_h route)
+{
+       if(!route_object || !route) {
+               __error = MAPS_ERROR_INVALID_PARAMETER;
+               return;
+       }
+
+       maps_coordinates_h origin = NULL;
+       int __error = maps_route_get_origin(route, &origin);
+       if (__error == MAPS_ERROR_NONE) {
+               __error = add_marker(route_object,
+                                    origin,
+                                    MAP_MARKER_START);
+               maps_coordinates_destroy(origin);
+       }
+}
+
+void view::route_constructor::add_finish_marker(map_object_h route_object,
+                                               maps_route_h route)
+{
+       if(!route_object || !route) {
+               __error = MAPS_ERROR_INVALID_PARAMETER;
+               return;
+       }
+
+       maps_coordinates_h destination = NULL;
+       __error = maps_route_get_destination(route, &destination);
+       if (__error == MAPS_ERROR_NONE) {
+               __error = add_marker(route_object,
+                                    destination,
+                                    MAP_MARKER_FINISH);
+               maps_coordinates_destroy(destination);
+       }
+}
+
+void view::route_constructor::add_route_path(map_object_h route_object,
+                                            maps_route_h route)
+{
+       if(!route_object || !route) {
+               __error = MAPS_ERROR_INVALID_PARAMETER;
+               return;
+       }
+
+       maps_item_list_h points = NULL;
+       __error = maps_item_list_create(&points);
+       if (__error != MAPS_ERROR_NONE)
+               return;
+
+       /* Add Path coordinates */
+       maps_route_foreach_path(route, collect_path_points, points);
+
+       /* Add trajectory to the group */
+       __error = add_trajectory(route_object, points);
+
+       maps_item_list_remove_all(points, maps_coordinates_destroy);
+       maps_item_list_destroy(points);
+}
+
+bool view::route_constructor::collect_path_points(int index, int total,
+                                                maps_coordinates_h coords,
+                                                void *user_data)
+{
+       if (!coords)
+               return false;
+
+       maps_item_list_h list = (maps_item_list_h)user_data;
+       if (list)
+               maps_item_list_append(list, coords, maps_coordinates_clone);
+
+       maps_coordinates_destroy(coords);
+       return true;
+}
+
+void view::route_constructor::add_route_segments(map_object_h route_object,
+                                                maps_route_h route)
+{
+       if(!route_object || !route) {
+               __error = MAPS_ERROR_INVALID_PARAMETER;
+               return;
+       }
+
+       maps_route_foreach_segment(route, collect_segments, route_object);
+}
+
+bool view::route_constructor::collect_segments(int index, int total,
+                                              maps_route_segment_h segment,
+                                              void *user_data)
+{
+       if (!segment)
+               return false;
+
+       map_object_h route_object = (map_object_h)user_data;
+       if(!route_object) {
+               maps_route_segment_destroy(segment);
+               return false;
+       }
+
+
+       maps_item_list_h points = NULL;
+       int e = maps_item_list_create(&points);
+       if (e != MAPS_ERROR_NONE) {
+               maps_route_segment_destroy(segment);
+               return false;
+       }
+
+       /* Add origin coordinates */
+       maps_coordinates_h origin = NULL;
+       maps_route_segment_get_origin(segment, &origin);
+       if(origin)
+               maps_item_list_append(points, origin, maps_item_no_clone);
+
+       /* Add Segment Path coordinates */
+       maps_route_segment_foreach_path(segment, collect_path_points, points);
+
+       /* Add destination coordinates */
+       maps_coordinates_h destination = NULL;
+       maps_route_segment_get_destination(segment, &destination);
+       if(destination)
+               maps_item_list_append(points, destination, maps_item_no_clone);
+
+       /* Add trajectory to the group */
+       view::route_constructor::add_trajectory(route_object, points);
+
+       maps_item_list_remove_all(points, maps_coordinates_destroy);
+       maps_item_list_destroy(points);
+
+       maps_route_segment_destroy(segment);
+       return true;
+}
+
+map_object_h view::route_constructor::construct(map_view_h view,
+                                                    maps_route_h route)
+{
+       if (!route) {
+               __error = MAPS_ERROR_INVALID_PARAMETER;
+               return NULL;
+       }
+
+       __error = MAPS_ERROR_NONE;
+
+       map_object_h route_object = NULL;
+       do {
+               /* 1. Create a visual object for route */
+               __error = _map_object_create(MAP_OBJECT_GROUP,
+                                                &route_object);
+               if (__error != MAPS_ERROR_NONE)
+                       break;
+
+
+               /* 2.a Add Start Marker */
+               add_start_marker(route_object, route);
+
+               /* 2.b Add Finish Marker */
+               add_finish_marker(route_object, route);
+
+
+               /* 3.a Construct trajectory on the base of Route Path */
+               add_route_path(route_object, route);
+
+               /* 3.b Construct trajectory on the base of Route Path */
+               add_route_segments(route_object, route);
+
+
+
+               /* 3. Assign route object to route group */
+               __error =  _map_object_group_set_route(route_object,
+                                                           route);
+               if (__error != MAPS_ERROR_NONE)
+                       break;
+
+               /* 4. Set Route visible */
+               __error = map_object_set_visible(route_object, true);
+               if (__error != MAPS_ERROR_NONE)
+                       break;
+
+               /* SUCCESS */
+               return route_object;
+
+       } while(false);
+
+       /* FAILURE: Releasing objects */
+       map_object_destroy(route_object);
+       return NULL;
+}
+
+#endif
diff --git a/src/view/route_constructor.h b/src/view/route_constructor.h
new file mode 100644 (file)
index 0000000..86446f2
--- /dev/null
@@ -0,0 +1,98 @@
+/* Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MAPS_VIEW_ROUTE_CONSTRUCTOR_H__
+#define __MAPS_VIEW_ROUTE_CONSTRUCTOR_H__
+
+
+#include "map_object.h"
+
+
+#ifdef TIZEN_3_0_NEXT_MS
+namespace view
+{
+
+       class route_constructor {
+       private:
+               int __error;
+       public:
+               route_constructor()
+                       : __error(MAPS_ERROR_NONE)
+               {
+               }
+       public:
+               map_object_h construct(maps_route_h route);
+               int get_error() const
+               {
+                       return __error;
+               }
+       };
+
+       /* !!! The old marker constructor will be deleted soom!!! */
+#if 0
+       class route_constructor {
+       private:
+               int __error;
+       public:
+               route_constructor()
+                       : __error(MAPS_ERROR_NONE)
+               {
+               }
+       public:
+               map_object_h construct(maps_route_h route);
+               int get_error() const
+               {
+                       return __error;
+               }
+       public:
+               static const char *get_start_marker_image();
+               static const char *get_finish_marker_image();
+               static const char *get_default_marker_image();
+       protected:
+               static int add_marker(map_object_h route_object,
+                                      const maps_coordinates_h coords,
+                                      map_marker_type_e type);
+               void add_start_marker(map_object_h route_object,
+                                     maps_route_h route);
+               void add_finish_marker(map_object_h route_object,
+                                      maps_route_h route);
+       protected:
+               static int add_trajectory(map_object_h route_object,
+                                         maps_item_list_h route_points);
+
+               static bool add_trajectory_markers(int index,
+                                                  int total,
+                                                  void *data,
+                                                  void *user_data);
+
+               void add_route_path(map_object_h route_object,
+                                   maps_route_h route);
+               static bool collect_path_points(int index, int total,
+                                               maps_coordinates_h coordinates,
+                                               void *user_data);
+
+               void add_route_segments(map_object_h route_object,
+                                       maps_route_h route);
+               static bool collect_segments(int index, int total,
+                                                  maps_route_segment_h segment,
+                                                  void *user_data);
+       };
+#endif
+
+};
+
+#endif /* TIZEN_3_0_NEXT_MS */
+
+#endif                         /* __MAPS_VIEW_ROUTE_CONSTRUCTOR_H__ */
diff --git a/src/view/runtime_data.cpp b/src/view/runtime_data.cpp
new file mode 100644 (file)
index 0000000..0d4fe6f
--- /dev/null
@@ -0,0 +1,237 @@
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include "runtime_data.h"
+#include "maps_util.h"
+#include <glib.h>
+
+
+view::touch_point::touch_point()
+       : _x(0)
+       , _y(0)
+       , _timestamp(0)
+{
+       reset();
+}
+
+view::touch_point::~touch_point()
+{
+}
+
+view::touch_point::touch_point(const int x,
+                              const int y,
+                              const unsigned int ts)
+       : _x(x)
+       , _y(y)
+       , _timestamp(ts)
+{
+}
+
+view::touch_point::touch_point(const touch_point &src)
+       : _x(0)
+       , _y(0)
+       , _timestamp(0)
+{
+       *this = src;
+}
+
+view::touch_point &view::touch_point::operator=(const touch_point &src)
+{
+       if(this != &src) {
+               _x = src._x;
+               _y = src._y;
+               _timestamp = src._timestamp;
+       }
+       return *this;
+}
+
+void view::touch_point::reset()
+{
+       _x = 0;
+       _y = 0;
+       _timestamp = 0;
+}
+
+bool view::touch_point::empty() const
+{
+       if(_x != 0)
+               return false;
+       if(_y != 0)
+               return false;
+       if(_timestamp != 0)
+               return false;
+       return true;
+}
+/* ---------------------------------------------------------------------------*/
+
+
+view::map_state::map_state()
+       : _center(NULL)
+       , _zoom_factor(.1)
+       , _rotation_angle(.0)
+{
+       reset();
+}
+
+view::map_state::~map_state()
+{
+       if(_center)
+               maps_coordinates_destroy(_center);
+       _center = NULL;
+}
+
+view::map_state::map_state(const map_state &src)
+       : _center(NULL)
+       , _zoom_factor(.1)
+       , _rotation_angle(.0)
+{
+       *this = src;
+}
+
+view::map_state &view::map_state::operator=(const map_state &src)
+{
+       if(this != &src) {
+               reset();
+               maps_coordinates_clone(src._center, &_center);
+               _zoom_factor = src._zoom_factor;
+               _rotation_angle = src._rotation_angle;
+       }
+       return *this;
+}
+
+void view::map_state::reset()
+{
+       if(_center)
+               maps_coordinates_destroy(_center);
+       _center = NULL;
+
+       _zoom_factor = .1;
+       _rotation_angle = .0;
+
+       MAPS_LOGI("%c[%d;%d;%dm"
+                 "central coordinates: RESET"
+                 "%c[%d;%d;%dm",
+                 0x1B, 1, 0, 31,
+                 0x1B, 0, 0, 0);
+}
+
+void view::map_state::capture(map_view_h view)
+{
+       if(!view)
+               return;
+
+       reset();
+
+       map_view_get_center(view, &_center);
+       map_view_get_zoom_factor(view, &_zoom_factor);
+       map_view_get_orientation(view, &_rotation_angle);
+
+
+       /* DEBUG */
+       maps_coordinates_h central_coords = NULL;
+       map_view_get_center(view, &central_coords);
+       double lat = .0, lon = .0;
+       maps_coordinates_get_latitude_longitude(central_coords, &lat, &lon);
+       maps_coordinates_destroy(central_coords);
+       MAPS_LOGI("%c[%d;%d;%dm"
+                 "central coordinates: (%f, %f)"
+                 "%c[%d;%d;%dm",
+                 0x1B, 1, 0, 31,
+                 lat, lon,
+                 0x1B, 0, 0, 0);
+}
+
+void view::map_state::trace()
+{
+       double latitude = .0;
+       double longitude = .0;
+       maps_coordinates_get_latitude_longitude(_center, &latitude, &longitude);
+
+       MAPS_LOGI("%c[%d;%d;%dm"
+                 "Map State: center(%f,%f), zoom(%f), angle(%f)"
+                 "%c[%d;%d;%dm",
+                 0x1B, 1, 0, 93,
+                 latitude, longitude, _zoom_factor, _rotation_angle,
+                 0x1B, 0, 0, 0);
+}
+/* ---------------------------------------------------------------------------*/
+
+view::runtime_touch_info::runtime_touch_info()
+       : _fingers_pressed(0)
+         , _cur_gesture(MAP_GESTURE_NONE)
+         /*, _going(false)*/
+{
+       reset();
+}
+
+view::runtime_touch_info::~runtime_touch_info()
+{
+}
+
+view::runtime_touch_info::runtime_touch_info(const runtime_touch_info &src)
+{
+       *this = src;
+}
+
+view::runtime_touch_info &view::runtime_touch_info::operator=(const
+                                                             runtime_touch_info
+                                                             &src)
+{
+       if(this != &src) {
+               _fingers_pressed = src._fingers_pressed;
+               _cur_gesture = src._cur_gesture;
+               /*_going = src._going;*/
+               _start_view_state = src._start_view_state;
+
+               for(unsigned int i = 0; i < MAX_FINGERS; i ++) {
+                       _finger_down[i] = src._finger_down[i];
+                       _finger_move[i] = src._finger_move[i];
+                       _prev_finger_down[i] = src._prev_finger_down[i];
+                       _finger_up[i] = src._finger_up[i];
+                       _is_finger_pressed[i] = src._is_finger_pressed[i];
+               }
+       }
+       return *this;
+}
+
+void view::runtime_touch_info::reset()
+{
+       /*_going = false;*/
+
+       _fingers_pressed = 0;
+
+       for(unsigned int i = 0; i < MAX_FINGERS; i ++) {
+               _finger_down[i].reset();
+               _finger_move[i].reset();
+               _prev_finger_down[i].reset();
+               _finger_up[i].reset();
+               _is_finger_pressed[i] = false;
+       }
+
+       _cur_gesture = MAP_GESTURE_NONE;
+
+       _start_view_state.reset();
+}
+
+int view::runtime_touch_info::calc_finger_pressed()
+{
+       int cnt = 0;
+       for(unsigned int i = 0; i < MAX_FINGERS; i ++)
+               if(_is_finger_pressed[i])
+                       cnt ++;
+       return cnt;
+}
diff --git a/src/view/runtime_data.h b/src/view/runtime_data.h
new file mode 100644 (file)
index 0000000..d04a27a
--- /dev/null
@@ -0,0 +1,111 @@
+/* Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MAPS_VIEW_RUNTIME_DATA_H__
+#define __MAPS_VIEW_RUNTIME_DATA_H__
+
+
+#include "map_view.h"
+
+#define MAX_FINGERS 10
+
+namespace view
+{
+       /* The info about any touch point or move point, which includes
+        *  screen canvas coordinates and a time stamp */
+       class touch_point {
+       public:
+               int _x;
+               int _y;
+               unsigned int _timestamp;
+       public:
+               touch_point();
+               touch_point(const int x, const int y, const unsigned int ts);
+               touch_point(const touch_point &src);
+               touch_point &operator=(const touch_point &src);
+               ~touch_point();
+       public:
+               void reset();
+               bool empty() const;
+       };
+
+
+       /* -------------------------------------------------------------------*/
+
+
+       /* The info about the basic parameters of the Map View, representing
+        *  its state, including: geographical center coordinates, zoom factor,
+        *  and rotation angle */
+       class map_state {
+       public:
+               maps_coordinates_h _center;
+               double _zoom_factor;
+               double _rotation_angle;
+       public:
+               map_state();
+               map_state(const map_state &src);
+               map_state &operator=(const map_state &rc);
+               ~map_state();
+       public:
+               void reset();
+               void capture(map_view_h view);
+       public:
+               void trace();
+       };
+
+
+       /* -------------------------------------------------------------------*/
+
+
+       /* The info about intermediate gesture state, which includes
+        *  the starting points of gesture fingers; if gesture is still lasting,
+        *  there are provided currently tapped points under user's fingers,
+        *  and if the gesture is just finished, the up points are available.
+        *  The initial state of the Map View is provided as well */
+       class runtime_touch_info {
+       public:
+               //static const unsigned int MAX_FINGERS = 10;
+               int _fingers_pressed; /* Number of fingers */
+
+               touch_point _finger_down[MAX_FINGERS]; /* Finger down */
+               touch_point _finger_move[MAX_FINGERS];
+
+               /* Following is needed for move_center while panning */
+               touch_point _prev_finger_down[MAX_FINGERS];
+
+               touch_point _finger_up[MAX_FINGERS]; /* Finger up */
+
+
+               bool _is_finger_pressed[MAX_FINGERS];
+
+               /* This field would be useful for complicated gestures, such as
+                *  "double tap and pan" for zooming */
+               map_gesture_e _cur_gesture;
+
+               /*bool _going;*/ /* Do we need this? */
+
+               map_state _start_view_state;
+       public:
+               runtime_touch_info();
+               ~runtime_touch_info();
+               runtime_touch_info(const runtime_touch_info &src);
+               runtime_touch_info &operator=(const runtime_touch_info &src);
+       public:
+               void reset();
+               int calc_finger_pressed();
+       };
+};
+
+#endif                         /* __MAPS_VIEW_RUNTIME_DATA_H__ */
index b099a3fdf7625d193c81dfbd5ab28d18a89a3608..f9822715e643d2662686fa2a80d7cbfa4d59a0d8 100644 (file)
@@ -8,12 +8,16 @@ ENDFOREACH(flag)
 
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -Werror")
 
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -Wall -Werror -fvisibility=default")
+SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
+
 INCLUDE_DIRECTORIES(
        src
        src/util
        src/api
        src/plugin
        src/session
+       src/view
        src/tutorial
        )
 
@@ -38,6 +42,11 @@ SET (TEST_SRCS
        src/session/command_queue_test.cpp
        src/session/thread_test.cpp
 
+       src/view/poly_shape_hit_test_test.cpp
+       src/view/marker_constructor_test.cpp
+       src/view/polygon_constructor_test.cpp
+       src/view/polyline_constructor_test.cpp
+       src/view/route_constructor_test.cpp
 
        src/api/maps_api_test.cpp
        src/api/maps_area_test.cpp
@@ -61,12 +70,15 @@ SET (TEST_SRCS
        src/api/maps_place_image_test.cpp
        src/api/maps_place_filter_test.cpp
 
-
        src/api/maps_route_test.cpp
        src/api/maps_route_maneuver_test.cpp
        src/api/maps_route_segment_test.cpp
 
        src/api/maps_preference_test.cpp
+
+       src/api/map_view_test.cpp
+       src/api/map_object_test.cpp
+       src/api/map_event_data_test.cpp
        )
 
 #aux_source_directory(src sources)
@@ -77,9 +89,13 @@ MESSAGE(">>>>>>>>>>>>>${TEST_SRCS}")
 
 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIBDIR}")
 
+
 ADD_EXECUTABLE(${fw_test} ${TEST_SRCS})
 TARGET_LINK_LIBRARIES(${fw_test} ${fw_name} ${${fw_test}_LDFLAGS})
 
+
 INSTALL(TARGETS capi-maps-service-test DESTINATION /opt/usr/devel/)
+INSTALL(FILES capi-maps-service-test.efl DESTINATION /etc/smack/accesses.d)
+INSTALL(FILES capi-maps-service-test.xml DESTINATION /usr/share/packages)
 
 ADD_SUBDIRECTORY(dummy_plugin)
diff --git a/test/capi-maps-service-test.efl b/test/capi-maps-service-test.efl
new file mode 100644 (file)
index 0000000..ab42567
--- /dev/null
@@ -0,0 +1,31 @@
+capi-maps-service-test sys-assert::core rwxat- ------
+org.tizen.crash-popup capi-maps-service-test --x--- ------
+capi-maps-service-test privacy-manager::db rwxa-- ------
+capi-maps-service-test privacy-manager::daemon -w---- ------
+capi-maps-service-test sdbd rwx--l ------
+capi-maps-service-test wrt-security-daemon rwx--l ------
+capi-maps-service-test aul::launch --x--- ------
+capi-maps-service-test org.tizen.browser --x--- ------
+capi-maps-service-test xorg -w---- ------
+capi-maps-service-test aul r----- ------
+capi-maps-service-test isf r----- ------
+capi-maps-service-test pkgmgr::db r----l ------
+capi-maps-service-test pkgmgr::info r----- ------
+capi-maps-service-test ail::db r----- ------
+capi-maps-service-test system::vconf_inhouse r----l ------
+capi-maps-service-test system::vconf_system r----l ------
+capi-maps-service-test system::vconf_setting r----l ------
+capi-maps-service-test system::vconf_multimedia r----l ------
+capi-maps-service-test system::vconf_misc rwx--l ------
+capi-maps-service-test system::vconf_privacy rwx--- ------
+capi-maps-service-test system::vconf rwxat- ------
+capi-maps-service-test system::vconf_network rw---- ------
+capi-maps-service-test system::share rwxat- ------
+capi-maps-service-test system::hwcodec rw---- ------
+capi-maps-service-test system::crash -wx--- ------
+capi-maps-service-test system::use_internet rw---- ------
+capi-maps-service-test system::app_logging -w---- ------
+capi-maps-service-test location_fw::vconf rw---- ------
+capi-maps-service-test location_fw::client rw---- ------
+capi-maps-service-test location_fw::server r----- ------
+capi-maps-service-test connman::get w---- ------
index 97e8c3134908aa65aaf95cec6195b148dff5b49f..8f30dd6b22c5a91b14578779ff656e5bf43feabf 100755 (executable)
@@ -1,5 +1,8 @@
 <manifest>
-       <request>
-               <domain name="_"/>
-       </request>
+       <define>
+               <domain name="capi-maps-service-test"/>
+       </define>
+       <assign>
+               <filesystem path="/usr/share/packages/capi-maps-service-test.xml" label="_"/>
+       </assign>
 </manifest>
diff --git a/test/capi-maps-service-test.xml b/test/capi-maps-service-test.xml
new file mode 100644 (file)
index 0000000..e811152
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="capi-maps-service-test" version="1.0.0" install-location="internal-only">
+       <label>Maps Service API Test</label>
+       <author email="" href="">None</author>
+       <ui-application appid="capi-maps-service-test" exec="/opt/usr/devel/capi-maps-service-test" nodisplay="true" multiple="false" type="capp" taskmanage="false" launch_mode="single">
+               <label>Maps Service Test</label>
+       </ui-application>
+       <privileges>
+               <privilege>http://tizen.org/privilege/mapservice</privilege>
+               <privilege>http://tizen.org/privilege/internet</privilege>
+               <privilege>http://tizen.org/privilege/network.get</privilege>
+       </privileges>
+</manifest>
diff --git a/test/dummy_plugin/CMakeLists.txt b/test/dummy_plugin/CMakeLists.txt
new file mode 100644 (file)
index 0000000..2dca2b1
--- /dev/null
@@ -0,0 +1,27 @@
+SET(DUMMY_PLUGIN "maps-plugin-test")
+
+SET(DUMMY_PLUGIN_SRC
+       dummy_plugin.cpp
+       dummy_route_constructor.cpp
+       ../src/util/maps_object.cpp
+       )
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${DUMMY_PLUGIN} REQUIRED)
+FOREACH(flag ${${DUMMY_PLUGIN}_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -Werror")
+
+ADD_LIBRARY(${DUMMY_PLUGIN} SHARED ${DUMMY_PLUGIN_SRC})
+SET_TARGET_PROPERTIES(${DUMMY_PLUGIN}
+       PROPERTIES
+       VERSION ${FULLVER}
+       SOVERSION ${MAJORVER}
+       CLEAN_DIRECT_OUTPUT 1
+       )
+
+TARGET_LINK_LIBRARIES(${DUMMY_PLUGIN} ${fw_name} ${${DUMMY_PLUGIN}_LDFLAGS})
+
+INSTALL(TARGETS ${DUMMY_PLUGIN} DESTINATION ${LIBDIR}/maps/plugins)
index 55d98657ec711bc6fb800eb799a5e10bec95e483..6b70c734f2a343e65168d071a0fed44a2426082c 100644 (file)
 #include <glib.h>
 
 #include <maps_object.h>
-using namespace maps;
+#include "maps_util.h"
+#include <Ecore.h>
+
+#include <map_view.h>
+
+/* For Route Visual Data */
+#include "dummy_route_constructor.h"
+#include "map_object.h"
+#include <map>
+
 
 static int dummy_geocode_request_id = 101;
 static char __provider_key[1024] = { 0 };
 
+
+/* ---------------------------------------------------------------------------*/
+
+#ifdef TIZEN_3_0_NEXT_MS
+class maps_plugin_route {
+public:
+       /* Handle of the corresponding Map View Object */
+       map_object_h view_object;
+
+       /* List of visual objects, comprising the route */
+       map_object_h group;
+
+       /* Route Content */
+       maps_route_h content;
+
+public:
+       maps_plugin_route(const map_object_h object,
+                         const maps_route_h route)
+               : view_object(object)
+                 , group(NULL)
+                 , content(route)
+       {
+               view::dummy_route_constructor rc;
+               group = rc.construct(route);
+       }
+
+       ~maps_plugin_route()
+       {
+               if(group)
+                       map_object_destroy(group);
+
+               if(content)
+                       maps_route_destroy(content);
+       }
+};
+
+/* Global storage of all route objects */
+std::map<void *, void *> __routes;
+
+static void __remove_route(const map_object_h object)
+{
+       if(!object)
+               return;
+
+       if(__routes.count(object) <= 0)
+               return;
+
+       maps_plugin_route *route = (maps_plugin_route *)__routes[object];
+       if(route)
+               delete route;
+
+       __routes.erase(object);
+}
+
+static void __remove_all_routes()
+{
+       for(std::map<void *, void *>::iterator it = __routes.begin();
+           it != __routes.end(); ++it) {
+               if(!it->second) continue;
+               maps_plugin_route *route = (maps_plugin_route *)it->second;
+               delete route;
+       }
+       __routes.clear();
+}
+
+static void __store_route(const map_object_h object,
+                         maps_plugin_route *route)
+{
+       if(!object || !route)
+               return;
+       __remove_route(object);
+       __routes[object] = route;
+}
+
+
+static maps_plugin_route *__get_route(const map_object_h object)
+{
+       if(!object)
+               return NULL;
+
+       return (maps_plugin_route *)(__routes[object]);
+}
+
+#endif /* TIZEN_3_0_NEXT_MS */
+
 /*----------------------------------------------------------------------------*/
 /* Service API */
 
@@ -38,6 +132,9 @@ EXPORT_API int maps_plugin_init(maps_plugin_h *plugin)
 
 EXPORT_API int maps_plugin_shutdown(maps_plugin_h plugin)
 {
+#ifdef TIZEN_3_0_NEXT_MS
+       __remove_all_routes();
+#endif /* TIZEN_3_0_NEXT_MS */
        return MAPS_ERROR_NONE;
 }
 
@@ -134,7 +231,7 @@ EXPORT_API int maps_plugin_geocode(const char *address,
        g_return_val_if_fail(address, MAPS_ERROR_INVALID_PARAMETER);
        g_return_val_if_fail(callback, MAPS_ERROR_INVALID_PARAMETER);
        g_return_val_if_fail(request_id, MAPS_ERROR_INVALID_PARAMETER);
-       g_return_val_if_fail(preference, MAPS_ERROR_INVALID_PARAMETER);
+       /*g_return_val_if_fail(preference, MAPS_ERROR_INVALID_PARAMETER);*/
 
        *request_id = dummy_geocode_request_id++;
 
@@ -145,7 +242,7 @@ EXPORT_API int maps_plugin_geocode(const char *address,
        if (no_need_callback)
                return MAPS_ERROR_NONE;
 
-       coordinates c(11.1, 22.2);
+       maps::coordinates c(37.1, 127.2);
        callback(MAPS_ERROR_NONE, *request_id, 0, 1, c.clone(), user_data);
        return MAPS_ERROR_NONE;
 }
@@ -161,7 +258,7 @@ EXPORT_API int maps_plugin_geocode_inside_area(const char *address,
        g_return_val_if_fail(bounds, MAPS_ERROR_INVALID_PARAMETER);
        g_return_val_if_fail(callback, MAPS_ERROR_INVALID_PARAMETER);
        g_return_val_if_fail(request_id, MAPS_ERROR_INVALID_PARAMETER);
-       g_return_val_if_fail(preference, MAPS_ERROR_INVALID_PARAMETER);
+       /*g_return_val_if_fail(preference, MAPS_ERROR_INVALID_PARAMETER);*/
 
        *request_id = dummy_geocode_request_id++;
 
@@ -172,7 +269,7 @@ EXPORT_API int maps_plugin_geocode_inside_area(const char *address,
        if (no_need_callback)
                return MAPS_ERROR_NONE;
 
-       coordinates c(11.1, 22.2);
+       maps::coordinates c(37.1, 127.2);
        callback(MAPS_ERROR_NONE, *request_id, 0, 1, c.clone(), user_data);
        return MAPS_ERROR_NONE;
 }
@@ -200,7 +297,7 @@ EXPORT_API int maps_plugin_geocode_by_structured_address(const maps_address_h
        if (no_need_callback)
                return MAPS_ERROR_NONE;
 
-       coordinates c(11.1, 22.2);
+       maps::coordinates c(37.1, 127.2);
        callback(MAPS_ERROR_NONE, *request_id, 0, 1, c.clone(), user_data);
        return MAPS_ERROR_NONE;
 }
@@ -225,7 +322,7 @@ EXPORT_API int maps_plugin_reverse_geocode(double latitude, double longitude,
        if (no_need_callback)
                return MAPS_ERROR_NONE;
 
-       address a;
+       maps::address a;
        maps_address_set_building_number(a, "12");
        maps_address_set_street(a, "Na Boyishti");
        callback(MAPS_ERROR_NONE, *request_id, 0, 1, a.clone(), user_data);
@@ -249,7 +346,7 @@ EXPORT_API int maps_plugin_search_place(const maps_coordinates_h position,
        if (no_need_callback)
                return MAPS_ERROR_NONE;
 
-       place p;
+       maps::place p;
        maps_place_set_id(p, "1722/12");
        maps_place_set_name(p, "U Kalicha");
        callback(MAPS_ERROR_NONE, *request_id, 0, 1, p.clone(), user_data);
@@ -276,7 +373,7 @@ EXPORT_API int maps_plugin_search_place_by_area(const maps_area_h boundary,
        if (no_need_callback)
                return MAPS_ERROR_NONE;
 
-       place p;
+       maps::place p;
        maps_place_set_id(p, "1722/12");
        maps_place_set_name(p, "U Kalicha");
        callback(MAPS_ERROR_NONE, *request_id, 0, 1, p.clone(), user_data);
@@ -303,7 +400,7 @@ EXPORT_API int maps_plugin_search_place_by_address(const char *address,
        if (no_need_callback)
                return MAPS_ERROR_NONE;
 
-       place p;
+       maps::place p;
        maps_place_set_id(p, "1722/12");
        maps_place_set_name(p, "U Kalicha");
        callback(MAPS_ERROR_NONE, *request_id, 0, 1, p.clone(), user_data);
@@ -328,27 +425,53 @@ EXPORT_API int maps_plugin_search_route(const maps_coordinates_h origin,
        if (no_need_callback)
                return MAPS_ERROR_NONE;
 
-       route route;
+       maps::route route;
 
-       item_list <route_maneuver> maneuvers;
-       route_maneuver m1, m2;
-       maneuvers.add(m1);
-       maneuvers.add(m2);
+       maps_route_set_origin(route, maps::coordinates(-85.0, 60.0));
+       maps_route_set_destination(route, maps::coordinates(-45.0, 120.0));
 
-       item_list <route_segment> segments;
-       route_segment s1, s2;
+       maps::item_list <maps::coordinates> path;
+       path.add(maps::coordinates(-85, 80));
+       path.add(maps::coordinates(-75, 110));
+       path.add(maps::coordinates(-65, 100));
+       path.add(maps::coordinates(-50, 90));
+       path.add(maps::coordinates(-40, 70));
+       path.add(maps::coordinates(-30, 80));
+       path.add(maps::coordinates(-45, 140));
+       maps_route_set_path(route, path);
 
-       maps_route_segment_set_origin(s1, coordinates(11.1, 12.1));
-       maps_route_segment_set_destination(s1, coordinates(21.1, 22.1));
-
-       maps_route_segment_set_origin(s2, coordinates(11.1, 12.1));
-       maps_route_segment_set_destination(s2, coordinates(21.1, 22.1));
+       maps::item_list <maps::route_maneuver> maneuvers;
+       maps::route_maneuver m1, m2;
+       maneuvers.add(m1);
+       maneuvers.add(m2);
 
+       maps::item_list <maps::route_segment> segments;
+       maps::route_segment s1, s2, s3;
+
+       /* First segment with detailed path */
+       maps_route_segment_set_origin(s1, maps::coordinates(-85.0, 60.0));
+       maps_route_segment_set_destination(s1, maps::coordinates(-65.0, 80.0));
+       maps::item_list <maps::coordinates> s1_path;
+       s1_path.add(maps::coordinates(-85, 60));
+       s1_path.add(maps::coordinates(-79, 55));
+       s1_path.add(maps::coordinates(-75, 60));
+       s1_path.add(maps::coordinates(-73, 85));
+       s1_path.add(maps::coordinates(-69, 95));
+       s1_path.add(maps::coordinates(-65, 80));
+       maps_route_segment_set_path(s1, s1_path);
        maps_route_segment_set_maneuvers(s1, maneuvers);
-       maps_route_segment_set_maneuvers(s2, maneuvers);
-
        segments.add(s1);
+
+       maps_route_segment_set_origin(s2, maps::coordinates(-65.0, 80.0));
+       maps_route_segment_set_destination(s2, maps::coordinates(-40.0, 50.0));
+       maps_route_segment_set_maneuvers(s2, maneuvers);
        segments.add(s2);
+
+       maps_route_segment_set_origin(s3, maps::coordinates(-40.0, 50.0));
+       maps_route_segment_set_destination(s3, maps::coordinates(-45.0, 120.0));
+       maps_route_segment_set_maneuvers(s3, maneuvers);
+       segments.add(s3);
+
        maps_route_set_segments(route, segments);
 
        callback(MAPS_ERROR_NONE, *request_id, 0, 1, route.clone(), user_data);
@@ -373,21 +496,21 @@ EXPORT_API int maps_plugin_search_route_waypoints(const maps_coordinates_h *
        if (no_need_callback)
                return MAPS_ERROR_NONE;
 
-       route route;
+       maps::route route;
 
-       item_list <route_maneuver> maneuvers;
-       route_maneuver m1, m2;
+       maps::item_list <maps::route_maneuver> maneuvers;
+       maps::route_maneuver m1, m2;
        maneuvers.add(m1);
        maneuvers.add(m2);
 
-       item_list <route_segment> segments;
-       route_segment s1, s2;
+       maps::item_list <maps::route_segment> segments;
+       maps::route_segment s1, s2;
 
-       maps_route_segment_set_origin(s1, coordinates(11.1, 12.1));
-       maps_route_segment_set_destination(s1, coordinates(21.1, 22.1));
+       maps_route_segment_set_origin(s1, maps::coordinates(11.1, 12.1));
+       maps_route_segment_set_destination(s1, maps::coordinates(21.1, 22.1));
 
-       maps_route_segment_set_origin(s2, coordinates(11.1, 12.1));
-       maps_route_segment_set_destination(s2, coordinates(21.1, 22.1));
+       maps_route_segment_set_origin(s2, maps::coordinates(11.1, 12.1));
+       maps_route_segment_set_destination(s2, maps::coordinates(21.1, 22.1));
 
        maps_route_segment_set_maneuvers(s1, maneuvers);
        maps_route_segment_set_maneuvers(s2, maneuvers);
@@ -404,3 +527,962 @@ EXPORT_API int maps_plugin_cancel_request(int request_id)
 {
        return MAPS_ERROR_NONE;
 }
+
+/*-----------------MAPPING API------------------------------------------------*/
+static map_view_h __map_view = NULL;
+static double __zoom_factor = 1.;
+static double __rotation_angle = 0.;
+static maps_coordinates_h __center_coords = NULL;
+Evas_Object *__img = NULL;
+static unsigned int __view_request_no = 50;
+unsigned int *__pixels = NULL;
+
+static int __width = 0;
+static int __height = 0;
+
+static const int __palette_size = 240;
+static unsigned int __demo_palette[__palette_size] = { 0 };
+
+static void __generate_demo_palette()
+{
+       float n = .0;
+       unsigned char r = 0;
+       unsigned char g = 0;
+       unsigned char b = 0;
+
+       unsigned int sr = 255;
+       unsigned int sg = 255;
+       unsigned int sb = 0;
+       unsigned int er = 255;
+       unsigned int eg = 0;
+       unsigned int eb = 0;
+
+       const int steps = __palette_size / 2;
+       for (int i = 0; i < steps; i++)
+       {
+               n = (float)i / (float) (steps - 1);
+               r = (float)sr * (1.0f - n) + (float)er * n;
+               g = (float)sg * (1.0f - n) + (float)eg * n;
+               b = (float)sb * (1.0f - n) + (float)eb * n;
+               unsigned int color = (int(r) << 16) | (int(g) << 8) | b;
+               __demo_palette[i] = color;
+       }
+
+       sr = 255;
+       sg = 0;
+       sb = 0;
+       er = 0;
+       eg = 0;
+       eb = 255;
+       for (int i = 0; i < steps; i++)
+       {
+               n = (float)i / (float) (steps - 1);
+               r = (float)sr * (1.0f - n) + (float)er * n;
+               g = (float)sg * (1.0f - n) + (float)eg * n;
+               b = (float)sb * (1.0f - n) + (float)eb * n;
+               unsigned int color = (int(r) << 16) | (int(g) << 8) | b;
+               __demo_palette[steps + i] = color;
+       }
+}
+
+static int __extract_view_geometry()
+{
+       if (!__map_view)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       int error = MAPS_ERROR_NONE;
+
+       do {
+               error = map_view_get_geometry(__map_view, NULL, NULL,
+                                              &__width, &__height);
+               if (error != MAPS_ERROR_NONE)
+                       break;
+
+               int __x = 0;
+               int __y = 0;
+               error = map_view_get_geometry(__map_view,
+                                              &__x, &__y,
+                                              NULL, NULL);
+               if (error != MAPS_ERROR_NONE)
+                       break;
+
+               g_print("Extracted geometry: %d, %d, %d, %d\n", __x, __y,
+                       __width, __height);
+
+               return MAPS_ERROR_NONE;
+       } while(false);
+
+       return error;
+}
+
+#if 0
+#include <sys/timeb.h>
+int __last_redraw_time = 0;
+static int __get_milli_count()
+{
+       timeb tb;
+       ftime(&tb);
+       int nCount = tb.millitm + (tb.time & 0xfffff) * 1000;
+       return nCount;
+}
+
+int __get_milli_span(int nTimeStart)
+{
+       int nSpan = __get_milli_count() - nTimeStart;
+       if (nSpan < 0)
+               nSpan += 0x100000 * 1000;
+       return nSpan;
+}
+#endif
+
+EXPORT_API int maps_plugin_set_map_view(const map_view_h view)
+{
+       if (view) {
+               __map_view = view;
+
+               /* Default values of internal parameters */
+               __zoom_factor = 1.;
+               __rotation_angle = 0.;
+               __center_coords = NULL;
+               __img = NULL;
+               __pixels = NULL;
+               __width = 0;
+               __height = 0;
+
+               /* Cache the geometry of the Maps View */
+               __extract_view_geometry();
+
+               /* Generate a palette, used in immitation drawing */
+               __generate_demo_palette();
+
+       } else {
+               __map_view = NULL;
+
+               if (__center_coords)
+                       maps_coordinates_destroy(__center_coords);
+               __center_coords = NULL;
+       }
+       return MAPS_ERROR_NONE;
+}
+
+
+static void __render_line(const int x1, const int y1,
+                         const int x2, const int y2,
+                         unsigned int color,
+                         const int width, const int height,
+                         unsigned int *pixels)
+{
+       if (!pixels)
+               return;
+
+       if (x1 == x2) {         /* vertical */
+               for (int y = y1; y <= y2; y ++)
+                       pixels[y * width + x1] = color;
+       } else if (y1 == y2) {  /* horizontal */
+               for (int x = x1; x <= x2; x ++)
+                       pixels[y1 * width + x] = color;
+       } else {                /* regular line: Bresenham's alg */
+/* https://www.cs.unm.edu/~angel/BOOK/
+ *   INTERACTIVE_COMPUTER_GRAPHICS/FOURTH_EDITION/PROGRAMS/bresenham.c */
+               int dx = x2 - x1;
+               if (dx < 0) dx = -dx;
+               int dy = y2 - y1;
+               if (dy < 0) dy = -dy;
+
+               int incx = 1;
+               if (x2 < x1) incx = -1;
+               int incy = 1;
+               if (y2 < y1) incy = -1;
+
+               int x = x1;
+               int y = y1;
+
+               if (dx > dy)
+               {
+                       pixels[y * width + x] = color;
+                       int e = 2*dy - dx;
+                       int inc1 = 2*( dy -dx);
+                       int inc2 = 2*dy;
+                       for (int i = 0; i < dx; i++)
+                       {
+                               if (e >= 0)
+                               {
+                                       y += incy;
+                                       e += inc1;
+                               }
+                               else e += inc2;
+                               x += incx;
+                               pixels[y * width + x] = color;
+                       }
+               }
+               else
+               {
+                       pixels[y * width + x] = color;
+                       int e = 2*dx - dy;
+                       int inc1 = 2*( dx - dy);
+                       int inc2 = 2*dx;
+                       for (int i = 0; i < dy; i++)
+                       {
+                               if (e >= 0)
+                               {
+                                       x += incx;
+                                       e += inc1;
+                               }
+                               else e += inc2;
+                               y += incy;
+                               pixels[y * width + x] = color;
+                       }
+               }
+       }
+
+}
+
+typedef struct __collect_points_s {
+       maps_coordinates_h *poly_coords;
+       int poly_size;
+} __collecting_poings_s;
+
+static bool __map_view_poly_collect_points_cb(int index, int total,
+                                             maps_coordinates_h point,
+                                             void *user_data)
+{
+       if (!point || !user_data)
+               return false;
+
+       __collecting_poings_s *cp = (__collecting_poings_s *)user_data;
+
+       /* On the first iteration we should initialize the buffer for coords */
+       if ((index == 0) && (total > 0)) {
+               cp->poly_size = total;
+               cp->poly_coords = g_new0(maps_coordinates_h, total);
+               if (!cp->poly_coords) {
+                       return false;
+               }
+       }
+       cp->poly_coords[index] = point;
+       return true;
+}
+
+
+static void __draw_polyline(const map_object_h object,
+                           unsigned int *pixels)
+{
+       /*g_print("__draw_polyline\n");*/
+       if (!object || !pixels)
+               return;
+
+       /* Fetch polyline points in one array */
+       __collecting_poings_s cp = { 0 };
+       int error =  map_object_polyline_foreach_point(object,
+                                           __map_view_poly_collect_points_cb,
+                                           &cp);
+       if (error != MAPS_ERROR_NONE) {
+               g_print("Error %d\n", error);
+               if (error == MAPS_ERROR_INVALID_PARAMETER)
+                       g_print("MAPS_ERROR_INVALID_PARAMETER\n");
+               else if (error == MAPS_ERROR_NOT_FOUND)
+                       g_print("MAPS_ERROR_NOT_FOUND\n");
+               return;
+       }
+
+       unsigned char r = 0;
+       unsigned char g = 0;
+       unsigned char b = 0;
+       unsigned char a = 0;
+       map_object_polyline_get_color(object, &r, &g, &b, &a);
+       unsigned int color = ((1 | a) << 24)
+               | ((1 | r) << 16)
+               | ((1 | g) << 8)
+               | b;
+
+       for (int i = 1; i < cp.poly_size; i ++) {
+               /* Start of the current polyline section */
+               int x1 = 0;
+               int y1 = 0;
+               maps_plugin_geography_to_screen(cp.poly_coords[i - 1],
+                                               &x1, &y1);
+
+               /* Finish of the current polyline section */
+               int x2 = 0;
+               int y2 = 0;
+               maps_plugin_geography_to_screen(cp.poly_coords[i], &x2, &y2);
+
+               /* Draw the current polyline section */
+               __render_line(x1, y1, x2, y2,
+                             color,
+                             __width, __height, pixels);
+       }
+
+       /* Release all the points and the array */
+       for (int i = 0; i < cp.poly_size; i ++)
+               maps_coordinates_destroy(cp.poly_coords[i]);
+       g_free(cp.poly_coords);
+}
+
+static void __draw_polygon(const map_object_h object,
+                          unsigned int *pixels)
+{
+       /* g_print("__draw_polygon\n");*/
+       if (!object || !pixels)
+               return;
+
+       /* Fetch polygon points in one array */
+       __collecting_poings_s cp = { 0 };
+       int error =  map_object_polygon_foreach_point(object,
+                                           __map_view_poly_collect_points_cb,
+                                           &cp);
+       if (error != MAPS_ERROR_NONE)
+               return;
+
+       unsigned char r = 0;
+       unsigned char g = 0;
+       unsigned char b = 0;
+       unsigned char a = 0;
+       map_object_polygon_get_fill_color(object, &r, &g, &b, &a);
+       unsigned int color = ((1 | a) << 24)
+               | ((1 | r) << 16)
+               | ((1 | g) << 8)
+               | b;
+
+       /* Draw sections of polygon */
+       for (int i = 1; i < cp.poly_size; i ++) {
+               /* Start of the current polygon section */
+               int x1 = 0;
+               int y1 = 0;
+               maps_plugin_geography_to_screen(cp.poly_coords[i - 1],
+                                               &x1, &y1);
+
+               /* Finish of the current polygon section */
+               int x2 = 0;
+               int y2 = 0;
+               maps_plugin_geography_to_screen(cp.poly_coords[i], &x2, &y2);
+
+               /* Draw the current polygon section */
+               __render_line(x1, y1, x2, y2,
+                             color,
+                             __width, __height, pixels);
+       }
+
+       /* Draw the final section, connecting the last point with the first */
+       if (cp.poly_size > 1) {
+               /* Start of the current polygon section */
+               int x1 = 0;
+               int y1 = 0;
+               maps_plugin_geography_to_screen(cp.poly_coords[cp.poly_size -1],
+                                               &x1, &y1);
+
+               /* Finish of the current polygon section */
+               int x2 = 0;
+               int y2 = 0;
+               maps_plugin_geography_to_screen(cp.poly_coords[0], &x2, &y2);
+
+               /* Draw the current polygon section */
+               __render_line(x1, y1, x2, y2,
+                             color,
+                             __width, __height, pixels);
+       }
+
+       /* Draw lines, connecting all vertices */
+       for (int vertix = 0; vertix < cp.poly_size; vertix ++) {
+               for (int i = 0; i < cp.poly_size; i ++) {
+                       if (i == vertix)
+                               continue;
+                       /* Start of the current polygon section */
+                       int x1 = 0;
+                       int y1 = 0;
+                       maps_plugin_geography_to_screen(
+                                               cp.poly_coords[vertix],
+                                               &x1, &y1);
+
+                       /* Finish of the current polygon section */
+                       int x2 = 0;
+                       int y2 = 0;
+                       maps_plugin_geography_to_screen(cp.poly_coords[i],
+                                                       &x2, &y2);
+
+                       /* Draw the current polygon section */
+                       __render_line(x1, y1, x2, y2,
+                                     color,
+                                     __width, __height, pixels);
+               }
+       }
+
+       /* Release all the points and the array */
+       for (int i = 0; i < cp.poly_size; i ++)
+               maps_coordinates_destroy(cp.poly_coords[i]);
+       g_free(cp.poly_coords);
+}
+
+static void __draw_marker(const map_object_h object, unsigned int *pixels)
+{
+       /*g_print("__draw_marker\n");*/
+       if (!object || !pixels)
+               return;
+
+       /* Get the Marker geographical coordinate */
+       maps_coordinates_h coords = NULL;
+       int error = map_object_marker_get_coordinates(object, &coords);
+       if (error != MAPS_ERROR_NONE)
+               return;
+
+       /* Convert geographical coordinate to screen position */
+       int x = 0;
+       int y = 0;
+       error = maps_plugin_geography_to_screen(coords, &x, &y);
+       if (error != MAPS_ERROR_NONE)
+               return;
+       maps_coordinates_destroy(coords);
+
+       /* Get the Makre screen size */
+       int screen_width = 0;
+       int screen_height = 0;
+       error = map_object_marker_get_size(object,
+                                          &screen_width,
+                                          &screen_height);
+       if (error != MAPS_ERROR_NONE)
+               return;
+
+       /* Draw the marker */
+       map_marker_type_e type = MAP_MARKER_NONE;
+       map_object_marker_get_type(object, &type);
+       switch(type) {
+#ifdef TIZEN_3_0_NEXT_MS
+       case MAP_MARKER_START:
+       case MAP_MARKER_FINISH: {
+               const int dx = screen_width / 2;
+               const int dy = screen_height;
+
+               /* TODO: use proper colors */
+               __render_line(x, y, x - dx, y - dy,
+                             0x0000ff00,  __width, __height, pixels);
+               __render_line(x, y, x + dx, y - dy,
+                             0x0000ff00,  __width, __height, pixels);
+               __render_line(x - dx, y - dy, x + dx, y - dy,
+                             0x0000ff00,  __width, __height, pixels);
+               break;
+       }
+#endif /* TIZEN_3_0_NEXT_MS */
+       case MAP_MARKER_POI: {
+               const int dx = screen_width / 2;
+               const int dy = screen_height / 2;
+
+               /* TODO: use proper colors */
+               __render_line(x - dx, y - dy, x + dx, y + dy,
+                             0x00ff0000,  __width, __height, pixels);
+               __render_line(x + dx, y - dy, x - dx, y + dy,
+                             0x00ff0000,  __width, __height, pixels);
+               break;
+       }
+#ifdef TIZEN_3_0_NEXT_MS
+       case MAP_MARKER_FIRST:
+       case MAP_MARKER_SECOND:
+       case MAP_MARKER_FAVOURITE:
+       case MAP_MARKER_CONSTRUCTION:
+#endif /* TIZEN_3_0_NEXT_MS */
+       case MAP_MARKER_NONE:
+       default: {
+               const int dx = screen_width / 2;
+               const int dy = screen_height / 2;
+
+               /* TODO: use proper colors */
+               __render_line(x, y - dy, x, y + dy,
+                             0x000000ff,  __width, __height, pixels);
+               __render_line(x - dx, y, x + dx, y,
+                             0x000000ff,  __width, __height, pixels);
+                 break;
+       }
+       }
+
+
+}
+
+static void __draw_group(const map_object_h object, unsigned int *pixels);
+
+static bool __for_each_map_object_cb(int index, int total,
+                                         map_object_h object,
+                                         void *user_data)
+{
+       /*g_print("__for_each_map_object_cb\n");*/
+
+       if (!object)
+               return false;
+
+       bool visible = false;
+       int error = map_object_get_visible(object, &visible);
+       if (error != MAPS_ERROR_NONE)
+               return false;
+
+       if (!visible)
+               return true; /* This object should not be drawn */
+
+       /* Extract the type of the object */
+       map_object_type_e type = MAP_OBJECT_UNKNOWN;
+       error = map_object_get_type(object, &type);
+       if (error != MAPS_ERROR_NONE)
+               return false;
+
+       unsigned int *pixels = (unsigned int *)user_data;
+       switch(type) {
+       case MAP_OBJECT_GROUP:
+               __draw_group(object, pixels);
+               break;
+       case MAP_OBJECT_POLYLINE:
+               __draw_polyline(object, pixels);
+               break;
+       case MAP_OBJECT_POLYGON:
+               __draw_polygon(object, pixels);
+               break;
+       case MAP_OBJECT_MARKER:
+               __draw_marker(object, pixels);
+               break;
+#ifdef TIZEN_3_0_NEXT_MS
+       case MAP_OBJECT_ROUTE: {
+               /* The Maps Plugin is in charge of drawing the route */
+
+
+               maps_plugin_route *route = __get_route(object);
+               if(!route)
+                       break;
+
+               __draw_group(route->group, pixels);
+
+               break;
+       }
+#endif /* TIZEN_3_0_NEXT_MS */
+       case MAP_OBJECT_UNKNOWN:
+               g_print("WARNING! Unknown Maps View Object Type!\n");
+               break;
+       default:
+               g_print("ERROR! Unsupported Maps View Object Type!\n");
+               break;
+       }
+       /*map_object_destroy(object);*/
+       return true;
+}
+
+static void __draw_group(const map_object_h object, unsigned int *pixels)
+{
+       /*g_print("__draw_group\n");*/
+       if (!object || !pixels)
+               return;
+
+       map_object_group_foreach_object(object,
+                                            __for_each_map_object_cb,
+                                            pixels);
+}
+
+static bool __perform_render_map()
+{
+       __pixels = NULL;
+
+       const int width = __width;
+       const int height = __height;
+
+       /* Apply the image file to the maps pannel */
+       if (!__img) {
+               map_view_get_panel(__map_view, &__img);
+               evas_object_image_file_set(__img, "/tmp/maps/tizen.jpg", NULL);
+               int err = evas_object_image_load_error_get(__img);
+               if (err != EVAS_LOAD_ERROR_NONE) {
+                       g_print("could not load image %s: %s\n",
+                               "/tmp/maps/tizen.jpg",
+                               evas_load_error_str((Evas_Load_Error)err));
+                       return false;
+               }
+       }
+
+
+       /* Perform some drawing to immitate the computationally complex maps
+        * drawing */
+       const int total_pixels = width * height;
+       unsigned int *pixels =
+               (unsigned int *)evas_object_image_data_get(__img, EINA_TRUE);
+       for (int i = 0; i < total_pixels; i ++)
+               pixels[i] = 0xff11AADD;
+               /*pixels[i] =
+               * double(__view_request_no) / width * int(0xff11AADD);*/
+
+       /* Draw the border */
+       __render_line(0, 0, width - 1, 0,
+                     0x000000ff, width, height, pixels);
+       __render_line(0, height - 1, width - 1, height - 1,
+                     0x000000ff, width, height, pixels);
+       __render_line(0, 0, 0, height - 1,
+                     0x000000ff, width, height, pixels);
+       __render_line(width - 1, 0, width - 1, height - 1,
+                     0x000000ff, width, height, pixels);
+       __render_line(0, 0, width - 1, height - 1,
+                     0x000000ff, width, height, pixels);
+       __render_line(width - 1, 0, 0, height - 1,
+                     0x000000ff, width, height, pixels);
+
+#if 0
+       int center_x = width / 2;
+       int center_y = height / 2;
+       /* Draw something */
+       int cnt = int(__view_request_no % (width / 2 - 1));
+       for (int i = 0; i < cnt; i ++) {
+               int cur_left = center_x - i;
+               int cur_right = center_x + i;
+               int cur_top = center_y - i;
+               int cur_bottom = center_y + i;
+
+               unsigned int color = __demo_palette[i % __palette_size];
+
+               /* Apply zoom to change the palette */
+               unsigned char r = __zoom_factor * ((color & 0x00FF0000) >> 16);
+               unsigned char g = __zoom_factor * ((color & 0x0000FF00) >> 8);
+               unsigned char b = __zoom_factor * (color & 0x0000FF);
+               color = (int(r) << 16) | (int(g) << 8) | b;
+
+               for (int j = cur_left; j <= cur_right; j ++) {
+                       pixels[cur_top * width + j] = color;
+                       pixels[cur_bottom * width + j] = color;
+               }
+               for (int j = cur_top; j <= cur_bottom; j ++) {
+                       pixels[j * width + cur_left] = color;
+                       pixels[j * width + cur_right] = color;
+               }
+       }
+#endif
+
+       /* Draw the visual objects */
+       map_view_foreach_object(__map_view,
+                                __for_each_map_object_cb,
+                                pixels);
+
+       /* Draw the current center position */
+       if (__center_coords) {
+               int map_center_x = 0;
+               int map_center_y = 0;
+
+               maps_coordinates_h cur_center = NULL;
+               maps_coordinates_clone(__center_coords, &cur_center);
+               maps_plugin_geography_to_screen(cur_center,
+                                               &map_center_x, &map_center_y);
+               maps_coordinates_destroy(cur_center);
+
+               __render_line(0, map_center_y, width - 1, map_center_y,
+                             0x00ff0080, width, height, pixels);
+               __render_line(map_center_x, 0, map_center_x, height - 1,
+                             0x00ff0080, width, height, pixels);
+       }
+
+       __pixels = pixels;
+
+
+       return true;
+}
+
+EXPORT_API int maps_plugin_render_map(const maps_coordinates_h coords,
+                                    const double zoom_factor,
+                                    const double rotation_angle,
+                                    maps_plugin_render_map_cb callback,
+                                    void* user_data,
+                                    int* request_id)
+{
+       /*g_print("Render Map:  %d\n", __get_milli_count());*/
+
+       if (!coords || !callback || !request_id)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       *request_id = dummy_geocode_request_id++;
+
+       /* Store the map request params (uncomment when supported) */
+       __zoom_factor = zoom_factor;
+       __rotation_angle = rotation_angle;
+
+       /* Store current center coordinates */
+       if (__center_coords)
+               maps_coordinates_destroy(__center_coords);
+       maps_coordinates_clone(coords, &__center_coords);
+
+       /* Fetch map on the Provider */
+       __perform_render_map();
+
+       __view_request_no += 10;
+
+
+       callback(MAPS_ERROR_NONE, *request_id,
+                maps::coordinates(40.0, 30.0).clone(), /* TODO: it must be a
+                                                          center point */
+                maps::area(60.0, 10.0, 20.0, 50.0).clone(),
+                user_data);
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_plugin_move_center(const int delta_x,
+                                      const int delta_y,
+                                      maps_plugin_render_map_cb callback,
+                                      void* user_data,
+                                      int* request_id)
+{
+       /*g_print("Render Map:  %d\n", __get_milli_count());*/
+
+       if (!callback || !request_id)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       *request_id = dummy_geocode_request_id++;
+
+       /* Get previous center coordinates */
+       int center_x = 0;
+       int center_y = 0;
+       maps_plugin_geography_to_screen(__center_coords,
+                                         &center_x,
+                                         &center_y);
+       center_x += delta_x;
+       center_y += delta_y;
+
+       /* Release previous center coordinates */
+       if (__center_coords) {
+               maps_coordinates_destroy(__center_coords);
+               __center_coords = NULL;
+       }
+
+       /* Update center coordinates */
+       maps_coordinates_h center_coords = NULL;
+       maps_plugin_screen_to_geography(center_x, center_y, &center_coords);
+       maps_coordinates_clone(center_coords, &__center_coords);
+       maps_coordinates_destroy(center_coords);
+
+       /* Fetch map on the Provider */
+       __perform_render_map();
+
+       __view_request_no += 10;
+
+
+       callback(MAPS_ERROR_NONE, *request_id,
+                maps::coordinates(40.0, 30.0).clone(), /* TODO: it must be a
+                                                          center point */
+                maps::area(60.0, 10.0, 20.0, 50.0).clone(),
+                user_data);
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_plugin_draw_map(Evas* canvas, const int x, const int y,
+                                   const int width, const int height)
+{
+       /*g_print("Draw Map:    %d\n", __get_milli_count());*/
+
+       if (!__map_view || !canvas)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       /*g_print("maps_plugin_draw_map:\n"
+               "\tx,y: %d,%d  w,h: %d,%d\n"
+               "\tzoom: %.2f, rotation: %.2f\n",
+               x, y, width, height, __zoom_factor, __rotation_angle);*/
+
+       if (__img && __pixels) {
+               evas_object_image_data_set(__img, __pixels);
+               evas_object_image_data_update_add(__img, 0, 0, width, height);
+       }
+
+#if 0
+       /* Analyze the frame rate */
+       if (__last_redraw_time == 0)
+               __last_redraw_time = __get_milli_count();
+       else {
+               int milsec = __get_milli_span(__last_redraw_time);
+               __last_redraw_time = __get_milli_count();
+               /*g_print("\t\t\t...redraw %d...\n", __view_request_no);*/
+               g_print("\t\t\t...redraw after %d ms...\n", milsec);
+       }
+#endif
+
+
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_plugin_on_object(const map_object_h object,
+                              const map_object_operation_e operation)
+{
+       /* Construct and store internally a Route visual representation */
+       if(!object)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       switch(operation) {
+
+       case MAP_OBJECT_ADD: {
+
+               map_object_type_e type = MAP_OBJECT_UNKNOWN;
+               map_object_get_type(object, &type);
+#ifdef TIZEN_3_0_NEXT_MS
+               if(type != MAP_OBJECT_ROUTE)
+                       break; /* We are interested only in Route */
+#endif /* TIZEN_3_0_NEXT_MS */
+
+               break;
+       }
+
+       case MAP_OBJECT_SET_VISIBLE:
+               /* Ignore */
+               break;
+
+       case MAP_OBJECT_MOVE:
+
+               /* TODO: */
+
+               break;
+
+       case MAP_OBJECT_CHANGE: {
+
+#ifdef TIZEN_3_0_NEXT_MS
+               map_object_type_e type = MAP_OBJECT_UNKNOWN;
+               map_object_get_type(object, &type);
+
+               if(type != MAP_OBJECT_ROUTE)
+                       break; /* We are interested only in Route */
+
+               /* Extract the Route Content from the Map View object */
+               maps_route_h route_content = NULL;
+               int error = map_object_route_get_content(object,
+                                                              &route_content);
+               if(error != MAPS_ERROR_NONE)
+                       return error;
+
+               /* Construct the plugin representation of the route and store it
+                *  internally */
+               __store_route(object,
+                             new maps_plugin_route(object, route_content));
+#endif /* TIZEN_3_0_NEXT_MS */
+
+               break;
+       }
+
+       case MAP_OBJECT_REMOVE:
+#ifdef TIZEN_3_0_NEXT_MS
+               __remove_route(object);
+#endif /* TIZEN_3_0_NEXT_MS */
+               break;
+
+       case MAP_OBJECT_REMOVE_ALL:
+#ifdef TIZEN_3_0_NEXT_MS
+               __remove_all_routes();
+#endif /* TIZEN_3_0_NEXT_MS */
+               break;
+
+       default:
+               /* Unknown operation */
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       }
+
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_plugin_screen_to_geography(const int x, const int y,
+                                              maps_coordinates_h* coords)
+{
+       if (!coords || (x < 0) || (y < 0 ))
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       if (!__map_view)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       if ((__width <= 0) || (__height <= 0))
+               __extract_view_geometry();
+
+       int error = MAPS_ERROR_NONE;
+
+       do {
+               double lon = double(x) / __width * 360. - 180.;
+               double lat = double(y) / __height * 180. - 90;
+
+               if (lat <= -90) {
+                       g_print("latitude is out of range: %f\n", lat);
+                       lat = -90;
+               }
+               if (lat >= 90) {
+                       g_print("latitude is out of range: %f\n", lat);
+                       lat = 90;
+               }
+               if (lon <= -180) {
+                       g_print("longitude is out of range: %f\n", lon);
+                       lon = -180;
+               }
+               if (lon >= 180) {
+                       g_print("longitude is out of range: %f\n", lon);
+                       lon = 180;
+               }
+
+               error = maps_coordinates_create(lat, lon, coords);
+               if (error != MAPS_ERROR_NONE)
+                       break;
+
+               return MAPS_ERROR_NONE;
+       } while(false);
+
+       return error;
+}
+
+EXPORT_API int maps_plugin_geography_to_screen(const maps_coordinates_h
+                                              coords,
+                                              int* x, int* y)
+{
+       if (!coords || !x || !y)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       if (!__map_view)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       if ((__width <= 0) || (__height <= 0))
+               __extract_view_geometry();
+
+       int error = MAPS_ERROR_NONE;
+
+       do {
+               double lat = .0;
+               error = maps_coordinates_get_latitude(coords, &lat);
+               if (error != MAPS_ERROR_NONE)
+                       break;
+
+               double lon = .0;
+               error = maps_coordinates_get_longitude(coords, &lon);
+               if (error != MAPS_ERROR_NONE)
+                       break;
+
+               /*error = maps_coordinates_destroy(coords);
+               if (error != MAPS_ERROR_NONE)
+                       break;*/
+
+               *x = __width * (lon + 180.) / 360.;
+               *y = __height * (lat + 90.) / 180.;
+
+               if (*x < 0) {
+                       g_print("x is out of range %d\n", *x);
+                       *x = 0;
+               }
+               if (*x >  __width) {
+                       g_print("x is out of range %d\n", *x);
+                       *x = __width - 1;
+               }
+               if (*y < 0) {
+                       g_print("y is out of range %d\n", *y);
+                       *y = 0;
+               }
+               if (*y > (__height)) {
+                       g_print("y is out of range %d\n", *y);
+                       *y = __height - 1;
+               }
+
+               return MAPS_ERROR_NONE;
+       } while(false);
+
+       return error;
+}
+
+EXPORT_API int maps_plugin_get_min_zoom_level(int *min_zoom_level)
+{
+       if(!min_zoom_level)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       *min_zoom_level = 2;
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_plugin_get_max_zoom_level(int *max_zoom_level)
+{
+       if(!max_zoom_level)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       *max_zoom_level = 18;
+       return MAPS_ERROR_NONE;
+}
diff --git a/test/dummy_plugin/dummy_route_constructor.cpp b/test/dummy_plugin/dummy_route_constructor.cpp
new file mode 100644 (file)
index 0000000..cd32d1f
--- /dev/null
@@ -0,0 +1,282 @@
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include "dummy_route_constructor.h"
+#include "marker_constructor.h"
+#include "polyline_constructor.h"
+
+#ifdef TIZEN_3_0_NEXT_MS
+extern int _map_object_route_set_content(map_object_h route,
+                                             const maps_route_h content);
+
+
+const char *view::dummy_route_constructor::get_start_marker_image()
+{
+       static const char *image = "start_marker.png";
+       return image;
+}
+
+const char *view::dummy_route_constructor::get_finish_marker_image()
+{
+       static const char *image = "finish_marker.png";
+       return image;
+}
+
+const char *view::dummy_route_constructor::get_default_marker_image()
+{
+       static const char *image = "route_marker.png";
+       return image;
+}
+
+
+int view::dummy_route_constructor::add_marker(map_object_h route_object,
+                                        const maps_coordinates_h coords,
+                                        map_marker_type_e type)
+{
+       if(!route_object || !coords)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       const char *image_file = NULL;
+       switch(type) {
+#ifdef TIZEN_3_0_NEXT_MS
+       case MAP_MARKER_START:
+               image_file = get_start_marker_image();
+               break;
+       case MAP_MARKER_FINISH:
+               image_file = get_finish_marker_image();
+               break;
+#endif /* TIZEN_3_0_NEXT_MS */
+       default:
+               image_file = get_default_marker_image();
+               break;
+       }
+
+       marker_constructor mc;
+       map_object_h marker = mc.construct(coords, image_file, type);
+       if(!marker)
+               return mc.get_error();
+       return map_object_group_add_object(route_object, marker);
+}
+
+bool view::dummy_route_constructor::add_trajectory_markers(int index,
+                                                    int total,
+                                                    void *data,
+                                                    void *user_data)
+{
+       if(!data || !user_data)
+               return false;
+       add_marker(user_data, data, MAP_MARKER_NONE);
+       return true;
+}
+
+int view::dummy_route_constructor::add_trajectory(map_object_h route_object,
+                                           maps_item_list_h points)
+{
+       if(!route_object || !points)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       polyline_constructor pc;
+       map_object_h polyline = pc.construct(NULL, points, 255, 0, 0, 0, 1);
+       if(!polyline)
+               return pc.get_error();
+       int e = map_object_group_add_object(route_object, polyline);
+
+       maps_item_list_foreach(points,
+                          maps_item_no_clone,
+                          add_trajectory_markers,
+                          route_object);
+       return e;
+}
+
+void view::dummy_route_constructor::add_start_marker(map_object_h route_object,
+                                              maps_route_h route)
+{
+       if(!route_object || !route) {
+               __error = MAPS_ERROR_INVALID_PARAMETER;
+               return;
+       }
+
+       maps_coordinates_h origin = NULL;
+       int __error = maps_route_get_origin(route, &origin);
+       if (__error == MAPS_ERROR_NONE) {
+               __error = add_marker(route_object,
+                                    origin,
+                                    MAP_MARKER_POI);
+               maps_coordinates_destroy(origin);
+       }
+}
+
+void view::dummy_route_constructor::add_finish_marker(map_object_h route_object,
+                                               maps_route_h route)
+{
+       if(!route_object || !route) {
+               __error = MAPS_ERROR_INVALID_PARAMETER;
+               return;
+       }
+
+       maps_coordinates_h destination = NULL;
+       __error = maps_route_get_destination(route, &destination);
+       if (__error == MAPS_ERROR_NONE) {
+               __error = add_marker(route_object,
+                                    destination,
+                                    MAP_MARKER_FINISH);
+               maps_coordinates_destroy(destination);
+       }
+}
+
+void view::dummy_route_constructor::add_route_path(map_object_h route_object,
+                                            maps_route_h route)
+{
+       if(!route_object || !route) {
+               __error = MAPS_ERROR_INVALID_PARAMETER;
+               return;
+       }
+
+       maps_item_list_h points = NULL;
+       __error = maps_item_list_create(&points);
+       if (__error != MAPS_ERROR_NONE)
+               return;
+
+       /* Add Path coordinates */
+       maps_route_foreach_path(route, collect_path_points, points);
+
+       /* Add trajectory to the group */
+       __error = add_trajectory(route_object, points);
+
+       maps_item_list_remove_all(points, maps_coordinates_destroy);
+       maps_item_list_destroy(points);
+}
+
+bool view::dummy_route_constructor::collect_path_points(int index, int total,
+                                                maps_coordinates_h coords,
+                                                void *user_data)
+{
+       if (!coords)
+               return false;
+
+       maps_item_list_h list = (maps_item_list_h)user_data;
+       if (list)
+               maps_item_list_append(list, coords, maps_coordinates_clone);
+
+       maps_coordinates_destroy(coords);
+       return true;
+}
+
+void view::dummy_route_constructor::add_route_segments(map_object_h route_object,
+                                                maps_route_h route)
+{
+       if(!route_object || !route) {
+               __error = MAPS_ERROR_INVALID_PARAMETER;
+               return;
+       }
+
+       maps_route_foreach_segment(route, collect_segments, route_object);
+}
+
+bool view::dummy_route_constructor::collect_segments(int index, int total,
+                                              maps_route_segment_h segment,
+                                              void *user_data)
+{
+       if (!segment)
+               return false;
+
+       map_object_h route_object = (map_object_h)user_data;
+       if(!route_object) {
+               maps_route_segment_destroy(segment);
+               return false;
+       }
+
+
+       maps_item_list_h points = NULL;
+       int e = maps_item_list_create(&points);
+       if (e != MAPS_ERROR_NONE) {
+               maps_route_segment_destroy(segment);
+               return false;
+       }
+
+       /* Add origin coordinates */
+       maps_coordinates_h origin = NULL;
+       maps_route_segment_get_origin(segment, &origin);
+       if(origin)
+               maps_item_list_append(points, origin, maps_item_no_clone);
+
+       /* Add Segment Path coordinates */
+       maps_route_segment_foreach_path(segment, collect_path_points, points);
+
+       /* Add destination coordinates */
+       maps_coordinates_h destination = NULL;
+       maps_route_segment_get_destination(segment, &destination);
+       if(destination)
+               maps_item_list_append(points, destination, maps_item_no_clone);
+
+       /* Add trajectory to the group */
+       view::dummy_route_constructor::add_trajectory(route_object, points);
+
+       maps_item_list_remove_all(points, maps_coordinates_destroy);
+       maps_item_list_destroy(points);
+
+       maps_route_segment_destroy(segment);
+       return true;
+}
+
+map_object_h view::dummy_route_constructor::construct(maps_route_h route)
+{
+       if (!route) {
+               __error = MAPS_ERROR_INVALID_PARAMETER;
+               return NULL;
+       }
+
+       __error = MAPS_ERROR_NONE;
+
+       map_object_h route_object = NULL;
+       do {
+               /* 1. Create a visual object for route */
+               __error = map_object_create(MAP_OBJECT_GROUP,
+                                                &route_object);
+               if (__error != MAPS_ERROR_NONE)
+                       break;
+
+
+               /* 2.a Add Start Marker */
+               add_start_marker(route_object, route);
+
+               /* 2.b Add Finish Marker */
+               add_finish_marker(route_object, route);
+
+
+               /* 3.a Construct trajectory on the base of Route Path */
+               add_route_path(route_object, route);
+
+               /* 3.b Construct trajectory on the base of Route Path */
+               add_route_segments(route_object, route);
+
+
+               /* 4. Set Route visible */
+               __error = map_object_set_visible(route_object, true);
+               if (__error != MAPS_ERROR_NONE)
+                       break;
+
+               /* SUCCESS */
+               return route_object;
+
+       } while(false);
+
+       /* FAILURE: Releasing objects */
+       map_object_destroy(route_object);
+       return NULL;
+}
+#endif /* TIZEN_3_0_NEXT_MS */
diff --git a/test/dummy_plugin/dummy_route_constructor.h b/test/dummy_plugin/dummy_route_constructor.h
new file mode 100644 (file)
index 0000000..f2e1d75
--- /dev/null
@@ -0,0 +1,79 @@
+/* Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MAPS_VIEW_ROUTE_CONSTRUCTOR_H__
+#define __MAPS_VIEW_ROUTE_CONSTRUCTOR_H__
+
+
+#include "map_object.h"
+#include "maps_extra_types.h"
+
+
+#ifdef TIZEN_3_0_NEXT_MS
+namespace view
+{
+
+       class dummy_route_constructor {
+       private:
+               int __error;
+       public:
+               dummy_route_constructor()
+                       : __error(MAPS_ERROR_NONE)
+               {
+               }
+       public:
+               map_object_h construct(maps_route_h route);
+               int get_error() const
+               {
+                       return __error;
+               }
+       public:
+               static const char *get_start_marker_image();
+               static const char *get_finish_marker_image();
+               static const char *get_default_marker_image();
+       protected:
+               static int add_marker(map_object_h route_object,
+                                      const maps_coordinates_h coords,
+                                      map_marker_type_e type);
+               void add_start_marker(map_object_h route_object,
+                                     maps_route_h route);
+               void add_finish_marker(map_object_h route_object,
+                                      maps_route_h route);
+       protected:
+               static int add_trajectory(map_object_h route_object,
+                                         maps_item_list_h route_points);
+
+               static bool add_trajectory_markers(int index,
+                                                  int total,
+                                                  void *data,
+                                                  void *user_data);
+
+               void add_route_path(map_object_h route_object,
+                                   maps_route_h route);
+               static bool collect_path_points(int index, int total,
+                                               maps_coordinates_h coordinates,
+                                               void *user_data);
+
+               void add_route_segments(map_object_h route_object,
+                                       maps_route_h route);
+               static bool collect_segments(int index, int total,
+                                                  maps_route_segment_h segment,
+                                                  void *user_data);
+       };
+
+};
+#endif /* TIZEN_3_0_NEXT_MS */
+
+#endif                         /* __MAPS_VIEW_ROUTE_CONSTRUCTOR_H__ */
diff --git a/test/dummy_plugin/maps-plugin-test.manifest b/test/dummy_plugin/maps-plugin-test.manifest
new file mode 100644 (file)
index 0000000..ae3e6f7
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+       <request>
+               <domain name="_"/>
+       </request>
+</manifest>
\ No newline at end of file
diff --git a/test/src/api/map_event_data_test.cpp b/test/src/api/map_event_data_test.cpp
new file mode 100644 (file)
index 0000000..3160220
--- /dev/null
@@ -0,0 +1,484 @@
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "map_event_data_test.h"
+#include "map_event_data.h"
+#include "maps_error.h"
+#include <glib.h>
+#include "map_view.h"
+
+
+extern int _map_event_data_create(map_event_data_h *event);
+
+extern int _map_event_data_set_type(map_event_data_h event,
+                            map_event_type_e event_type);
+
+extern int _map_event_data_set_gesture_type(map_event_data_h event,
+                                    const map_gesture_e gesture_type);
+
+extern int _map_event_data_set_action_type(map_event_data_h event,
+                                   const map_action_e action_type);
+
+extern int _map_event_data_set_center(map_event_data_h event,
+                              const maps_coordinates_h center);
+
+extern int _map_event_data_set_delta(map_event_data_h event,
+                             const int delta_x, const int delta_y);
+
+extern int _map_event_data_set_xy(map_event_data_h event,
+                          const int x, const int y);
+
+extern int _map_event_data_set_fingers(map_event_data_h event,
+                               const int fingers);
+
+extern int _map_event_data_set_zoom_factor(map_event_data_h event,
+                                   const double zoom_factor);
+
+extern int _map_event_data_set_rotation_angle(map_event_data_h event,
+                                      const double rotation_angle);
+
+extern int _map_event_data_set_object(map_event_data_h event,
+                              map_object_h object);
+
+extern int _map_object_create(const map_object_type_e type,
+                             map_object_h *object);
+
+
+/*int map_event_data_destroy(map_event_data_h event);*/
+void utc_map_event_data_create_p(void)
+{
+       /* Create a test event data */
+       map_event_data_h data = NULL;
+       int error = _map_event_data_create(&data);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert(data);
+
+       /* Destroy a test view object */
+       error = map_event_data_destroy(data);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_map_event_data_create_n(void)
+{
+       /* Incorrectly create a test event data */
+       int error = _map_event_data_create(NULL);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+
+/*----------------------------------------------------------------------------*/
+class test_env
+{
+ public:
+       map_event_data_h e;
+ public:
+       test_env() : e(NULL)
+       {
+               /* Create a test event data */
+               const int error = _map_event_data_create(&e);
+               g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+               g_assert(e);
+       }
+       ~test_env()
+       {
+               /* Destroy a test event data */
+               const int error = map_event_data_destroy(e);
+               g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       }
+};
+
+/*----------------------------------------------------------------------------*/
+
+
+/*int map_event_data_clone(const map_event_data_h origin,
+                             map_event_data_h *cloned);*/
+void utc_map_event_data_clone_p(void)
+{
+       test_env e;
+
+       int error = _map_event_data_set_type(e.e, MAP_EVENT_READY);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       map_event_data_h cloned = NULL;
+       error = map_event_data_clone(e.e, &cloned);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert(cloned);
+
+       map_event_type_e type = MAP_EVENT_GESTURE;
+       error = map_event_data_get_type(cloned, &type);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert_cmpint(type, ==, MAP_EVENT_READY);
+
+       error = map_event_data_destroy(cloned);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_map_event_data_clone_n(void)
+{
+       test_env e;
+
+       map_event_data_h cloned = NULL;
+       int error = map_event_data_clone(NULL, &cloned);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+       g_assert(!cloned);
+
+       error = map_event_data_clone(e.e, NULL);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+
+/*int map_event_data_get_type(const map_event_data_h event,
+                                map_event_type_e *event_type);*/
+void utc_map_event_data_get_type_p(void)
+{
+       test_env e;
+
+       int error = _map_event_data_set_type(e.e, MAP_EVENT_READY);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       map_event_type_e type = MAP_EVENT_GESTURE;
+       error = map_event_data_get_type(e.e, &type);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert_cmpint(type, ==, MAP_EVENT_READY);
+}
+
+void utc_map_event_data_get_type_n(void)
+{
+       test_env e;
+
+       map_event_type_e type = MAP_EVENT_GESTURE;
+       int error = map_event_data_get_type(NULL, &type);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = map_event_data_get_type(e.e, NULL);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+
+/*int map_event_data_get_gesture_type(map_event_data_h event,
+                                        map_gesture_e *gesture_type);*/
+void utc_map_event_data_get_gesture_type_p(void)
+{
+       test_env e;
+
+       int error = _map_event_data_set_gesture_type(e.e, MAP_GESTURE_FLICK);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       map_gesture_e type = MAP_GESTURE_NONE;
+       error = map_event_data_get_gesture_type(e.e, &type);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert_cmpint(type, ==, MAP_GESTURE_FLICK);
+}
+
+void utc_map_event_data_get_gesture_type_n(void)
+{
+       test_env e;
+
+       map_gesture_e type = MAP_GESTURE_NONE;
+       int error = map_event_data_get_gesture_type(NULL, &type);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = map_event_data_get_gesture_type(e.e, NULL);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+
+/* int map_event_data_get_action_type(map_event_data_h event,
+                                       map_action_e *action_type);*/
+void utc_map_event_data_get_action_type_p(void)
+{
+       test_env e;
+
+       int error = _map_event_data_set_type(e.e, MAP_EVENT_ACTION);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = _map_event_data_set_action_type(e.e, MAP_ACTION_ZOOM);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       map_action_e type = MAP_ACTION_NONE;
+       error = map_event_data_get_action_type(e.e, &type);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert_cmpint(type, ==, MAP_ACTION_ZOOM);
+}
+
+void utc_map_event_data_get_action_type_n(void)
+{
+       test_env e;
+
+       map_action_e type = MAP_ACTION_NONE;
+       int error = map_event_data_get_action_type(NULL, &type);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = map_event_data_get_action_type(e.e, NULL);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+
+/*int map_event_data_get_center(map_event_data_h event,
+                                  maps_coordinates_h *center);*/
+void utc_map_event_data_get_center_p(void)
+{
+       test_env e;
+
+       int error = _map_event_data_set_type(e.e, MAP_EVENT_ACTION);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       maps_coordinates_h coords = NULL;
+       error = maps_coordinates_create(25.6, 47.8, &coords);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = _map_event_data_set_center(e.e, coords);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = maps_coordinates_destroy(coords);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       maps_coordinates_h c = NULL;
+       error = map_event_data_get_center(e.e, &c);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert(c);
+
+       error = maps_coordinates_destroy(c);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_map_event_data_get_center_n(void)
+{
+       test_env e;
+
+       maps_coordinates_h c = NULL;
+       int error = map_event_data_get_center(NULL, &c);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+       g_assert(!c);
+
+       error = map_event_data_get_center(e.e, NULL);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+
+/*int map_event_data_get_delta(map_event_data_h event,
+                                 int *delta_x, int *delta_y);*/
+void utc_map_event_data_get_delta_p(void)
+{
+       test_env e;
+
+       int error = _map_event_data_set_type(e.e, MAP_EVENT_ACTION);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = _map_event_data_set_delta(e.e, 11, 22);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       int delta_x = 0;
+       int delta_y = 0;
+       error = map_event_data_get_delta(e.e, &delta_x, &delta_y);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert_cmpint(delta_x , ==, 11);
+       g_assert_cmpint(delta_y , ==, 22);
+}
+
+void utc_map_event_data_get_delta_n(void)
+{
+       test_env e;
+
+       int delta_x = 0;
+       int delta_y = 0;
+       int error = map_event_data_get_delta(NULL, &delta_x, &delta_y);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = map_event_data_get_delta(e.e, NULL, &delta_y);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = map_event_data_get_delta(e.e, &delta_x, NULL);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+
+/*int map_event_data_get_xy(map_event_data_h event, int *x, int* y);*/
+void utc_map_event_data_get_xy_p(void)
+{
+       test_env e;
+
+       int error = _map_event_data_set_type(e.e, MAP_EVENT_GESTURE);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = _map_event_data_set_xy(e.e, 11, 22);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       int x = 0;
+       int y = 0;
+       error = map_event_data_get_xy(e.e, &x, &y);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert_cmpint(x , ==, 11);
+       g_assert_cmpint(y , ==, 22);
+}
+
+void utc_map_event_data_get_xy_n(void)
+{
+       test_env e;
+
+       int x = 0;
+       int y = 0;
+       int error = map_event_data_get_xy(NULL, &x, &y);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = map_event_data_get_xy(e.e, NULL, &y);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = map_event_data_get_xy(e.e, &x, NULL);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+
+/*int map_event_data_get_fingers(map_event_data_h event, int *fingers);*/
+void utc_map_event_data_get_fingers_p(void)
+{
+       test_env e;
+
+       int error = _map_event_data_set_type(e.e, MAP_EVENT_GESTURE);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = _map_event_data_set_fingers(e.e, 3);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       int fingers = 0;
+       error = map_event_data_get_fingers(e.e, &fingers);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert_cmpint(fingers , ==, 3);
+}
+
+void utc_map_event_data_get_fingers_n(void)
+{
+       test_env e;
+
+       int fingers = 0;
+       int error = map_event_data_get_fingers(NULL, &fingers);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = map_event_data_get_fingers(e.e, NULL);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+
+/*int map_event_data_get_zoom_factor(map_event_data_h event,
+                                       double *zoom_factor);*/
+void utc_map_event_data_get_zoom_factor_p(void)
+{
+       test_env e;
+
+       int error = _map_event_data_set_type(e.e, MAP_EVENT_GESTURE);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = _map_event_data_set_zoom_factor(e.e, 3.1);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       double zoom_factor = 0;
+       error = map_event_data_get_zoom_factor(e.e, &zoom_factor);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert_cmpfloat(zoom_factor, >=, 3);
+}
+
+void utc_map_event_data_get_zoom_factor_n(void)
+{
+       test_env e;
+
+       double zoom_factor = 0;
+       int error = map_event_data_get_zoom_factor(NULL, &zoom_factor);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = map_event_data_get_zoom_factor(e.e, NULL);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+
+/*int map_event_data_get_rotation_angle(map_event_data_h event,
+                                          double *rotation_angle);*/
+void utc_map_event_data_get_rotation_angle_p(void)
+{
+       test_env e;
+
+       int error = _map_event_data_set_type(e.e, MAP_EVENT_GESTURE);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = _map_event_data_set_rotation_angle(e.e, 3.1);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       double rotation_angle = 0;
+       error = map_event_data_get_rotation_angle(e.e, &rotation_angle);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert_cmpfloat(rotation_angle, >=, 3);
+}
+
+void utc_map_event_data_get_rotation_angle_n(void)
+{
+       test_env e;
+
+       double rotation_angle = 0;
+       int error = map_event_data_get_rotation_angle(NULL, &rotation_angle);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = map_event_data_get_rotation_angle(e.e, NULL);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/*int map_event_data_get_object(map_event_data_h event,
+                                  map_object_h *object);*/
+void utc_map_event_data_get_object_p(void)
+{
+       test_env e;
+
+       int error = _map_event_data_set_type(e.e, MAP_EVENT_OBJECT);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       map_object_h object = NULL;
+       error = _map_object_create(MAP_OBJECT_MARKER, &object);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = _map_event_data_set_object(e.e, object);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       map_object_h o = NULL;
+       error = map_event_data_get_object(e.e, &o);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert(o);
+       g_assert(o == object);
+
+       error = map_object_destroy(object);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_map_event_data_get_object_n(void)
+{
+       test_env e;
+
+       map_object_h object = NULL;
+       int error = _map_object_create(MAP_OBJECT_MARKER,
+                                          &object);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = _map_event_data_set_object(e.e, object);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       map_object_h o = NULL;
+       error = map_event_data_get_object(NULL, &o);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+       g_assert(!o);
+
+       error = map_event_data_get_object(e.e, NULL);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = map_object_destroy(object);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
diff --git a/test/src/api/map_event_data_test.h b/test/src/api/map_event_data_test.h
new file mode 100644 (file)
index 0000000..3a5264f
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MAP_EVENT_DATA_API_TEST_H__
+#define __MAP_EVENT_DATA_API_TEST_H__
+
+
+/*int map_event_data_destroy(map_event_data_h event);*/
+void utc_map_event_data_create_p(void);
+void utc_map_event_data_create_n(void);
+
+/*int map_event_data_clone(const map_event_data_h origin,
+                             map_event_data_h *cloned);*/
+void utc_map_event_data_clone_p(void);
+void utc_map_event_data_clone_n(void);
+
+/*int map_event_data_get_type(const map_event_data_h event,
+                                map_event_type_e *event_type);*/
+void utc_map_event_data_get_type_p(void);
+void utc_map_event_data_get_type_n(void);
+
+
+/*int map_event_data_get_gesture_type(map_event_data_h event,
+                                        map_gesture_e *gesture_type);*/
+void utc_map_event_data_get_gesture_type_p(void);
+void utc_map_event_data_get_gesture_type_n(void);
+
+/* int map_event_data_get_action_type(map_event_data_h event,
+                                       map_action_e *action_type);*/
+void utc_map_event_data_get_action_type_p(void);
+void utc_map_event_data_get_action_type_n(void);
+
+/*int map_event_data_get_center(map_event_data_h event,
+                                  maps_coordinates_h *center);*/
+void utc_map_event_data_get_center_p(void);
+void utc_map_event_data_get_center_n(void);
+
+/*int map_event_data_get_delta(map_event_data_h event,
+                                 int *delta_x, int *delta_y);*/
+void utc_map_event_data_get_delta_p(void);
+void utc_map_event_data_get_delta_n(void);
+
+/*int map_event_data_get_xy(map_event_data_h event, int *x, int* y);*/
+void utc_map_event_data_get_xy_p(void);
+void utc_map_event_data_get_xy_n(void);
+
+/*int map_event_data_get_fingers(map_event_data_h event, int *fingers);*/
+void utc_map_event_data_get_fingers_p(void);
+void utc_map_event_data_get_fingers_n(void);
+
+/*int map_event_data_get_zoom_factor(map_event_data_h event,
+                                       double *zoom_factor);*/
+void utc_map_event_data_get_zoom_factor_p(void);
+void utc_map_event_data_get_zoom_factor_n(void);
+
+/*int map_event_data_get_rotation_angle(map_event_data_h event,
+                                          double *rotation_angle);*/
+void utc_map_event_data_get_rotation_angle_p(void);
+void utc_map_event_data_get_rotation_angle_n(void);
+
+/*int map_event_data_get_object(map_event_data_h event,
+                                  map_object_h *object);*/
+void utc_map_event_data_get_object_p(void);
+void utc_map_event_data_get_object_n(void);
+
+#endif /* __MAP_EVENT_DATA_API_TEST_H__*/
+
diff --git a/test/src/api/map_object_test.cpp b/test/src/api/map_object_test.cpp
new file mode 100644 (file)
index 0000000..84a7d75
--- /dev/null
@@ -0,0 +1,1144 @@
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "map_object_test.h"
+#include "map_object.h"
+#include "maps_error.h"
+#include <glib.h>
+#include "map_view.h"
+
+
+extern int _map_object_create(const map_object_type_e type,
+                             map_object_h *object);
+
+/*int map_object_create(const map_object_type_e type,
+                           map_object_h *object);
+int map_object_destroy(map_object_h object);*/
+void utc_map_object_create_p(void)
+{
+       /* Create a test view object */
+       map_object_h object = NULL;
+       int error = _map_object_create(MAP_OBJECT_MARKER,
+                                          &object);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert(object);
+
+       /* Destroy a test view object */
+       error = map_object_destroy(object);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_map_object_create_n(void)
+{
+       /* Incorrectly create a test view object */
+       map_object_h object = NULL;
+       int error = _map_object_create((map_object_type_e)-2,
+                                          &object);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+       g_assert(!object);
+
+       error = _map_object_create(MAP_OBJECT_MARKER, NULL);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+       g_assert(!object);
+}
+
+
+
+/*----------------------------------------------------------------------------*/
+class test_env
+{
+ public:
+       map_object_h o;
+       int iterations;
+ public:
+       test_env(const map_object_type_e type) : o(NULL), iterations(0)
+       {
+               /* Create a test view object */
+               int error = _map_object_create(type, &o);
+               g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+               g_assert(o);
+       }
+       ~test_env()
+       {
+               /* Destroy a test view object */
+               const int error = map_object_destroy(o);
+               g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       }
+};
+
+/*----------------------------------------------------------------------------*/
+
+/*int map_object_get_type(const map_object_h object,
+                             map_object_type_e *type);*/
+void utc_map_object_get_type_p(void)
+{
+       test_env e(MAP_OBJECT_MARKER);
+
+       map_object_type_e type = MAP_OBJECT_UNKNOWN;
+       const int error = map_object_get_type(e.o, &type);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert_cmpint(type, ==, MAP_OBJECT_MARKER);
+}
+
+void utc_map_object_get_type_n(void)
+{
+       test_env e(MAP_OBJECT_MARKER);
+
+       map_object_type_e type = MAP_OBJECT_UNKNOWN;
+       int error = map_object_get_type(NULL, &type);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+       g_assert_cmpint(type, ==, MAP_OBJECT_UNKNOWN);
+
+       error = map_object_get_type(e.o, NULL);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+       g_assert_cmpint(type, ==, MAP_OBJECT_UNKNOWN);
+}
+
+
+/*int map_object_move(map_object_h object,
+                         const double latitude,
+                         const double longitude);*/
+void utc_map_object_move_p(void)
+{
+       test_env e(MAP_OBJECT_MARKER);
+
+       /* Prepare coordinates to move to */
+       maps_coordinates_h coords = NULL;
+       int error = maps_coordinates_create(25.6, 47.8, &coords);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       /* Move the object to the given coordinates */
+       error = map_object_move(e.o, coords);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       /* Destroy coordinates, we don't need it anymore */
+       error = maps_coordinates_destroy(coords);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+
+#if 0
+       /* Get the marker data */
+       map_view_marker_data_h marker_data = NULL;
+       error = map_object_get_shape_data(e.o, &marker_data);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       /* Get the coordinates of the marker */
+       coords = NULL;
+       error = map_view_marker_data_get_coordinates(marker_data, &coords);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert(coords);
+
+       /* Check if the marker position is correct */
+       double latitude = .0;
+       double longitude = .0;
+       maps_coordinates_get_latitude(coords, &latitude);
+       maps_coordinates_get_longitude(coords, &longitude);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert_cmpfloat(latitude, ==, 25.6);
+       g_assert_cmpfloat(longitude, ==, 47.8);
+
+       /* Destroy coordinates, we don't need it anymore */
+       maps_coordinates_destroy(coords);
+#endif
+}
+
+void utc_map_object_move_n(void)
+{
+       test_env e(MAP_OBJECT_MARKER);
+
+       /* Prepare coordinates to move to */
+       maps_coordinates_h coords = NULL;
+       int error = maps_coordinates_create(25.6, 47.8, &coords);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = map_object_move(NULL, coords);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = map_object_move(e.o, NULL);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       /* Destroy coordinates, we don't need it anymore */
+       maps_coordinates_destroy(coords);
+}
+
+/*int map_object_set_visible(map_object_h object,
+                                  const bool visible);*/
+void utc_map_object_set_visible_p(void)
+{
+       test_env e(MAP_OBJECT_MARKER);
+
+       int error = map_object_set_visible(e.o, true);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       bool visible = false;
+       error = map_object_get_visible(e.o, &visible);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert(visible);
+
+       error = map_object_set_visible(e.o, false);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = map_object_get_visible(e.o, &visible);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert(!visible);
+}
+
+void utc_map_object_set_visible_n(void)
+{
+       test_env e(MAP_OBJECT_MARKER);
+
+       int error = map_object_set_visible(NULL, true);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/*int map_object_get_visible(map_object_h object, bool *visible);*/
+void utc_map_object_get_visible_p(void)
+{
+       test_env e(MAP_OBJECT_MARKER);
+
+       bool visible = true;
+       int error = map_object_get_visible(e.o, &visible);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert(!visible);
+}
+
+void utc_map_object_get_visible_n(void)
+{
+       bool visible = true;
+       int error = map_object_get_visible(NULL, &visible);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+       g_assert(visible);
+}
+
+
+/*int map_object_hit_test(map_object_h text,
+                             const maps_coordinates_h coordinates,
+                             bool *is_hit);*/
+void utc_map_object_hit_test_p(void)
+{
+#if 0
+       test_env e(MAP_OBJECT_MARKER);
+
+       maps_coordinates_h coords = NULL;
+       int error = maps_coordinates_create(37.4 + 1.1, 127.2 + 1.1, &coords);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       bool is_hit = false;
+       error = map_object_hit_test(e.o, coords, &is_hit);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = maps_coordinates_destroy(coords);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       /* TODO: check after implementation of hit_test API */
+       /*g_assert(is_hit);
+
+       is_hit = true;
+       error = map_object_hit_test(e.o,
+                                             37.4 - 1.1, 127.2 - 1.1,
+                                             &is_hit);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert(!is_hit);*/
+#endif
+}
+
+void utc_map_object_hit_test_n(void)
+{
+#if 0
+       test_env e(MAP_OBJECT_MARKER);
+
+       maps_coordinates_h coords = NULL;
+       int error = maps_coordinates_create(37.4 + 1.1, 127.2 + 1.1, &coords);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       bool is_hit = true;
+       error = map_object_hit_test(NULL, coords, &is_hit);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+       g_assert(is_hit);
+
+       error = map_object_hit_test(e.o, NULL, &is_hit);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+       g_assert(is_hit);
+
+       error = map_object_hit_test(e.o, coords, NULL);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+       g_assert(is_hit);
+
+       error = maps_coordinates_destroy(coords);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       /* TODO: check after implementation of hit_test API */
+       /*
+       is_hit = true;
+       error = map_object_hit_test(e.o,
+                                             37.4 + 100.1, 127.2 + 1.1,
+                                             &is_hit);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+       g_assert(is_hit);
+
+       is_hit = true;
+       error = map_object_hit_test(e.o,
+                                             37.4 - 200.1, 127.2 + 1.1,
+                                             &is_hit);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+       g_assert(is_hit);
+
+       is_hit = true;
+       error = map_object_hit_test(e.o,
+                                             37.4 + 1.1, 127.2 + 100.1,
+                                             &is_hit);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+       g_assert(is_hit);
+
+       is_hit = true;
+       error = map_object_hit_test(e.o,
+                                             37.4 + 1.1, 127.2 - 400.1,
+                                             &is_hit);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+       g_assert(is_hit);*/
+#endif
+}
+
+/*int map_object_group_add_object(map_object_h group,
+                              const map_object_h object);*/
+void utc_map_object_group_add_object_p(void)
+{
+       test_env e(MAP_OBJECT_GROUP);
+
+       map_object_h marker = NULL;
+       int error = _map_object_create(MAP_OBJECT_MARKER,
+                                          &marker);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert(marker);
+
+       error = map_object_group_add_object(e.o, marker);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_map_object_group_add_object_n(void)
+{
+       test_env e(MAP_OBJECT_GROUP);
+
+       map_object_h marker = NULL;
+       int error = _map_object_create(MAP_OBJECT_MARKER,
+                                          &marker);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert(marker);
+
+       error = map_object_group_add_object(NULL, marker);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = map_object_group_add_object(e.o, NULL);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = map_object_destroy(marker);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+/*int map_object_group_set_objects(map_object_h group,
+                                    const maps_item_list_h objects);*/
+void utc_map_object_group_set_objects_p(void)
+{
+       /* TO BE REMOVED */
+#if 0
+       test_env e(MAP_OBJECT_GROUP);
+
+       map_object_h m1 = NULL;
+       int error = _map_object_create(MAP_OBJECT_MARKER, &m1);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert(m1);
+
+       map_object_h m2 = NULL;
+       error = _map_object_create(MAP_OBJECT_MARKER, &m2);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert(m2);
+
+       maps_item_list_h list = NULL;
+       error = maps_item_list_create(&list);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert(list);
+
+       error = maps_item_list_append(list, m1, maps_item_no_clone);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       error = maps_item_list_append(list, m2, maps_item_no_clone);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = map_object_group_set_objects(e.o, list);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = maps_item_list_destroy(list);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+#endif
+}
+
+void utc_map_object_group_set_objects_n(void)
+{
+       /* TO BE REMOVED */
+#if 0
+       test_env e(MAP_OBJECT_GROUP);
+
+       maps_item_list_h list = NULL;
+       int error = maps_item_list_create(&list);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert(list);
+
+       error = map_object_group_set_objects(NULL, list);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = map_object_group_set_objects(e.o, NULL);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = maps_item_list_destroy(list);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+#endif
+}
+
+
+/*int map_object_group_remove_object(map_object_h group,
+                                 const map_object_h *object);*/
+void utc_map_object_group_remove_object_p(void)
+{
+       test_env e(MAP_OBJECT_GROUP);
+       /* TODO: */
+}
+
+void utc_map_object_group_remove_object_n(void)
+{
+       test_env e(MAP_OBJECT_GROUP);
+       /* TODO: */
+}
+
+
+/*int map_object_group_foreach_object(const map_object_h group,
+                                  map_object_group_object_cb callback,
+typedef bool(*map_object_group_object_cb) (int index, int total,
+                                             map_object_h object,
+                                             void *user_data);*/
+static bool __utc_map_object_group_object_cb(int index, int total,
+                                                map_object_h object,
+                                                void *user_data)
+{
+       g_assert_cmpint(index, >=, 0);
+       g_assert_cmpint(total, >, 0);
+       g_assert(object);
+       g_assert(user_data);
+
+       map_object_type_e type = MAP_OBJECT_UNKNOWN;
+       map_object_get_type(object, &type);
+       g_assert_cmpint(type, ==, MAP_OBJECT_MARKER);
+
+       test_env *e = (test_env *)user_data;
+       e->iterations ++;
+
+       return true;
+}
+
+void utc_map_object_group_foreach_object_p(void)
+{
+       test_env e(MAP_OBJECT_GROUP);
+
+       map_object_h m1 = NULL;
+       int error = _map_object_create(MAP_OBJECT_MARKER, &m1);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert(m1);
+       error = map_object_group_add_object(e.o, m1);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       map_object_h m2 = NULL;
+       error = _map_object_create(MAP_OBJECT_MARKER, &m2);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert(m2);
+       error = map_object_group_add_object(e.o, m2);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+
+       error = map_object_group_foreach_object(e.o,
+                                  __utc_map_object_group_object_cb,
+                                  &e);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert_cmpint(e.iterations, ==, 2);
+
+}
+
+void utc_map_object_group_foreach_object_n(void)
+{
+       test_env e(MAP_OBJECT_GROUP);
+
+       int error = map_object_group_foreach_object(NULL,
+                                  __utc_map_object_group_object_cb,
+                                  &e);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+       g_assert_cmpint(e.iterations, ==, 0);
+
+       error = map_object_group_foreach_object(e.o,
+                                  NULL,
+                                  &e);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+       g_assert_cmpint(e.iterations, ==, 0);
+}
+
+
+/*int map_object_polyline_add_point(map_object_h poly,
+                                       const maps_coordinates_h point);*/
+void utc_map_object_poly_add_point_p(void)
+{
+       test_env e(MAP_OBJECT_POLYLINE);
+
+       maps_coordinates_h c = NULL;
+       int error = maps_coordinates_create(38.4, 128.0, &c);
+       g_assert(c);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = map_object_polyline_add_point(e.o, c);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = maps_coordinates_destroy(c);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_map_object_poly_add_point_n(void)
+{
+       test_env e(MAP_OBJECT_POLYLINE);
+
+       maps_coordinates_h c = NULL;
+       int error = maps_coordinates_create(38.4, 128.0, &c);
+       g_assert(c);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = map_object_polyline_add_point(NULL, c);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = map_object_polyline_add_point(e.o, NULL);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = maps_coordinates_destroy(c);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+
+/*int map_object_polyline_set_polyline(map_object_h poly,
+                                 const maps_coordinates_list_h points);*/
+void utc_map_object_poly_set_points_p(void)
+{
+       test_env e(MAP_OBJECT_POLYLINE);
+
+       maps_coordinates_h c1 = NULL;
+       int error = maps_coordinates_create(38.4, 128.0, &c1);
+       g_assert(c1);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       maps_coordinates_h c2 = NULL;
+       error = maps_coordinates_create(39.4, 129.0, &c2);
+       g_assert(c1);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       maps_coordinates_list_h list = NULL;
+       error = maps_coordinates_list_create(&list);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert(list);
+
+       error = maps_coordinates_list_append(list, c1);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = maps_coordinates_list_append(list, c2);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+
+       /* Test */
+       error = map_object_polyline_set_polyline(e.o, list);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+
+       error = maps_coordinates_list_destroy(list);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = maps_coordinates_destroy(c1);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = maps_coordinates_destroy(c2);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_map_object_poly_set_points_n(void)
+{
+       test_env e(MAP_OBJECT_POLYLINE);
+
+       maps_coordinates_list_h list = NULL;
+       int error = maps_coordinates_list_create(&list);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert(list);
+
+       /* Test */
+       error = map_object_polyline_set_polyline(NULL, list);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = map_object_polyline_set_polyline(e.o, NULL);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = maps_coordinates_list_destroy(list);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+
+/*int map_object_polyline_foreach_point(map_object_h poly,
+                                      map_object_poly_point_cb callback,
+typedef bool(*map_object_poly_point_cb) (int index, int total,
+                                             maps_coordinates_h point,
+                                             void *user_data);*/
+static bool __utc_map_object_poly_point_cb(int index, int total,
+                                              maps_coordinates_h point,
+                                              void *user_data)
+{
+       g_assert_cmpint(index, >=, 0);
+       g_assert_cmpint(total, >, 0);
+       g_assert(point);
+       g_assert(user_data);
+
+       test_env *e = (test_env *)user_data;
+       e->iterations ++;
+
+       int error = maps_coordinates_destroy(point);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       return true;
+}
+
+void utc_map_object_poly_foreach_point_p(void)
+{
+       test_env e(MAP_OBJECT_POLYLINE);
+
+       maps_coordinates_h c1 = NULL;
+       int error = maps_coordinates_create(38.4, 128.0, &c1);
+       g_assert(c1);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       maps_coordinates_h c2 = NULL;
+       error = maps_coordinates_create(39.4, 129.0, &c2);
+       g_assert(c1);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       maps_coordinates_list_h list = NULL;
+       error = maps_coordinates_list_create(&list);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert(list);
+
+       error = maps_coordinates_list_append(list, c1);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = maps_coordinates_list_append(list, c2);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = map_object_polyline_set_polyline(e.o, list);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       /* Test */
+       error = map_object_polyline_foreach_point(e.o,
+                                      __utc_map_object_poly_point_cb,
+                                      &e);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert_cmpint(e.iterations, ==, 2);
+
+       error = maps_coordinates_list_destroy(list);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = maps_coordinates_destroy(c1);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = maps_coordinates_destroy(c2);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_map_object_poly_foreach_point_n(void)
+{
+       test_env e(MAP_OBJECT_POLYLINE);
+
+       int error = map_object_polyline_foreach_point(NULL,
+                                      __utc_map_object_poly_point_cb,
+                                      &e);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+       g_assert_cmpint(e.iterations, ==, 0);
+
+       error = map_object_polyline_foreach_point(e.o, NULL, &e);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+       g_assert_cmpint(e.iterations, ==, 0);
+}
+
+
+/*int map_object_polyline_set_color(map_object_h polyline,
+                                      const unsigned char r,
+                                      const unsigned char g,
+                                      const unsigned char b,
+                                      const unsigned char a);*/
+void utc_map_object_polyline_set_color_p(void)
+{
+       test_env e(MAP_OBJECT_POLYLINE);
+       int error = map_object_polyline_set_color(e.o,
+                                                      0x11, 0x22, 0x33, 0x44);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_map_object_polyline_set_color_n(void)
+{
+       test_env e(MAP_OBJECT_POLYLINE);
+       int error = map_object_polyline_set_color(NULL,
+                                                      0x11, 0x22, 0x33, 0x44);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+
+/*int map_object_polyline_get_color(const map_object_h
+                                      polyline,
+                                      unsigned char *r,
+                                      unsigned char *g,
+                                      unsigned char *b,
+                                      unsigned char *a);*/
+void utc_map_object_polyline_get_color_p(void)
+{
+       test_env e(MAP_OBJECT_POLYLINE);
+
+       int error = map_object_polyline_set_color(e.o,
+                                                      0x11, 0x22, 0x33, 0x44);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       unsigned char r, g, b, a;
+       error = map_object_polyline_get_color(e.o, &r, &g, &b, &a);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert_cmpint(r, ==, 0x11);
+       g_assert_cmpint(g, ==, 0x22);
+       g_assert_cmpint(b, ==, 0x33);
+       g_assert_cmpint(a, ==, 0x44);
+}
+
+void utc_map_object_polyline_get_color_n(void)
+{
+       test_env e(MAP_OBJECT_POLYLINE);
+       unsigned char r, g, b, a;
+       int error = map_object_polyline_get_color(NULL, &r, &g, &b, &a);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+
+/*int map_object_polyline_set_width(map_object_h polyline,
+                                      const int width);*/
+void utc_map_object_polyline_set_width_p(void)
+{
+       test_env e(MAP_OBJECT_POLYLINE);
+       int error = map_object_polyline_set_width(e.o, 3);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_map_object_polyline_set_width_n(void)
+{
+       test_env e(MAP_OBJECT_POLYLINE);
+
+       int error = map_object_polyline_set_width(NULL, 3);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = map_object_polyline_set_width(e.o, -3);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+
+/*int map_object_polyline_get_width(const map_object_h polyline,
+                                      int *width);*/
+void utc_map_object_polyline_get_width_p(void)
+{
+       test_env e(MAP_OBJECT_POLYLINE);
+
+       int error = map_object_polyline_set_width(e.o, 3);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       int width = 0;
+       error = map_object_polyline_get_width(e.o, &width);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert_cmpint(width , ==, 3);
+}
+
+void utc_map_object_polyline_get_width_n(void)
+{
+       test_env e(MAP_OBJECT_POLYLINE);
+
+       int width = 0;
+       int error = map_object_polyline_get_width(NULL, &width);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = map_object_polyline_get_width(e.o, NULL);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+
+/*int map_object_polygon_set_fill_color(map_object_h polygon,
+                                          const unsigned char r,
+                                          const unsigned char g,
+                                          const unsigned char b,
+                                          const unsigned char a);*/
+void utc_map_object_polygon_set_fill_color_p(void)
+{
+       test_env e(MAP_OBJECT_POLYGON);
+       int error = map_object_polygon_set_fill_color(e.o,
+                                                          0x11,
+                                                          0x22,
+                                                          0x33,
+                                                          0x44);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_map_object_polygon_set_fill_color_n(void)
+{
+       test_env e(MAP_OBJECT_POLYGON);
+       int error = map_object_polygon_set_fill_color(NULL,
+                                                          0x11,
+                                                          0x22,
+                                                          0x33,
+                                                          0x44);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+
+/*int map_object_polygon_get_fill_color(const map_object_h polygon,
+                                          unsigned char *r,
+                                          unsigned char *g,
+                                          unsigned char *b,
+                                          unsigned char *a);*/
+void utc_map_object_polygon_get_fill_color_p(void)
+{
+       test_env e(MAP_OBJECT_POLYGON);
+       int error = map_object_polygon_set_fill_color(e.o,
+                                                          0x11,
+                                                          0x22,
+                                                          0x33,
+                                                          0x44);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       unsigned char r, g, b, a;
+       error = map_object_polygon_get_fill_color(e.o,
+                                                      &r, &g, &b, &a);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert_cmpint(r, ==, 0x11);
+       g_assert_cmpint(g, ==, 0x22);
+       g_assert_cmpint(b, ==, 0x33);
+       g_assert_cmpint(a, ==, 0x44);
+}
+
+void utc_map_object_polygon_get_fill_color_n(void)
+{
+       test_env e(MAP_OBJECT_POLYGON);
+       unsigned char r, g, b, a;
+       int error = map_object_polygon_get_fill_color(NULL,
+                                                      &r, &g, &b, &a);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+
+/*int map_object_marker_set_coordinates(map_object_h marker,
+                                  const maps_coordinates_h coordinates);*/
+void utc_map_object_marker_set_coordinates_p(void)
+{
+       test_env e(MAP_OBJECT_MARKER);
+
+       maps_coordinates_h c = NULL;
+       int error = maps_coordinates_create(25.6, 47.8, &c);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = map_object_marker_set_coordinates(e.o, c);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = maps_coordinates_destroy(c);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_map_object_marker_set_coordinates_n(void)
+{
+       test_env e(MAP_OBJECT_MARKER);
+
+       maps_coordinates_h c = NULL;
+       int error = maps_coordinates_create(25.6, 47.8, &c);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = map_object_marker_set_coordinates(NULL, c);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = map_object_marker_set_coordinates(e.o, NULL);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = maps_coordinates_destroy(c);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+
+/*int map_object_marker_resize(map_object_h marker,
+                                         const int screen_width,
+                                         const int screen_height);*/
+void utc_map_object_marker_set_screen_size_p(void)
+{
+       test_env e(MAP_OBJECT_MARKER);
+
+       int error = map_object_marker_resize(e.o, 13, 42);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_map_object_marker_set_screen_size_n(void)
+{
+       test_env e(MAP_OBJECT_MARKER);
+
+       int error = map_object_marker_resize(NULL, 13, 42);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = map_object_marker_resize(e.o, -13, 42);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = map_object_marker_resize(e.o, 13, -42);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+
+/*int map_object_marker_set_imate_file(map_object_h marker,
+                                       const char *file_path);*/
+void utc_map_object_marker_set_file_path_p(void)
+{
+       /* TO BE REMOVED */
+#if 0
+       test_env e(MAP_OBJECT_MARKER);
+
+       int error = map_object_marker_set_image_file(e.o, "marker.png");
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+#endif
+}
+
+void utc_map_object_marker_set_file_path_n(void)
+{
+       /* TO BE REMOVED */
+#if 0
+       test_env e(MAP_OBJECT_MARKER);
+
+       int error = map_object_marker_set_image_file(NULL, "marker.png");
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = map_object_marker_set_image_file(e.o, NULL);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+#endif
+}
+
+
+/*int map_object_marker_set_type(map_object_h marker,
+                                  const map_marker_type_e type);*/
+void utc_map_object_marker_set_type_p(void)
+{
+       /* TO BE REMOVED */
+#if 0
+       test_env e(MAP_OBJECT_MARKER);
+
+       int error = map_object_marker_set_type(e.o, MAP_MARKER_POI);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+#endif
+}
+
+void utc_map_object_marker_set_type_n(void)
+{
+       /* TO BE REMOVED */
+#if 0
+       test_env e(MAP_OBJECT_MARKER);
+
+       int error = map_object_marker_set_type(NULL, MAP_MARKER_POI);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = map_object_marker_set_type(e.o,
+                       map_marker_type_e(MAP_MARKER_POI - 100));
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+#endif
+}
+
+
+/*int map_object_marker_set_text(map_object_h marker,
+                                  const char *text);*/
+void utc_map_object_marker_set_text_p(void)
+{
+       test_env e(MAP_OBJECT_MARKER);
+
+       int error = map_object_marker_set_text(e.o, "Demo Marker");
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_map_object_marker_set_text_n(void)
+{
+       test_env e(MAP_OBJECT_MARKER);
+
+       int error = map_object_marker_set_text(NULL, "Demo Marker");
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = map_object_marker_set_text(e.o, NULL);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+
+/*int map_object_marker_get_coordinates(const map_object_h marker,
+                                         maps_coordinates_h *coordinates);*/
+void utc_map_object_marker_get_coordinates_p(void)
+{
+       test_env e(MAP_OBJECT_MARKER);
+
+       maps_coordinates_h c = NULL;
+       int error = maps_coordinates_create(25.6, 47.8, &c);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = map_object_marker_set_coordinates(e.o, c);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = maps_coordinates_destroy(c);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = map_object_marker_get_coordinates(e.o, &c);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       double lat = 0., lon = 0.;
+       error = maps_coordinates_get_latitude_longitude(c, &lat, &lon);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert_cmpfloat(lat, <=, 30.);
+       g_assert_cmpfloat(lon, >=, 30.);
+
+       error = maps_coordinates_destroy(c);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_map_object_marker_get_coordinates_n(void)
+{
+       test_env e(MAP_OBJECT_MARKER);
+
+       maps_coordinates_h c = NULL;
+
+       int error = map_object_marker_get_coordinates(NULL, &c);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = map_object_marker_get_coordinates(e.o, NULL);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+
+/*int map_object_marker_get_size(map_object_h marker,
+                                         int *screen_width,
+                                         int *screen_height);*/
+void utc_map_object_marker_get_screen_size_p(void)
+{
+       test_env e(MAP_OBJECT_MARKER);
+
+       int error = map_object_marker_resize(e.o, 13, 42);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       int width = 0, height = 0;
+       error = map_object_marker_get_size(e.o, &width, &height);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert_cmpint(width, ==, 13);
+       g_assert_cmpint(height, ==, 42);
+}
+
+void utc_map_object_marker_get_screen_size_n(void)
+{
+       test_env e(MAP_OBJECT_MARKER);
+
+       int width = 0, height = 0;
+       int error = map_object_marker_get_size(NULL, &width, &height);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+
+/*int map_object_marker_get_image_file(const map_object_h marker,
+                                       char **file_path);*/
+void utc_map_object_marker_get_image_file_p(void)
+{
+       test_env e(MAP_OBJECT_MARKER);
+
+       int error = map_object_marker_set_image_file(e.o, "marker.png");
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       char *file_path = NULL;
+       error = map_object_marker_get_image_file(e.o, &file_path);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert(file_path);
+       g_assert_cmpint(g_strcmp0(file_path, "marker.png"), ==, 0);
+       g_free(file_path);
+}
+
+void utc_map_object_marker_get_image_file_n(void)
+{
+       test_env e(MAP_OBJECT_MARKER);
+
+       char *file_path = NULL;
+       int error = map_object_marker_get_image_file(NULL, &file_path);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = map_object_marker_get_image_file(e.o, NULL);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+
+/*int map_object_marker_get_type(const map_object_h marker,
+                                  map_marker_type_e *type);*/
+void utc_map_object_marker_get_type_p(void)
+{
+       test_env e(MAP_OBJECT_MARKER);
+
+#if 0
+       int error = map_object_marker_set_type(e.o, MAP_MARKER_POI);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+#endif
+
+       map_marker_type_e type = MAP_MARKER_NONE;
+       int error = map_object_marker_get_type(e.o, &type);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       /*g_assert_cmpint(type, ==, MAP_MARKER_POI);*/
+}
+
+void utc_map_object_marker_get_type_n(void)
+{
+       test_env e(MAP_OBJECT_MARKER);
+
+       map_marker_type_e type = MAP_MARKER_NONE;
+       int error = map_object_marker_get_type(NULL, &type);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = map_object_marker_get_type(e.o, NULL);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+
+/*int map_object_marker_get_text(const map_object_h marker,
+                                  char **text);*/
+void utc_map_object_marker_get_text_p(void)
+{
+       test_env e(MAP_OBJECT_MARKER);
+
+       int error = map_object_marker_set_text(e.o, "Demo Marker");
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       char *text = NULL;
+       error = map_object_marker_get_text(e.o, &text);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert(text);
+       g_assert_cmpint(g_strcmp0(text, "Demo Marker"), ==, 0);
+       g_free(text);
+}
+
+void utc_map_object_marker_get_text_n(void)
+{
+       test_env e(MAP_OBJECT_MARKER);
+
+       char *text = NULL;
+       int error = map_object_marker_get_text(NULL, &text);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = map_object_marker_get_text(e.o, NULL);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
diff --git a/test/src/api/map_object_test.h b/test/src/api/map_object_test.h
new file mode 100644 (file)
index 0000000..130c748
--- /dev/null
@@ -0,0 +1,189 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MAP_OBJECT_API_TEST_H__
+#define __MAP_OBJECT_API_TEST_H__
+
+
+/*int map_object_create(const map_object_type_e type,
+                           map_object_h *object);
+int map_object_destroy(map_object_h object);*/
+void utc_map_object_create_p(void);
+void utc_map_object_create_n(void);
+
+/*int map_object_get_type(const map_object_h object,
+                             map_object_type_e *type);*/
+void utc_map_object_get_type_p(void);
+void utc_map_object_get_type_n(void);
+
+/*int map_object_move(map_object_h object,
+                        const maps_coordinates_h coordinates);*/
+void utc_map_object_move_p(void);
+void utc_map_object_move_n(void);
+
+/*int map_object_set_visible(map_object_h object,
+                                  const bool visible);*/
+void utc_map_object_set_visible_p(void);
+void utc_map_object_set_visible_n(void);
+
+/*int map_object_get_visible(map_object_h object, bool *visible);*/
+void utc_map_object_get_visible_p(void);
+void utc_map_object_get_visible_n(void);
+
+/*int map_object_hit_test(map_object_h text,
+                             const maps_coordinates_h coordinates,
+                             bool *is_hit);*/
+void utc_map_object_hit_test_p(void);
+void utc_map_object_hit_test_n(void);
+
+/*int map_object_group_add_object(map_object_h group,
+                              const map_object_h object);*/
+void utc_map_object_group_add_object_p(void);
+void utc_map_object_group_add_object_n(void);
+
+/*int map_object_group_set_objects(map_object_h group,
+                                    const maps_item_list_h objects);*/
+void utc_map_object_group_set_objects_p(void);
+void utc_map_object_group_set_objects_n(void);
+
+/*int map_object_group_remove_object(map_object_h group,
+                                 const map_object_h *object);*/
+void utc_map_object_group_remove_object_p(void);
+void utc_map_object_group_remove_object_n(void);
+
+/*int map_object_group_foreach_object(const map_object_h group,
+                                  map_object_group_object_cb callback,
+typedef bool(*map_object_group_object_cb) (int index, int total,
+                                             map_object_h object,
+                                             void *user_data);*/
+void utc_map_object_group_foreach_object_p(void);
+void utc_map_object_group_foreach_object_n(void);
+
+/*int map_object_poly_add_point(map_object_h poly,
+                                       const maps_coordinates_h point);*/
+void utc_map_object_poly_add_point_p(void);
+void utc_map_object_poly_add_point_n(void);
+
+/*int map_object_poly_set_points(map_object_h poly,
+                                 const maps_item_list_h points);*/
+void utc_map_object_poly_set_points_p(void);
+void utc_map_object_poly_set_points_n(void);
+
+/*int map_object_poly_foreach_point(map_object_h poly,
+                                      map_object_poly_point_cb callback,
+typedef bool(*map_object_poly_point_cb) (int index, int total,
+                                             maps_coordinates_h point,
+                                             void *user_data);*/
+void utc_map_object_poly_foreach_point_p(void);
+void utc_map_object_poly_foreach_point_n(void);
+
+/*int map_object_polyline_set_color(map_object_h polyline,
+                                      const unsigned char r,
+                                      const unsigned char g,
+                                      const unsigned char b,
+                                      const unsigned char a);*/
+void utc_map_object_polyline_set_color_p(void);
+void utc_map_object_polyline_set_color_n(void);
+
+/*int map_object_polyline_get_color(const map_object_h
+                                      polyline,
+                                      unsigned char *r,
+                                      unsigned char *g,
+                                      unsigned char *b,
+                                      unsigned char *a);*/
+void utc_map_object_polyline_get_color_p(void);
+void utc_map_object_polyline_get_color_n(void);
+
+/*int map_object_polyline_set_width(map_object_h polyline,
+                                      const int width);*/
+void utc_map_object_polyline_set_width_p(void);
+void utc_map_object_polyline_set_width_n(void);
+
+/*int map_object_polyline_get_width(const map_object_h polyline,
+                                      int *width);*/
+void utc_map_object_polyline_get_width_p(void);
+void utc_map_object_polyline_get_width_n(void);
+
+/*int map_object_polygon_set_fill_color(map_object_h polygon,
+                                          const unsigned char r,
+                                          const unsigned char g,
+                                          const unsigned char b,
+                                          const unsigned char a);*/
+void utc_map_object_polygon_set_fill_color_p(void);
+void utc_map_object_polygon_set_fill_color_n(void);
+
+/*int map_object_polygon_get_fill_color(const map_object_h polygon,
+                                          unsigned char *r,
+                                          unsigned char *g,
+                                          unsigned char *b,
+                                          unsigned char *a);*/
+void utc_map_object_polygon_get_fill_color_p(void);
+void utc_map_object_polygon_get_fill_color_n(void);
+
+/*int map_object_marker_set_coordinates(map_object_h marker,
+                                  const maps_coordinates_h coordinates);*/
+void utc_map_object_marker_set_coordinates_p(void);
+void utc_map_object_marker_set_coordinates_n(void);
+
+/*int map_object_marker_set_screen_size(map_object_h marker,
+                                         const int screen_width,
+                                         const int screen_height);*/
+void utc_map_object_marker_set_screen_size_p(void);
+void utc_map_object_marker_set_screen_size_n(void);
+
+/*int map_object_marker_set_file_path(map_object_h marker,
+                                       const char *file_path);*/
+void utc_map_object_marker_set_file_path_p(void);
+void utc_map_object_marker_set_file_path_n(void);
+
+/*int map_object_marker_set_type(map_object_h marker,
+                                  const map_marker_type_e type);*/
+void utc_map_object_marker_set_type_p(void);
+void utc_map_object_marker_set_type_n(void);
+
+/*int map_object_marker_set_text(map_object_h marker,
+                                  const char *text);*/
+void utc_map_object_marker_set_text_p(void);
+void utc_map_object_marker_set_text_n(void);
+
+/*int map_object_marker_get_coordinates(const map_object_h marker,
+                                         maps_coordinates_h *coordinates);*/
+void utc_map_object_marker_get_coordinates_p(void);
+void utc_map_object_marker_get_coordinates_n(void);
+
+/*int map_object_marker_get_screen_size(map_object_h marker,
+                                         int *screen_width,
+                                         int *screen_height);*/
+void utc_map_object_marker_get_screen_size_p(void);
+void utc_map_object_marker_get_screen_size_n(void);
+
+/*int map_object_marker_get_image_file(const map_object_h marker,
+                                       char **file_path);*/
+void utc_map_object_marker_get_image_file_p(void);
+void utc_map_object_marker_get_image_file_n(void);
+
+/*int map_object_marker_get_type(const map_object_h marker,
+                                  map_marker_type_e *type);*/
+void utc_map_object_marker_get_type_p(void);
+void utc_map_object_marker_get_type_n(void);
+
+/*int map_object_marker_get_text(const map_object_h marker,
+                                  char **text);*/
+void utc_map_object_marker_get_text_p(void);
+void utc_map_object_marker_get_text_n(void);
+
+#endif /* __MAP_OBJECT_API_TEST_H__*/
+
diff --git a/test/src/api/map_view_test.cpp b/test/src/api/map_view_test.cpp
new file mode 100644 (file)
index 0000000..2ffa390
--- /dev/null
@@ -0,0 +1,560 @@
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "map_view_test.h"
+#include "map_view.h"
+#include "maps_error.h"
+#include <glib.h>
+
+
+/*int map_view_create(const maps_service_h maps,
+                    Evas_Object *parent,
+                    map_view_h *view);*/
+void utc_map_view_create_destroy_p(void)
+{
+       /* TBD */
+}
+
+void utc_map_view_create_destroy_n(void)
+{
+       /* TBD */
+}
+
+
+/*----------------------------------------------------------------------------*/
+class test_env
+{
+ public:
+       map_view_h h;
+ public:
+       test_env() : h(NULL)
+       {
+               /*
+                * maps_service_create
+                * const int error = map_view_create(&v);
+                g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+                g_assert(v);*/
+       }
+       ~test_env()
+       {
+               /*const int error = map_view_destroy(v);
+               g_assert_cmpint(error, ==, MAPS_ERROR_NONE);*/
+       }
+};
+
+
+/*int map_view_show_location(const map_view_h view,
+                           const maps_coordinates_h coordinates);*/
+void utc_map_view_show_location_p(void)
+{
+       /* TBD */
+}
+
+void utc_map_view_show_location_n(void)
+{
+       /* TBD */
+}
+
+
+/*int map_view_screen_to_geography(const map_view_h view,
+                                 const int x, const int y,
+                                 maps_coordinates_h *coordinates);*/
+void utc_map_view_screen_to_geography_p(void)
+{
+       /* TBD */
+}
+
+void utc_map_view_screen_to_geography_n(void)
+{
+       /* TBD */
+}
+
+
+/*int map_view_geography_to_screen(const map_view_h view,
+                                 const maps_coordinates_h coordinates,
+                                 int *x, int *y);*/
+void utc_map_view_geography_to_screen_p(void)
+{
+       /* TBD */
+}
+
+void utc_map_view_geography_to_screen_n(void)
+{
+       /* TBD */
+}
+
+
+/*int map_view_get_panel(const map_view_h view, Evas_Object **panel);*/
+void utc_map_view_get_panel_p(void)
+{
+       /* TBD */
+}
+
+void utc_map_view_get_panel_n(void)
+{
+       /* TBD */
+}
+
+
+/*int map_view_resize(const map_view_h view, const int width,
+                      const int height);*/
+void utc_map_view_resize_p(void)
+{
+       /* TBD */
+}
+
+void utc_map_view_resize_n(void)
+{
+       /* TBD */
+}
+
+
+/*int map_view_get_size(const map_view_h view, int *width, int *height);*/
+void utc_map_view_get_size_p(void)
+{
+       /* TBD */
+}
+
+void utc_map_view_get_size_n(void)
+{
+       /* TBD */
+}
+
+
+/*int map_view_move(const map_view_h view, const int x, const int y);*/
+void utc_map_view_move_p(void)
+{
+       /* TBD */
+}
+
+void utc_map_view_move_n(void)
+{
+       /* TBD */
+}
+
+
+/*int map_view_get_pos(const map_view_h view, int *x, int *y);*/
+void utc_map_view_get_pos_p(void)
+{
+       /* TBD */
+}
+
+void utc_map_view_get_pos_n(void)
+{
+       /* TBD */
+}
+
+
+/*int map_view_show(const map_view_h view);*/
+void utc_map_view_show_p(void)
+{
+       /* TBD */
+}
+
+void utc_map_view_show_n(void)
+{
+       /* TBD */
+}
+
+
+/*int map_view_hide(const map_view_h view);*/
+void utc_map_view_hide_p(void)
+{
+       /* TBD */
+}
+
+void utc_map_view_hide_n(void)
+{
+       /* TBD */
+}
+
+
+/*int map_view_is_visible(const map_view_h view, bool *visible);*/
+void utc_map_view_is_visible_p(void)
+{
+       /* TBD */
+}
+
+void utc_map_view_is_visible_n(void)
+{
+       /* TBD */
+}
+
+
+/*int map_view_redraw(const map_view_h view);*/
+void utc_map_view_redraw_p(void)
+{
+       /* TBD */
+}
+
+void utc_map_view_redraw_n(void)
+{
+       /* TBD */
+}
+
+
+/*int map_view_zoom(const map_view_h view, const double factor);*/
+void utc_map_view_zoom_p(void)
+{
+       /* TBD */
+}
+
+void utc_map_view_zoom_n(void)
+{
+       /* TBD */
+}
+
+
+/*int map_view_get_zoom_factor(const map_view_h view, double *factor);*/
+void utc_map_view_get_zoom_factor_p(void)
+{
+       /* TBD */
+}
+
+void utc_map_view_get_zoom_factor_n(void)
+{
+       /* TBD */
+}
+
+
+/*int map_view_rotate(const map_view_h view, const double angle);*/
+void utc_map_view_rotate_p(void)
+{
+       /* TBD */
+}
+
+void utc_map_view_rotate_n(void)
+{
+       /* TBD */
+}
+
+
+/*int map_view_get_rotation_angle(const map_view_h view, double *angle);*/
+void utc_map_view_get_rotation_angle_p(void)
+{
+       /* TBD */
+}
+
+void utc_map_view_get_rotation_angle_n(void)
+{
+       /* TBD */
+}
+
+
+/*typedef void(*map_view_on_gesture_cb) (maps_error_e result,
+                                    const int x, const int y,
+                                    const map_view_gesture_e g,
+                                    void *user_data);
+int map_view_set_on_gesture_callback(map_view_h view,
+                                     map_view_on_gesture_cb callback,
+                                     void *user_data);*/
+void utc_map_view_set_on_gesture_callback_p(void)
+{
+       /* TBD */
+}
+
+void utc_map_view_set_on_gesture_callback_n(void)
+{
+       /* TBD */
+}
+
+
+/*typedef void(*map_view_on_zoom_cb) (maps_error_e result,
+                                    const int x, const int y,
+                                    const double factor,
+                                    void *user_data);
+int map_view_set_on_zoom_callback(map_view_h view,
+                                  map_view_on_zoom_cb callback,
+                                  void *user_data);*/
+void utc_map_view_set_on_zoom_callback_p(void)
+{
+       /* TBD */
+}
+
+void utc_map_view_set_on_zoom_callback_n(void)
+{
+       /* TBD */
+}
+
+
+/*typedef void(*map_view_on_rotate_cb) (maps_error_e result,
+                                      const int x, const int y,
+                                      const double angle,
+                                      void *user_data);
+int map_view_set_on_rotate_callback(map_view_h view,
+                                    map_view_on_rotate_cb callback,
+                                    void *user_data);*/
+void utc_map_view_set_on_rotate_callback_p(void)
+{
+       /* TBD */
+}
+
+void utc_map_view_set_on_rotate_callback_n(void)
+{
+       /* TBD */
+}
+
+
+/*typedef void(*map_view_on_object_cb) (maps_error_e result,
+                                      const int x, const int y,
+                                      const map_view_gesture_e g,
+                                      const map_object_h object,
+                                      void *user_data);
+int map_view_set_on_object_callback(map_view_h view,
+                                    map_view_on_object_cb callback,
+                                    void *user_data);*/
+void utc_map_view_set_on_object_callback_p(void)
+{
+       /* TBD */
+}
+
+void utc_map_view_set_on_object_callback_n(void)
+{
+       /* TBD */
+}
+
+
+/*typedef void(*map_view_on_ready_cb) (maps_error_e result, void *user_data);
+int map_view_set_on_ready_callback(map_view_h view,
+                                   map_view_on_ready_cb callback,
+                                   void *user_data);*/
+void utc_map_view_set_on_ready_callback_p(void)
+{
+       /* TBD */
+}
+
+void utc_map_view_set_on_ready_callback_n(void)
+{
+       /* TBD */
+}
+
+
+/*int map_view_set_gesture_action(map_view_h view,
+                                const map_view_gesture_e gesture,
+                                const map_view_action_e action);*/
+void utc_map_view_set_gesture_action_p(void)
+{
+       /* TBD */
+}
+
+void utc_map_view_set_gesture_action_n(void)
+{
+       /* TBD */
+}
+
+
+/*int map_view_disable_gesture(map_view_h view,
+                             const map_view_gesture_e gesture);*/
+void utc_map_view_disable_gesture_p(void)
+{
+       /* TBD */
+}
+
+void utc_map_view_disable_gesture_n(void)
+{
+       /* TBD */
+}
+
+
+/*int map_view_add_marker_type(map_view_h view,
+                             const maps_coordinates_h coordinates,
+                             const map_marker_type_e type,
+                             map_object_h *marker);*/
+void utc_map_view_add_marker_type_p(void)
+{
+       /* TBD */
+}
+
+void utc_map_view_add_marker_type_n(void)
+{
+       /* TBD */
+}
+
+
+/*int map_view_add_marker_image(map_view_h view,
+                              const maps_coordinates_h coordinates,
+                              const char *image_file_name,
+                              map_object_h *marker);*/
+void utc_map_view_add_marker_image_p(void)
+{
+       /* TBD */
+}
+
+void utc_map_view_add_marker_image_n(void)
+{
+       /* TBD */
+}
+
+
+/*int map_view_add_route(map_view_h view,
+                       const maps_route_h route,
+                       map_object_h *route_object);*/
+void utc_map_view_add_route_p(void)
+{
+       /* TBD */
+}
+
+void utc_map_view_add_route_n(void)
+{
+       /* TBD */
+}
+
+
+/*int map_view_add_image(map_view_h view,
+                       const char *image_file_name,
+                       const maps_item_list_h coordinates,
+                       const double width, const double height,
+                       map_object_h *image);*/
+void utc_map_view_add_image_p(void)
+{
+       /* TBD */
+}
+
+void utc_map_view_add_image_n(void)
+{
+       /* TBD */
+}
+
+
+/*int map_view_add_polyline(map_view_h view,
+                          const maps_item_list_h coordinates,
+                          const unsigned char r,
+                          const unsigned char g,
+                          const unsigned char b,
+                          const unsigned char a,
+                          map_object_h *polyline);*/
+void utc_map_view_add_polyline_p(void)
+{
+       /* TBD */
+}
+
+void utc_map_view_add_polyline_n(void)
+{
+       /* TBD */
+}
+
+
+/*int map_view_add_polygon(map_view_h view,
+                         const maps_item_list_h coordinates,
+                         const unsigned char r,
+                         const unsigned char g,
+                         const unsigned char b,
+                         const unsigned char a,
+                         map_object_h *polygon);*/
+void utc_map_view_add_polygon_p(void)
+{
+       /* TBD */
+}
+
+void utc_map_view_add_polygon_n(void)
+{
+       /* TBD */
+}
+
+
+/*int map_view_add_circle(map_view_h view,
+                        const maps_coordinates_h coordinates,
+                        const double radius,
+                        const unsigned char r,
+                        const unsigned char g,
+                        const unsigned char b,
+                        const unsigned char a,
+                        map_object_h *circle);*/
+void utc_map_view_add_circle_p(void)
+{
+       /* TBD */
+}
+
+void utc_map_view_add_circle_n(void)
+{
+       /* TBD */
+}
+
+
+/*int map_view_add_text(map_view_h view,
+                      const maps_coordinates_h coordinates,
+                      const char *str,
+                      const unsigned char r,
+                      const unsigned char g,
+                      const unsigned char b,
+                      const unsigned char a,
+                      map_object_h *text);*/
+void utc_map_view_add_text_p(void)
+{
+       /* TBD */
+}
+
+void utc_map_view_add_text_n(void)
+{
+       /* TBD */
+}
+
+
+/*int map_view_add_object(const map_view_h view,
+                        const map_object_h object);*/
+void utc_map_view_add_object_p(void)
+{
+       /* TBD */
+}
+
+void utc_map_view_add_object_n(void)
+{
+       /* TBD */
+}
+
+
+/*int map_view_add_objects(const map_view_h view,
+                         const maps_item_list_h list);*/
+void utc_map_view_add_objects_p(void)
+{
+       /* TBD */
+}
+
+void utc_map_view_add_objects_n(void)
+{
+       /* TBD */
+}
+
+
+/*int map_view_remove_object(map_view_h view,
+                           const map_object_h object);*/
+void utc_map_view_remove_object_p(void)
+{
+       /* TBD */
+}
+
+void utc_map_view_remove_object_n(void)
+{
+       /* TBD */
+}
+
+
+/*typedef bool(*map_object_cb) (int index, int total,
+                                    map_object_h object,
+                                    void *user_data);
+int map_view_foreach_object(const map_view_h view,
+                            map_object_cb callback,
+                            void *user_data);*/
+void utc_map_view_foreach_object_p(void)
+{
+       /* TBD */
+}
+
+void utc_map_view_foreach_object_n(void)
+{
+       /* TBD */
+}
+
diff --git a/test/src/api/map_view_test.h b/test/src/api/map_view_test.h
new file mode 100644 (file)
index 0000000..0cb8839
--- /dev/null
@@ -0,0 +1,285 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MAP_VIEW_TEST_API_H__
+#define __MAP_VIEW_TEST_API_H__
+
+
+/*int map_view_create(const maps_service_h maps,
+                    Evas_Object *parent,
+                    map_view_h *view);*/
+/*int map_view_destroy(map_view_h view);*/
+void utc_map_view_create_destroy_p(void);
+void utc_map_view_create_destroy_n(void);
+
+
+/*int map_view_show_location(const map_view_h view,
+                           const maps_coordinates_h coordinates);*/
+void utc_map_view_show_location_p(void);
+void utc_map_view_show_location_n(void);
+
+
+/*int map_view_screen_to_geography(const map_view_h view,
+                                 const int x, const int y,
+                                 maps_coordinates_h *coordinates);*/
+void utc_map_view_screen_to_geography_p(void);
+void utc_map_view_screen_to_geography_n(void);
+
+
+/*int map_view_geography_to_screen(const map_view_h view,
+                                 const maps_coordinates_h coordinates,
+                                 int *x, int *y);*/
+void utc_map_view_geography_to_screen_p(void);
+void utc_map_view_geography_to_screen_n(void);
+
+
+/*int map_view_get_panel(const map_view_h view, Evas_Object **panel);*/
+void utc_map_view_get_panel_p(void);
+void utc_map_view_get_panel_n(void);
+
+/*int map_view_resize(const map_view_h view, const int width,
+                      const int height);*/
+void utc_map_view_resize_p(void);
+void utc_map_view_resize_n(void);
+
+/*int map_view_get_size(const map_view_h view, int *width, int *height);*/
+void utc_map_view_get_size_p(void);
+void utc_map_view_get_size_n(void);
+
+
+/*int map_view_move(const map_view_h view, const int x, const int y);*/
+void utc_map_view_move_p(void);
+void utc_map_view_move_n(void);
+
+
+/*int map_view_get_pos(const map_view_h view, int *x, int *y);*/
+void utc_map_view_get_pos_p(void);
+void utc_map_view_get_pos_n(void);
+
+
+/*int map_view_show(const map_view_h view);*/
+void utc_map_view_show_p(void);
+void utc_map_view_show_n(void);
+
+
+/*int map_view_hide(const map_view_h view);*/
+void utc_map_view_hide_p(void);
+void utc_map_view_hide_n(void);
+
+
+/*int map_view_is_visible(const map_view_h view, bool *visible);*/
+void utc_map_view_is_visible_p(void);
+void utc_map_view_is_visible_n(void);
+
+
+/*int map_view_redraw(const map_view_h view);*/
+void utc_map_view_redraw_p(void);
+void utc_map_view_redraw_n(void);
+
+
+/*int map_view_zoom(const map_view_h view, const double factor);*/
+void utc_map_view_zoom_p(void);
+void utc_map_view_zoom_n(void);
+
+
+/*int map_view_get_zoom_factor(const map_view_h view, double *factor);*/
+void utc_map_view_get_zoom_factor_p(void);
+void utc_map_view_get_zoom_factor_n(void);
+
+
+/*int map_view_rotate(const map_view_h view, const double angle);*/
+void utc_map_view_rotate_p(void);
+void utc_map_view_rotate_n(void);
+
+
+/*int map_view_get_rotation_angle(const map_view_h view, double *angle);*/
+void utc_map_view_get_rotation_angle_p(void);
+void utc_map_view_get_rotation_angle_n(void);
+
+
+/*typedef void(*map_view_on_gesture_cb) (maps_error_e result,
+                                    const int x, const int y,
+                                    const map_view_gesture_e g,
+                                    void *user_data);
+int map_view_set_on_gesture_callback(map_view_h view,
+                                     map_view_on_gesture_cb callback,
+                                     void *user_data);*/
+void utc_map_view_set_on_gesture_callback_p(void);
+void utc_map_view_set_on_gesture_callback_n(void);
+
+
+/*typedef void(*map_view_on_zoom_cb) (maps_error_e result,
+                                    const int x, const int y,
+                                    const double factor,
+                                    void *user_data);
+int map_view_set_on_zoom_callback(map_view_h view,
+                                  map_view_on_zoom_cb callback,
+                                  void *user_data);*/
+void utc_map_view_set_on_zoom_callback_p(void);
+void utc_map_view_set_on_zoom_callback_n(void);
+
+
+/*typedef void(*map_view_on_rotate_cb) (maps_error_e result,
+                                      const int x, const int y,
+                                      const double angle,
+                                      void *user_data);
+int map_view_set_on_rotate_callback(map_view_h view,
+                                    map_view_on_rotate_cb callback,
+                                    void *user_data);*/
+void utc_map_view_set_on_rotate_callback_p(void);
+void utc_map_view_set_on_rotate_callback_n(void);
+
+/*typedef void(*map_view_on_object_cb) (maps_error_e result,
+                                      const int x, const int y,
+                                      const map_view_gesture_e g,
+                                      const map_object_h object,
+                                      void *user_data);
+int map_view_set_on_object_callback(map_view_h view,
+                                    map_view_on_object_cb callback,
+                                    void *user_data);*/
+void utc_map_view_set_on_object_callback_p(void);
+void utc_map_view_set_on_object_callback_n(void);
+
+
+/*typedef void(*map_view_on_ready_cb) (maps_error_e result, void *user_data);
+int map_view_set_on_ready_callback(map_view_h view,
+                                   map_view_on_ready_cb callback,
+                                   void *user_data);*/
+void utc_map_view_set_on_ready_callback_p(void);
+void utc_map_view_set_on_ready_callback_n(void);
+
+
+/*int map_view_set_gesture_action(map_view_h view,
+                                const map_view_gesture_e gesture,
+                                const map_view_action_e action);*/
+void utc_map_view_set_gesture_action_p(void);
+void utc_map_view_set_gesture_action_n(void);
+
+
+/*int map_view_disable_gesture(map_view_h view,
+                             const map_view_gesture_e gesture);*/
+void utc_map_view_disable_gesture_p(void);
+void utc_map_view_disable_gesture_n(void);
+
+
+/*int map_view_add_marker_type(map_view_h view,
+                             const maps_coordinates_h coordinates,
+                             const map_marker_type_e type,
+                             map_object_h *marker);*/
+void utc_map_view_add_marker_type_p(void);
+void utc_map_view_add_marker_type_n(void);
+
+
+/*int map_view_add_marker_image(map_view_h view,
+                              const maps_coordinates_h coordinates,
+                              const char *image_file_name,
+                              map_object_h *marker);*/
+void utc_map_view_add_marker_image_p(void);
+void utc_map_view_add_marker_image_n(void);
+
+
+/*int map_view_add_route(map_view_h view,
+                       const maps_route_h route,
+                       map_object_h *route_object);*/
+void utc_map_view_add_route_p(void);
+void utc_map_view_add_route_n(void);
+
+
+/*int map_view_add_image(map_view_h view,
+                       const char *image_file_name,
+                       const maps_item_list_h coordinates,
+                       const double width, const double height,
+                       map_object_h *image);*/
+void utc_map_view_add_image_p(void);
+void utc_map_view_add_image_n(void);
+
+
+/*int map_view_add_polyline(map_view_h view,
+                          const maps_item_list_h coordinates,
+                          const unsigned char r,
+                          const unsigned char g,
+                          const unsigned char b,
+                          const unsigned char a,
+                          map_object_h *polyline);*/
+void utc_map_view_add_polyline_p(void);
+void utc_map_view_add_polyline_n(void);
+
+
+/*int map_view_add_polygon(map_view_h view,
+                         const maps_item_list_h coordinates,
+                         const unsigned char r,
+                         const unsigned char g,
+                         const unsigned char b,
+                         const unsigned char a,
+                         map_object_h *polygon);*/
+void utc_map_view_add_polygon_p(void);
+void utc_map_view_add_polygon_n(void);
+
+
+/*int map_view_add_circle(map_view_h view,
+                        const maps_coordinates_h coordinates,
+                        const double radius,
+                        const unsigned char r,
+                        const unsigned char g,
+                        const unsigned char b,
+                        const unsigned char a,
+                        map_object_h *circle);*/
+void utc_map_view_add_circle_p(void);
+void utc_map_view_add_circle_n(void);
+
+
+/*int map_view_add_text(map_view_h view,
+                      const maps_coordinates_h coordinates,
+                      const char *str,
+                      const unsigned char r,
+                      const unsigned char g,
+                      const unsigned char b,
+                      const unsigned char a,
+                      map_object_h *text);*/
+void utc_map_view_add_text_p(void);
+void utc_map_view_add_text_n(void);
+
+
+/*int map_view_add_object(const map_view_h view,
+                        const map_object_h object);*/
+void utc_map_view_add_object_p(void);
+void utc_map_view_add_object_n(void);
+
+
+/*int map_view_add_objects(const map_view_h view,
+                         const maps_item_list_h list);*/
+void utc_map_view_add_objects_p(void);
+void utc_map_view_add_objects_n(void);
+
+
+/*int map_view_remove_object(map_view_h view,
+                           const map_object_h object);*/
+void utc_map_view_remove_object_p(void);
+void utc_map_view_remove_object_n(void);
+
+
+/*typedef bool(*map_object_cb) (int index, int total,
+                                    map_object_h object,
+                                    void *user_data);
+int map_view_foreach_object(const map_view_h view,
+                            map_object_cb callback,
+                            void *user_data);*/
+void utc_map_view_foreach_object_p(void);
+void utc_map_view_foreach_object_n(void);
+
+
+#endif /* __MAP_VIEW_TEST_API_H__*/
+
index 2aa735a1fd3c4090a402ac06dfbabde8a458c1f4..a6218a0bcf02de0354c166469ed48e0b40ebc26a 100755 (executable)
@@ -33,7 +33,6 @@ class test_env
        enum TEST_PLUGIN
        {
                DUMMY,
-               MAPQUEST,
                HERE,
        };
        struct test_plugin_info_s
@@ -60,14 +59,9 @@ class test_env
                                "test_key",
                                false },
 
-                       /* MAPQUEST */
-                       { "Open Street Maps",
-                               "test_key"
-                               true },
-
                        /* HERE */
                        { "HERE",
-                               "test_app_id/test_app_code"
+                               "test_app_id/test_app_code",
                                true }
                };
                 return info[idx];
@@ -79,9 +73,8 @@ class test_env
 
                /* Chose the Plugin for testing */
                test_plugin_type =
-                       /*DUMMY*/       /* Dummy plugin */
-                       /*MAPQUEST*/    /* MapQuest plugin */
-                       HERE    /* Nokia Here Maps */
+                       DUMMY   /* Dummy plugin */
+                       /*HERE*/        /* Nokia Here Maps */
                        ;
 
                i = get_plugin_info(test_plugin_type);
@@ -333,52 +326,50 @@ void utc_maps_service_provider_is_data_supported_p(void)
                        MAPS_PLACE_ADDRESS, &supported), ==, MAPS_ERROR_NONE);
        g_assert(supported);
 
-       if (e.test_plugin_type != test_env::MAPQUEST) {
-               g_assert_cmpint(maps_service_provider_is_data_supported(e.m,
-                               MAPS_PLACE_RATING, &supported), ==,
-                       MAPS_ERROR_NONE);
-               g_assert(supported);
-
-               g_assert_cmpint(maps_service_provider_is_data_supported(e.m,
-                               MAPS_PLACE_CATEGORIES, &supported), ==,
-                       MAPS_ERROR_NONE);
-               g_assert(supported);
-
-               g_assert_cmpint(maps_service_provider_is_data_supported(e.m,
-                               MAPS_PLACE_ATTRIBUTES, &supported), ==,
-                       MAPS_ERROR_NONE);
-               g_assert(supported);
-
-               g_assert_cmpint(maps_service_provider_is_data_supported(e.m,
-                               MAPS_PLACE_CONTACTS, &supported), ==,
-                       MAPS_ERROR_NONE);
-               g_assert(supported);
-
-               g_assert_cmpint(maps_service_provider_is_data_supported(e.m,
-                               MAPS_PLACE_EDITORIALS, &supported), ==,
-                       MAPS_ERROR_NONE);
-               g_assert(supported);
-
-               g_assert_cmpint(maps_service_provider_is_data_supported(e.m,
-                               MAPS_PLACE_REVIEWS, &supported), ==,
-                       MAPS_ERROR_NONE);
-               g_assert(supported);
-
-               g_assert_cmpint(maps_service_provider_is_data_supported(e.m,
-                               MAPS_PLACE_IMAGE, &supported), ==,
-                       MAPS_ERROR_NONE);
-               g_assert(supported);
-
-               g_assert_cmpint(maps_service_provider_is_data_supported(e.m,
-                               MAPS_PLACE_SUPPLIER, &supported), ==,
-                       MAPS_ERROR_NONE);
-               g_assert(supported);
-
-               g_assert_cmpint(maps_service_provider_is_data_supported(e.m,
-                               MAPS_PLACE_RELATED, &supported), ==,
-                       MAPS_ERROR_NONE);
-               g_assert(supported);
-       }
+       g_assert_cmpint(maps_service_provider_is_data_supported(e.m,
+                       MAPS_PLACE_RATING, &supported), ==,
+               MAPS_ERROR_NONE);
+       g_assert(supported);
+
+       g_assert_cmpint(maps_service_provider_is_data_supported(e.m,
+                       MAPS_PLACE_CATEGORIES, &supported), ==,
+               MAPS_ERROR_NONE);
+       g_assert(supported);
+
+       g_assert_cmpint(maps_service_provider_is_data_supported(e.m,
+                       MAPS_PLACE_ATTRIBUTES, &supported), ==,
+               MAPS_ERROR_NONE);
+       g_assert(supported);
+
+       g_assert_cmpint(maps_service_provider_is_data_supported(e.m,
+                       MAPS_PLACE_CONTACTS, &supported), ==,
+               MAPS_ERROR_NONE);
+       g_assert(supported);
+
+       g_assert_cmpint(maps_service_provider_is_data_supported(e.m,
+                       MAPS_PLACE_EDITORIALS, &supported), ==,
+               MAPS_ERROR_NONE);
+       g_assert(supported);
+
+       g_assert_cmpint(maps_service_provider_is_data_supported(e.m,
+                       MAPS_PLACE_REVIEWS, &supported), ==,
+               MAPS_ERROR_NONE);
+       g_assert(supported);
+
+       g_assert_cmpint(maps_service_provider_is_data_supported(e.m,
+                       MAPS_PLACE_IMAGE, &supported), ==,
+               MAPS_ERROR_NONE);
+       g_assert(supported);
+
+       g_assert_cmpint(maps_service_provider_is_data_supported(e.m,
+                       MAPS_PLACE_SUPPLIER, &supported), ==,
+               MAPS_ERROR_NONE);
+       g_assert(supported);
+
+       g_assert_cmpint(maps_service_provider_is_data_supported(e.m,
+                       MAPS_PLACE_RELATED, &supported), ==,
+               MAPS_ERROR_NONE);
+       g_assert(supported);
 
        g_assert_cmpint(maps_service_provider_is_data_supported(e.m,
                        MAPS_ROUTE_PATH, &supported), ==, MAPS_ERROR_NONE);
@@ -606,12 +597,6 @@ void utc_maps_service_geocode_by_structured_address_p(void)
 {
        test_env* e = new test_env;
 
-       /* TODO: check if MapQuest supports geocoding by structured address */
-       if (e->test_plugin_type == test_env::MAPQUEST) {
-               delete e;
-               return;
-       }
-
        maps_address_h address = NULL;
        int error = maps_address_create(&address);
        g_assert(address);
@@ -834,7 +819,6 @@ void utc_maps_cancel_geocode_p(void)
 
 void utc_maps_cancel_geocode_p02(void)
 {
-       /* TODO: figure out, why it is failed with MapQuest Plugin */
        test_env e;
 
        maps_item_hashtable_set_string(e.p, "no_need_callback",
@@ -1061,6 +1045,8 @@ static bool __utc_maps_service_search_place_cb(maps_error_e error,
        test_env* e = (test_env*) user_data;
        g_assert(e);
 
+       e->iterations++;
+
        if (e->rid > 0) {
                g_assert_cmpint(e->rid, ==, request_id);
        }
@@ -1190,11 +1176,12 @@ void utc_maps_service_search_place_p(void)
 {
        test_env* e = new test_env;
 
-       /*maps::coordinates position(37.7942, -122.4070);*/
-       maps::coordinates position(37.7555302, 127.002253);
+       maps::coordinates position(37.7942, -122.4070);
+       //maps::coordinates position(37.7555302, 127.002253);
 
        maps::place_filter filter;
-       int error = maps_place_filter_set_place_name(filter, "Seoul");
+       //int error = maps_place_filter_set_place_name(filter, "Seoul");
+       int error = maps_place_filter_set_place_name(filter, "San Francisco");
        g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
 
        /* test start --------------------------------- */
@@ -1427,6 +1414,8 @@ static bool __utc_maps_service_search_route_cb(maps_error_e error,
        test_env* e = (test_env*) user_data;
        g_assert(e);
 
+       e->iterations++;
+
        if (e->rid > 0) {
                g_assert_cmpint(e->rid, ==, request_id);
        }
@@ -1856,3 +1845,187 @@ void utc_maps_service_search_route_real_p(void)
        e->finish_request();
 }
 
+
+
+/*----------------------------------------------------------------------------*/
+/* Serial API test */
+
+void utc_maps_service_serial_p(void)
+{
+       test_env *e = new test_env;
+       const int serial_test_number = 5;
+
+       /* Some test parameters */
+       maps::coordinates berlin_c1(15.665354, 74.311523);
+       maps::coordinates berlin_c2(10.617418, 79.145508);
+       maps::area berlin_area(berlin_c1, berlin_c2);
+
+       maps::address address;
+       maps_address_set_city(address, "Prague");
+       maps_address_set_street(address, "Na Bojisti");
+       maps_address_set_building_number(address, "1733/12");
+
+       maps::coordinates seoul_position(37.7555302, 127.002253);
+       maps::place_filter filter;
+       maps_place_filter_set_place_name(filter, "Seoul");
+       maps::area seoul_area(37.7555302 + 0.2, 127.002253 - 0.2,
+                             37.7555302 - 0.2, 127.002253 + 0.2);
+       maps::area sf_area(37.7942 + 0.2, -122.407 - 0.2,
+                          37.7942 - 0.2, -122.407 + 0.2);
+
+
+       maps::coordinates origin(37.34, 126.58);
+       maps::coordinates destination(37.34, 126.58);
+       maps_coordinates_h waypoint_list[2] = { origin, destination };
+
+       for(int i = 0; i < serial_test_number; i ++) {
+               g_print("\n\n\tIteration: %d**************************\n\n", i);
+
+               /* Geocode */
+               g_print("\t * Geocode [%d]\n", i);
+               int error = maps_service_geocode(e->m,
+                                                "Seoul",
+                                                e->p,
+                                                __utc_maps_service_geocode_cb,
+                                                (void*) e,
+                                                &e->rid);
+               g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+               e->wait_for_response();
+               g_assert(e->rid > 0);
+               g_assert(e->iterations > 0);
+               e->rid = 0;
+               e->iterations = 0;
+
+
+               g_print("\t * Geocode Inside Area [%d]\n", i);
+               error = maps_service_geocode_inside_area(e->m,
+                                                        "Berlin",
+                                                        berlin_area,
+                                                        e->p,
+                                                __utc_maps_service_geocode_cb,
+                                                        (void*) e,
+                                                        &e->rid);
+               g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+               e->wait_for_response();
+               g_assert(e->rid > 0);
+               g_assert(e->iterations > 0);
+               e->rid = 0;
+               e->iterations = 0;
+
+               g_print("\t * Geocode by Structured Address [%d]\n", i);
+               error = maps_service_geocode_by_structured_address(e->m,
+                                                                  address,
+                                                                  e->p,
+                                               __utc_maps_service_geocode_cb,
+                                                                  (void*) e,
+                                                                  &e->rid);
+               g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+               e->wait_for_response();
+               g_assert(e->rid > 0);
+               g_assert(e->iterations > 0);
+               e->rid = 0;
+               e->iterations = 0;
+
+               /* Reverse Geocode */
+               g_print("\t * Reverse Geocode [%d]\n", i);
+               error = maps_service_reverse_geocode(e->m,
+                                                    12.944594,
+                                                    77.554303,
+                                                    e->p,
+                                       __utc_maps_service_reverse_geocode_cb,
+                                                    (void*) e,
+                                                    &e->rid);
+               g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+               e->wait_for_response();
+               g_assert(e->rid > 0);
+               e->rid = 0;
+               /* In this request we have only one iteration
+                * g_assert(e->iterations > 0);
+                * e->iterations = 0;*/
+
+               /* Place */
+               g_print("\t * Search Place [%d]\n", i);
+               error = maps_service_search_place(e->m,
+                                                 seoul_position,
+                                                 50000,
+                                                 filter,
+                                                 e->p,
+                                        __utc_maps_service_search_place_cb,
+                                                 (void*) e,
+                                                 &e->rid);
+               g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+               e->wait_for_response();
+               g_assert(e->rid > 0);
+               g_assert(e->iterations > 0);
+               e->rid = 0;
+               e->iterations = 0;
+
+
+               g_print("\t * Search Place by Area [%d]\n", i);
+               error = maps_service_search_place_by_area(e->m,
+                                                         seoul_area,
+                                                         filter,
+                                                         e->p,
+                                        __utc_maps_service_search_place_cb,
+                                                         (void*) e,
+                                                         &e->rid);
+               g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+               e->wait_for_response();
+               g_assert(e->rid > 0);
+               g_assert(e->iterations > 0);
+               e->rid = 0;
+               e->iterations = 0;
+
+
+               g_print("\t * Search Place by Address [%d]\n", i);
+               error = maps_service_search_place_by_address(e->m,
+                                                            "Jackson",
+                                                            sf_area,
+                                                            filter,
+                                                            e->p,
+                                         __utc_maps_service_search_place_cb,
+                                                            (void*) e,
+                                                            &e->rid);
+               g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+               e->wait_for_response();
+               g_assert(e->rid > 0);
+               g_assert(e->iterations > 0);
+               e->rid = 0;
+               e->iterations = 0;
+
+
+               /* Route */
+               g_print("\t * Search Route [%d]\n", i);
+               error = maps_service_search_route(e->m,
+                                                 origin,
+                                                 destination,
+                                                 e->p,
+                                        __utc_maps_service_search_route_cb,
+                                                 (void*) e,
+                                                 &e->rid);
+               g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+               e->wait_for_response();
+               g_assert(e->rid > 0);
+               g_assert(e->iterations > 0);
+               e->rid = 0;
+               e->iterations = 0;
+
+
+               g_print("\t * Search Route by Waypoints [%d]\n", i);
+               error = maps_service_search_route_waypoints(e->m,
+                                                           waypoint_list,
+                                                           2,
+                                                           e->p,
+                                        __utc_maps_service_search_route_cb,
+                                                           (void*) e,
+                                                           &e->rid);
+               g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+               e->wait_for_response();
+               g_assert(e->rid > 0);
+               g_assert(e->iterations > 0);
+               e->rid = 0;
+               e->iterations = 0;
+       }
+
+       e->finish_request();
+}
index 7007440501f1270a3997ef99a6698dc64cac7486..524ed2900805d7016b2bf51d040a775803bc8564 100644 (file)
@@ -73,5 +73,7 @@ void utc_maps_cancel_route_n(void);
 
 void utc_maps_service_search_route_real_p(void);
 
+void utc_maps_service_serial_p(void);
+
 #endif /* __MAPS_SERVICE_TEST_API_H__ */
 
index 92c62f9ffe51deacea5867ba4d3b60c28aa89a4a..24fcf0ebf0af73913d6c32c59a8d226d0a5751d5 100644 (file)
@@ -21,6 +21,7 @@
 #include "maps_coordinates.h"
 #include "maps_service.h"
 #include "maps_test_utils.h"
+#include "maps_extra_types_private.h"
 
 /* int maps_item_list_create(maps_item_list_h* list); */
 /* int maps_item_list_destroy(maps_item_list_h list); */
@@ -328,6 +329,150 @@ void utc_maps_string_hashtable_foreach_n(void)
 
 /*----------------------------------------------------------------------------*/
 
+/* int maps_int_hashtable_create(maps_int_hashtable_h* table); */
+/* int maps_int_hashtable_destroy(maps_int_hashtable_h table); */
+void utc_maps_int_hashtable_create_p(void)
+{
+       maps_int_hashtable_h table = NULL;
+       int error = maps_int_hashtable_create(&table);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert(table);
+
+       error = maps_int_hashtable_destroy(table);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_int_hashtable_create_n(void)
+{
+       int error = maps_int_hashtable_create(NULL);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = maps_int_hashtable_destroy(NULL);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+class test_env_int_hashtable
+{
+ public:
+       maps_int_hashtable_h table;
+ public:
+       test_env_int_hashtable():table(NULL)
+       {
+               const int error = maps_int_hashtable_create(&table);
+                g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+                g_assert(table);
+       }
+       ~test_env_int_hashtable()
+       {
+               const int error = maps_int_hashtable_destroy(table);
+               g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       }
+};
+
+/* int maps_int_hashtable_set(maps_int_hashtable_h table, char* key,
+*  const char* value); */
+/* int maps_int_hashtable_get(maps_int_hashtable_h table, char* key,
+*  char** value); */
+/* int maps_int_hashtable_remove(maps_int_hashtable_h map,
+*  const char* key); */
+void utc_maps_int_hashtable_set_p(void)
+{
+       test_env_int_hashtable e;
+
+       int error = maps_int_hashtable_set(e.table, 1, 101);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = maps_int_hashtable_set(e.table, 2, 102);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = maps_int_hashtable_set(e.table, 3, 103);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       int value1 = 0;
+       error = maps_int_hashtable_get(e.table, 1, &value1);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert_cmpint(value1, ==, 101);
+
+       int value2 = 0;
+       error = maps_int_hashtable_get(e.table, 2, &value2);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert_cmpint(value2, ==, 102);
+
+       int value3 = 0;
+       error = maps_int_hashtable_get(e.table, 3, &value3);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert_cmpint(value3, ==, 103);
+}
+
+void utc_maps_int_hashtable_set_n(void)
+{
+       test_env_int_hashtable e;
+
+       int error = maps_int_hashtable_set(NULL, 1, 101);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* typedef bool (*maps_int_hashtable_foreach_cb)(const int key, const int value,
+*  void* user_data); */
+/* int maps_int_hashtable_foreach(maps_int_hashtable_h table,
+*  maps_int_hashtable_foreach_cb callback, void* user_data); */
+static bool __utc_maps_int_hashtable_foreach_cb(int index, int total,
+       const int key, const int value, void* user_data)
+{
+       g_assert_cmpint(total, ==, 3);
+
+       if (key == 1) {
+               g_assert_cmpint(value, ==, 101);
+
+       }
+       else if (key == 2) {
+               g_assert_cmpint(value, ==, 102);
+
+       }
+       else if (key == 3) {
+               g_assert_cmpint(value, ==, 103);
+
+       }
+       else {
+               g_print("\n\n%d, %d\n\n", key, value);
+               g_assert(false);
+       }
+       return true;
+}
+
+void utc_maps_int_hashtable_foreach_p(void)
+{
+       test_env_int_hashtable e;
+
+       int error = maps_int_hashtable_set(e.table, 1, 101);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = maps_int_hashtable_set(e.table, 2, 102);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = maps_int_hashtable_set(e.table, 3, 103);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = maps_int_hashtable_foreach(e.table,
+               __utc_maps_int_hashtable_foreach_cb, NULL);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_int_hashtable_foreach_n(void)
+{
+       test_env_int_hashtable e;
+
+       int error =
+               maps_int_hashtable_foreach(NULL,
+               __utc_maps_int_hashtable_foreach_cb, NULL);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = maps_int_hashtable_foreach(e.table, NULL, NULL);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/*----------------------------------------------------------------------------*/
+
 /* int maps_item_hashtable_create(maps_item_hashtable_h* table); */
 /* int maps_item_hashtable_destroy(maps_item_hashtable_h table); */
 void utc_maps_item_hashtable_create_p(void)
index 6b3283bd120bb7d7eba230c76c97ca1e39a63d92..87e4ddeaaf82f13ac08a2af443e8f53d8b7ee56c 100644 (file)
@@ -39,6 +39,17 @@ void utc_maps_string_hashtable_foreach_n(void);
 
 /*----------------------------------------------------------------------------*/
 
+void utc_maps_int_hashtable_create_p(void);
+void utc_maps_int_hashtable_create_n(void);
+
+void utc_maps_int_hashtable_set_p(void);
+void utc_maps_int_hashtable_set_n(void);
+
+void utc_maps_int_hashtable_foreach_p(void);
+void utc_maps_int_hashtable_foreach_n(void);
+
+/*----------------------------------------------------------------------------*/
+
 void utc_maps_item_hashtable_create_p(void);
 void utc_maps_item_hashtable_create_n(void);
 
index 6fc095a672d3e71421eb6332dd7155e2405f657a..49a850551c3237bc4da993f54dc115ca49ef63e3 100644 (file)
@@ -22,6 +22,7 @@
 #include <glib.h>
 #include "maps_place_private.h"
 #include "maps_util.h"
+#include "maps_extra_types_private.h"
 
  /* int maps_place_create(maps_place_h* place); */
 /* int maps_place_destroy(maps_place_h place); */
@@ -46,49 +47,57 @@ void utc_maps_place_create_n(void)
 }
 
 /*----------------------------------------------------------------------------*/
-static int __utc_put_to_hashtable(const char* feature_str,
-       maps_string_hashtable_h t)
-{
-       if (!feature_str || !t)
-               return MAPS_ERROR_INVALID_PARAMETER;
-       return maps_string_hashtable_set(t, feature_str, feature_str);
-}
 
 class test_env
 {
- public:
+public:
        maps_place_h p;
        int iteration;
- public:
-        test_env():p(NULL), iteration(0)
+public:
+       test_env():p(NULL), iteration(0)
        {
                const int error = maps_place_create(&p);
-                g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
-                g_assert(p);
-
-               maps_string_hashtable_h data_supported = NULL;
-               if (maps_string_hashtable_create(&data_supported) !=
-                       MAPS_ERROR_NONE)
-                        return;
-
-                __utc_put_to_hashtable(_S(MAPS_PLACE_ADDRESS), data_supported);
-                __utc_put_to_hashtable(_S(MAPS_PLACE_RATING), data_supported);
-                __utc_put_to_hashtable(_S(MAPS_PLACE_CATEGORIES),
-                       data_supported);
-                __utc_put_to_hashtable(_S(MAPS_PLACE_ATTRIBUTES),
-                       data_supported);
-                __utc_put_to_hashtable(_S(MAPS_PLACE_CONTACTS),
-                       data_supported);
-                __utc_put_to_hashtable(_S(MAPS_PLACE_EDITORIALS),
-                       data_supported);
-                __utc_put_to_hashtable(_S(MAPS_PLACE_REVIEWS), data_supported);
-                __utc_put_to_hashtable(_S(MAPS_PLACE_IMAGE), data_supported);
-                __utc_put_to_hashtable(_S(MAPS_PLACE_SUPPLIER),
-                       data_supported);
-                __utc_put_to_hashtable(_S(MAPS_PLACE_RELATED), data_supported);
-
-                _maps_place_set_supported_data(p, data_supported);
-                maps_string_hashtable_destroy(data_supported);
+               g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+               g_assert(p);
+
+               maps_int_hashtable_h data_supported = NULL;
+               if (maps_int_hashtable_create(&data_supported) !=
+                   MAPS_ERROR_NONE)
+                       return;
+
+               maps_int_hashtable_set(data_supported,
+                                      MAPS_PLACE_ADDRESS,
+                                      MAPS_PLACE_ADDRESS);
+               maps_int_hashtable_set(data_supported,
+                                      MAPS_PLACE_RATING,
+                                      MAPS_PLACE_RATING);
+               maps_int_hashtable_set(data_supported,
+                                      MAPS_PLACE_CATEGORIES,
+                                      MAPS_PLACE_CATEGORIES);
+               maps_int_hashtable_set(data_supported,
+                                      MAPS_PLACE_ATTRIBUTES,
+                                      MAPS_PLACE_ATTRIBUTES);
+               maps_int_hashtable_set(data_supported,
+                                      MAPS_PLACE_CONTACTS,
+                                      MAPS_PLACE_CONTACTS);
+               maps_int_hashtable_set(data_supported,
+                                      MAPS_PLACE_EDITORIALS,
+                                      MAPS_PLACE_EDITORIALS);
+               maps_int_hashtable_set(data_supported,
+                                      MAPS_PLACE_REVIEWS,
+                                      MAPS_PLACE_REVIEWS);
+               maps_int_hashtable_set(data_supported,
+                                      MAPS_PLACE_IMAGE,
+                                      MAPS_PLACE_IMAGE);
+               maps_int_hashtable_set(data_supported,
+                                      MAPS_PLACE_SUPPLIER,
+                                      MAPS_PLACE_SUPPLIER);
+               maps_int_hashtable_set(data_supported,
+                                      MAPS_PLACE_RELATED,
+                                      MAPS_PLACE_RELATED);
+
+               _maps_place_set_supported_data(p, data_supported);
+               maps_int_hashtable_destroy(data_supported);
 
        }
        ~test_env()
@@ -240,11 +249,7 @@ void utc_maps_place_set_location_p(void)
        test_env e;
 
        maps_coordinates_h location = NULL;
-       int error = maps_coordinates_create(44.4, 22.2,
-#if _MAPS_COORDS_3D_
-               33.3,
-#endif
-               &location);
+       int error = maps_coordinates_create(44.4, 22.2, &location);
        g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
        g_assert(location);
 
@@ -257,25 +262,15 @@ void utc_maps_place_set_location_p(void)
        g_assert(location_obtained);
 
        double lat = .0, lon = .0;
-#if _MAPS_COORDS_3D_
-       double alt = .0;
-#endif
 
        error = maps_coordinates_get_latitude(location_obtained, &lat);
        g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
        error = maps_coordinates_get_longitude(location_obtained, &lon);
        g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
 
-#if _MAPS_COORDS_3D
-       error = maps_coordinates_get_altitude(location_obtained, &alt);
-       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
-#endif
 
        g_assert_cmpfloat(44.4, ==, lat);
        g_assert_cmpfloat(22.2, ==, lon);
-#if _MAPS_COORDS_3D_
-       g_assert_cmpfloat(33.3, ==, alt);
-#endif
 
        error = maps_coordinates_destroy(location);
        g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
@@ -288,11 +283,7 @@ void utc_maps_place_set_location_n(void)
        test_env e;
 
        maps_coordinates_h location = NULL;
-       int error = maps_coordinates_create(44.4, 22.2,
-#if _MAPS_COORDS_3D_
-               33.3,
-#endif
-               &location);
+       int error = maps_coordinates_create(44.4, 22.2, &location);
        g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
        g_assert(location);
 
index a6df831708f0442554fda77df3ec0743dfead4db..98d85acb1a71f0127ec2e226b4d3a9ce2b9d3a9d 100644 (file)
@@ -23,6 +23,7 @@
 #include <glib.h>
 #include "maps_route_segment_private.h"
 #include "maps_util.h"
+#include "maps_extra_types_private.h"
 
 #include <maps_object.h>
 using namespace maps;
@@ -50,38 +51,33 @@ void utc_maps_route_segment_create_n(void)
 }
 
 /*----------------------------------------------------------------------------*/
-static int __utc_put_to_hashtable(const char* feature_str,
-       maps_string_hashtable_h t)
-{
-       if (!feature_str || !t)
-               return MAPS_ERROR_INVALID_PARAMETER;
-       return maps_string_hashtable_set(t, feature_str, feature_str);
-}
 
 class test_env
 {
- public:
+public:
        maps_route_segment_h h;
        int iterations;
- public:
-        test_env():h(NULL), iterations(0)
+public:
+       test_env() : h(NULL), iterations(0)
        {
                const int error = maps_route_segment_create(&h);
-                g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
-                g_assert(h);
-
-               maps_string_hashtable_h data_supported = NULL;
-               if (maps_string_hashtable_create(&data_supported) !=
-                       MAPS_ERROR_NONE)
-                        return;
-
-                __utc_put_to_hashtable(_S(MAPS_ROUTE_SEGMENTS_PATH),
-                       data_supported);
-                __utc_put_to_hashtable(_S(MAPS_ROUTE_SEGMENTS_MANEUVERS),
-                       data_supported);
-
-                _maps_route_segment_set_supported_data(h, data_supported);
-                maps_string_hashtable_destroy(data_supported);
+               g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+               g_assert(h);
+
+               maps_int_hashtable_h data_supported = NULL;
+               if (maps_int_hashtable_create(&data_supported) !=
+                   MAPS_ERROR_NONE)
+                       return;
+
+               maps_int_hashtable_set(data_supported,
+                                      MAPS_ROUTE_SEGMENTS_PATH,
+                                      MAPS_ROUTE_SEGMENTS_PATH);
+               maps_int_hashtable_set(data_supported,
+                                      MAPS_ROUTE_SEGMENTS_MANEUVERS,
+                                      MAPS_ROUTE_SEGMENTS_MANEUVERS);
+
+               _maps_route_segment_set_supported_data(h, data_supported);
+               maps_int_hashtable_destroy(data_supported);
 
        }
        ~test_env()
index 9576ac96d6d98f24b05d5e499b36324646fa3332..9f85959539f4321891a3d5012c6c0fece50d99ec 100644 (file)
@@ -45,13 +45,6 @@ void utc_maps_route_create_n(void)
 }
 
 /*----------------------------------------------------------------------------*/
-static int __utc_put_to_hashtable(const char* feature_str,
-       maps_string_hashtable_h t)
-{
-       if (!feature_str || !t)
-               return MAPS_ERROR_INVALID_PARAMETER;
-       return maps_string_hashtable_set(t, feature_str, feature_str);
-}
 
 class test_env
 {
@@ -65,19 +58,23 @@ class test_env
                 g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
                 g_assert(h);
 
-               maps_string_hashtable_h data_supported = NULL;
-               if (maps_string_hashtable_create(&data_supported) !=
+               maps_int_hashtable_h data_supported = NULL;
+               if (maps_int_hashtable_create(&data_supported) !=
                        MAPS_ERROR_NONE)
                         return;
 
-                __utc_put_to_hashtable(_S(MAPS_ROUTE_PATH), data_supported);
-                __utc_put_to_hashtable(_S(MAPS_ROUTE_SEGMENTS_PATH),
-                       data_supported);
-                __utc_put_to_hashtable(_S(MAPS_ROUTE_SEGMENTS_MANEUVERS),
-                       data_supported);
+               maps_int_hashtable_set(data_supported,
+                                      MAPS_ROUTE_PATH,
+                                      MAPS_ROUTE_PATH);
+               maps_int_hashtable_set(data_supported,
+                                      MAPS_ROUTE_SEGMENTS_PATH,
+                                      MAPS_ROUTE_SEGMENTS_PATH);
+               maps_int_hashtable_set(data_supported,
+                                      MAPS_ROUTE_SEGMENTS_MANEUVERS,
+                                      MAPS_ROUTE_SEGMENTS_MANEUVERS);
 
                 _maps_route_set_supported_data(h, data_supported);
-                maps_string_hashtable_destroy(data_supported);
+                maps_int_hashtable_destroy(data_supported);
 
        }
        ~test_env()
@@ -158,11 +155,7 @@ void utc_maps_route_origin_p(void)
        test_env e;
 
        maps_coordinates_h coords = NULL;
-       int error = maps_coordinates_create(11.1, 22.2,
-#if _MAPS_COORDS_3D_
-               33.3,
-#endif
-               &coords);
+       int error = maps_coordinates_create(11.1, 22.2, &coords);
        g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
 
        /* start test ------------------------------------------------------- */
@@ -185,11 +178,7 @@ void utc_maps_route_origin_n(void)
        test_env e;
 
        maps_coordinates_h coords = NULL;
-       int error = maps_coordinates_create(11.1, 22.2,
-#if _MAPS_COORDS_3D_
-               33.3,
-#endif
-               &coords);
+       int error = maps_coordinates_create(11.1, 22.2, &coords);
        g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
 
        /* start test ------------------------------------------------------- */
@@ -220,11 +209,7 @@ void utc_maps_route_destination_p(void)
        test_env e;
 
        maps_coordinates_h coords = NULL;
-       int error = maps_coordinates_create(11.1, 22.2,
-#if _MAPS_COORDS_3D_
-               33.3,
-#endif
-               &coords);
+       int error = maps_coordinates_create(11.1, 22.2, &coords);
        g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
 
        /* start test ------------------------------------------------------- */
@@ -247,11 +232,7 @@ void utc_maps_route_destination_n(void)
        test_env e;
 
        maps_coordinates_h coords = NULL;
-       int error = maps_coordinates_create(11.1, 22.2,
-#if _MAPS_COORDS_3D_
-               33.3,
-#endif
-               &coords);
+       int error = maps_coordinates_create(11.1, 22.2, &coords);
        g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
 
        /* start test ------------------------------------------------------- */
@@ -282,11 +263,7 @@ void utc_maps_route_bounding_box_p(void)
        test_env e;
 
        maps_coordinates_h coords = NULL;
-       int error = maps_coordinates_create(11.1, 22.2,
-#if _MAPS_COORDS_3D_
-               33.3,
-#endif
-               &coords);
+       int error = maps_coordinates_create(11.1, 22.2, &coords);
        g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
 
        maps_area_h bounding_box = NULL;
@@ -316,11 +293,7 @@ void utc_maps_route_bounding_box_n(void)
        test_env e;
 
        maps_coordinates_h coords = NULL;
-       int error = maps_coordinates_create(11.1, 22.2,
-#if _MAPS_COORDS_3D_
-               33.3,
-#endif
-               &coords);
+       int error = maps_coordinates_create(11.1, 22.2, &coords);
        g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
 
        maps_area_h bounding_box = NULL;
index 8b54fe8928cf1d2afad65b3b915335d5a31d88e9..466fb5963df9b447b3ffbc1b79a1e3444262ab8f 100755 (executable)
@@ -39,8 +39,8 @@
 /* Number of iterations Test Cases to be run */
 /* It it is not a memory leak test, */
 /* the value of iterations will be automatically  reduced to 1 */
-static long long iterations = 250* 1000;       /* For load test */
-/* */
+static long long iterations = 250 * 1000;      /* For load test */
+
 /* */
 #ifdef MAPS_SERVICE_LOAD_TEST
        /* Sleep before next iteration */
@@ -104,8 +104,19 @@ typedef void (*test_funcvoid) (void);
 
 #include "maps_preference_test.h"
 
+#include "map_view_test.h"
+#include "map_object_test.h"
+#include "map_event_data_test.h"
+
+#include "poly_shape_hit_test_test.h"
+#include "marker_constructor_test.h"
+#include "polygon_constructor_test.h"
+#include "polyline_constructor_test.h"
+#include "route_constructor_test.h"
+
 #include "maps_service_tutorial.h"
 
+
 static void __test_add_func_load(const char *testpath, test_funcvoid func,
        const long long i)
 {
@@ -198,53 +209,75 @@ static void __add_session_tests(int i)
 static void __add_extra_data_structure_tests(int i)
 {
 #ifndef SUPPRESS_VALGRIND_WARNINGS     /* Valgrind warnings!!! */
-       /* API: Extra Data Structures: List */
-       __test_add_func_load("/api/list/create_p", utc_maps_item_list_create_p,
-               i);
-       __test_add_func_load("/api/list/create_n", utc_maps_item_list_create_n,
-               i);
-       __test_add_func_load("/api/list/append_p", utc_maps_item_list_append_p,
-               i);
-       __test_add_func_load("/api/list/append_n", utc_maps_item_list_append_n,
-               i);
-       __test_add_func_load("/api/list/foreach_p",
-               utc_maps_item_list_foreach_p, i);
-       __test_add_func_load("/api/list/foreach_n",
-               utc_maps_item_list_foreach_n, i);
-
-       /* API: Extra Data Structures: Hash Table */
-       __test_add_func_load("/api/string_hashtable/create_p",
-               utc_maps_string_hashtable_create_p, i);
-       __test_add_func_load("/api/string_hashtable/create_n",
-               utc_maps_string_hashtable_create_n, i);
-       __test_add_func_load("/api/string_hashtable/set_p",
-               utc_maps_string_hashtable_set_p, i);
-       __test_add_func_load("/api/string_hashtable/set_n",
-               utc_maps_string_hashtable_set_n, i);
-       __test_add_func_load("/api/string_hashtable/foreach_p",
-               utc_maps_string_hashtable_foreach_p, i);
-       __test_add_func_load("/api/string_hashtable/foreach_n",
-               utc_maps_string_hashtable_foreach_n, i);
-
-       /* API: Extra Data Structures: Hash Table */
-       __test_add_func_load("/api/item_hashtable/create_p",
-               utc_maps_item_hashtable_create_p, i);
-       __test_add_func_load("/api/item_hashtable/create_n",
-               utc_maps_item_hashtable_create_n, i);
-       __test_add_func_load("/api/item_hashtable/set_p",
-               utc_maps_item_hashtable_set_p, i);
-       __test_add_func_load("/api/item_hashtable/set_n",
-               utc_maps_item_hashtable_set_n, i);
-       __test_add_func_load("/api/item_hashtable/set_macro_p",
-               utc_maps_item_hashtable_set_macro_p, i);
-       __test_add_func_load("/api/item_hashtable/set_macro_n",
-               utc_maps_item_hashtable_set_macro_n, i);
-       __test_add_func_load("/api/item_hashtable/set_overwrited_macro_p",
-               utc_maps_item_hashtable_set_overwrited_macro_p, i);
-       __test_add_func_load("/api/item_hashtable/foreach_p",
-               utc_maps_item_hashtable_foreach_p, i);
-       __test_add_func_load("/api/item_hashtable/foreach_n",
-               utc_maps_item_hashtable_foreach_n, i);
+       if(1) {
+               /* API: Extra Data Structures: List */
+               __test_add_func_load("/api/list/create_p",
+                                    utc_maps_item_list_create_p, i);
+               __test_add_func_load("/api/list/create_n",
+                                    utc_maps_item_list_create_n, i);
+               __test_add_func_load("/api/list/append_p",
+                                    utc_maps_item_list_append_p, i);
+               __test_add_func_load("/api/list/append_n",
+                                    utc_maps_item_list_append_n, i);
+               __test_add_func_load("/api/list/foreach_p",
+                                    utc_maps_item_list_foreach_p, i);
+               __test_add_func_load("/api/list/foreach_n",
+                                    utc_maps_item_list_foreach_n, i);
+       }
+
+       if(1) {
+               /* API: Extra Data Structures: String Hash Table */
+               __test_add_func_load("/api/string_hashtable/create_p",
+                                    utc_maps_string_hashtable_create_p, i);
+               __test_add_func_load("/api/string_hashtable/create_n",
+                                    utc_maps_string_hashtable_create_n, i);
+               __test_add_func_load("/api/string_hashtable/set_p",
+                                    utc_maps_string_hashtable_set_p, i);
+               __test_add_func_load("/api/string_hashtable/set_n",
+                                    utc_maps_string_hashtable_set_n, i);
+               __test_add_func_load("/api/string_hashtable/foreach_p",
+                                    utc_maps_string_hashtable_foreach_p, i);
+               __test_add_func_load("/api/string_hashtable/foreach_n",
+                                    utc_maps_string_hashtable_foreach_n, i);
+       }
+
+       if(1) {
+               /* API: Extra Data Structures: Integer Hash Table */
+               __test_add_func_load("/api/int_hashtable/create_p",
+                                    utc_maps_int_hashtable_create_p, i);
+               __test_add_func_load("/api/int_hashtable/create_n",
+                                    utc_maps_int_hashtable_create_n, i);
+               __test_add_func_load("/api/int_hashtable/set_p",
+                                    utc_maps_int_hashtable_set_p, i);
+               __test_add_func_load("/api/int_hashtable/set_n",
+                                    utc_maps_int_hashtable_set_n, i);
+               __test_add_func_load("/api/int_hashtable/foreach_p",
+                                    utc_maps_int_hashtable_foreach_p, i);
+               __test_add_func_load("/api/int_hashtable/foreach_n",
+                                    utc_maps_int_hashtable_foreach_n, i);
+       }
+
+       if(1) {
+               /* API: Extra Data Structures: Hash Table */
+               __test_add_func_load("/api/item_hashtable/create_p",
+                                    utc_maps_item_hashtable_create_p, i);
+               __test_add_func_load("/api/item_hashtable/create_n",
+                                    utc_maps_item_hashtable_create_n, i);
+               __test_add_func_load("/api/item_hashtable/set_p",
+                                    utc_maps_item_hashtable_set_p, i);
+               __test_add_func_load("/api/item_hashtable/set_n",
+                                    utc_maps_item_hashtable_set_n, i);
+               __test_add_func_load("/api/item_hashtable/set_macro_p",
+                                    utc_maps_item_hashtable_set_macro_p, i);
+               __test_add_func_load("/api/item_hashtable/set_macro_n",
+                                    utc_maps_item_hashtable_set_macro_n, i);
+               __test_add_func_load("/api/item_hashtable/set_overwrtd_macro_p",
+                       utc_maps_item_hashtable_set_overwrited_macro_p, i);
+               __test_add_func_load("/api/item_hashtable/foreach_p",
+                                    utc_maps_item_hashtable_foreach_p, i);
+               __test_add_func_load("/api/item_hashtable/foreach_n",
+                                    utc_maps_item_hashtable_foreach_n, i);
+       }
 #endif
 }
 
@@ -930,23 +963,23 @@ static void __add_maps_api_tests(int i)
 
        if (1) {                /* API: Place */
                __test_add_func_load("/api/place/search_p",
-                       utc_maps_service_search_place_p, i);
-       __test_add_func_load("/api/place/search_p",
-                        utc_maps_service_search_place_p, i);
-       __test_add_func_load("/api/place/search_n",
-                       utc_maps_service_search_place_n, i);
-       __test_add_func_load("/api/place/search_by_area_p",
-                       utc_maps_service_search_place_by_area_p, i);
-       __test_add_func_load("/api/place/search_by_area_n",
-                       utc_maps_service_search_place_by_area_n, i);
-       __test_add_func_load("/api/place/search_by_address_p",
-                       utc_maps_service_search_place_by_address_p, i);
-       __test_add_func_load("/api/place/search_by_address_n",
-                       utc_maps_service_search_place_by_address_n, i);
-       __test_add_func_load("/api/place/cancel_search_p",
-                       utc_maps_cancel_place_p, i);
-       __test_add_func_load("/api/place/cancel_search_n",
-                       utc_maps_cancel_place_n, i);
+                                    utc_maps_service_search_place_p, i);
+               __test_add_func_load("/api/place/search_p",
+                                    utc_maps_service_search_place_p, i);
+               __test_add_func_load("/api/place/search_n",
+                                    utc_maps_service_search_place_n, i);
+               __test_add_func_load("/api/place/search_by_area_p",
+                               utc_maps_service_search_place_by_area_p, i);
+               __test_add_func_load("/api/place/search_by_area_n",
+                               utc_maps_service_search_place_by_area_n, i);
+               __test_add_func_load("/api/place/search_by_address_p",
+                               utc_maps_service_search_place_by_address_p, i);
+               __test_add_func_load("/api/place/search_by_address_n",
+                               utc_maps_service_search_place_by_address_n, i);
+               __test_add_func_load("/api/place/cancel_search_p",
+                                    utc_maps_cancel_place_p, i);
+               __test_add_func_load("/api/place/cancel_search_n",
+                                    utc_maps_cancel_place_n, i);
        }
 
        if (1) {                /* API: Route */
@@ -968,9 +1001,510 @@ static void __add_maps_api_tests(int i)
                __test_add_func_load("/api/route/search_realistic_p",
                        utc_maps_service_search_route_real_p, i);
 
+       if(1) {
+               __test_add_func_load("/api/serial_p",
+                       utc_maps_service_serial_p, i);
+       }
+
+#endif
+}
+
+static void __add_map_view_api_tests(int i)
+{
+#ifndef SUPPRESS_VALGRIND_WARNINGS     /* Valgrind warnings!!! */
+
+       if (1) {                /* Create and destroy Maps View */
+               __test_add_func_load("/api/map_view/create_destroy_p",
+                       utc_map_view_create_destroy_p, i);
+               __test_add_func_load("/api/map_view/create_destroy_n",
+                       utc_map_view_create_destroy_n, i);
+       }
+
+
+       if (1) {                /* Maps View Basic Features */
+               __test_add_func_load("/api/map_view/show_location_p",
+                       utc_map_view_show_location_p, i);
+               __test_add_func_load("/api/map_view/show_location_n",
+                       utc_map_view_show_location_n, i);
+               __test_add_func_load("/api/map_view/screen_to_geography_p",
+                       utc_map_view_screen_to_geography_p, i);
+               __test_add_func_load("/api/map_view/screen_to_geography_n",
+                       utc_map_view_screen_to_geography_n, i);
+               __test_add_func_load("/api/map_view/geography_to_screen_p",
+                       utc_map_view_geography_to_screen_p, i);
+               __test_add_func_load("/api/map_view/geography_to_screen_n",
+                       utc_map_view_geography_to_screen_n, i);
+       }
+
+
+       if (1) {                /* Maps View Handling Features */
+               __test_add_func_load("/api/map_view/get_panel_p",
+                       utc_map_view_get_panel_p, i);
+               __test_add_func_load("/api/map_view/get_panel_n",
+                       utc_map_view_get_panel_n, i);
+               __test_add_func_load("/api/map_view/resize_p",
+                       utc_map_view_resize_p, i);
+               __test_add_func_load("/api/map_view/resize_n",
+                       utc_map_view_resize_n, i);
+               __test_add_func_load("/api/map_view/get_size_p",
+                       utc_map_view_get_size_p, i);
+               __test_add_func_load("/api/map_view/get_size_n",
+                       utc_map_view_get_size_n, i);
+               __test_add_func_load("/api/map_view/move_p",
+                       utc_map_view_move_p, i);
+               __test_add_func_load("/api/map_view/move_n",
+                       utc_map_view_move_n, i);
+               __test_add_func_load("/api/map_view/get_pos_p",
+                       utc_map_view_get_pos_p, i);
+               __test_add_func_load("/api/map_view/get_pos_n",
+                       utc_map_view_get_pos_n, i);
+               __test_add_func_load("/api/map_view/show_p",
+                       utc_map_view_show_p, i);
+               __test_add_func_load("/api/map_view/show_n",
+                       utc_map_view_show_n, i);
+               __test_add_func_load("/api/map_view/hide_p",
+                       utc_map_view_hide_p, i);
+               __test_add_func_load("/api/map_view/hide_n",
+                       utc_map_view_hide_n, i);
+               __test_add_func_load("/api/map_view/is_visible_p",
+                       utc_map_view_is_visible_p, i);
+               __test_add_func_load("/api/map_view/is_visible_n",
+                       utc_map_view_is_visible_n, i);
+               __test_add_func_load("/api/map_view/zoom_p",
+                       utc_map_view_zoom_p, i);
+               __test_add_func_load("/api/map_view/zoom_n",
+                       utc_map_view_zoom_n, i);
+               __test_add_func_load("/api/map_view/get_zoom_factor_p",
+                       utc_map_view_get_zoom_factor_p, i);
+               __test_add_func_load("/api/map_view/get_zoom_factor_n",
+                       utc_map_view_get_zoom_factor_n, i);
+               __test_add_func_load("/api/map_view/rotate_p",
+                       utc_map_view_rotate_p, i);
+               __test_add_func_load("/api/map_view/rotate_n",
+                       utc_map_view_rotate_n, i);
+               __test_add_func_load("/api/map_view/get_rotation_angle_p",
+                       utc_map_view_get_rotation_angle_p, i);
+               __test_add_func_load("/api/map_view/get_rotation_angle_n",
+                       utc_map_view_get_rotation_angle_n, i);
+       }
+
+
+       if (1) {                /* Maps View Event Features */
+               __test_add_func_load("/api/map_view/set_on_gesture_callback_p",
+                       utc_map_view_set_on_gesture_callback_p, i);
+               __test_add_func_load("/api/map_view/set_on_gesture_callback_n",
+                       utc_map_view_set_on_gesture_callback_n, i);
+               __test_add_func_load("/api/map_view/set_on_zoom_callback_p",
+                       utc_map_view_set_on_zoom_callback_p, i);
+               __test_add_func_load("/api/map_view/set_on_zoom_callback_n",
+                       utc_map_view_set_on_zoom_callback_n, i);
+               __test_add_func_load("/api/map_view/set_on_rotate_callback_p",
+                       utc_map_view_set_on_rotate_callback_p, i);
+               __test_add_func_load("/api/map_view/set_on_rotate_callback_n",
+                       utc_map_view_set_on_rotate_callback_n, i);
+               __test_add_func_load("/api/map_view/set_on_object_callback_p",
+                       utc_map_view_set_on_object_callback_p, i);
+               __test_add_func_load("/api/map_view/set_on_object_callback_n",
+                       utc_map_view_set_on_object_callback_n, i);
+               __test_add_func_load("/api/map_view/set_on_ready_callback_n",
+                       utc_map_view_set_on_ready_callback_n, i);
+               __test_add_func_load("/api/map_view/set_gesture_action_p",
+                       utc_map_view_set_gesture_action_p, i);
+               __test_add_func_load("/api/map_view/set_gesture_action_n",
+                       utc_map_view_set_gesture_action_n, i);
+               __test_add_func_load("/api/map_view/disabel_gesture_p",
+                       utc_map_view_disable_gesture_p, i);
+               __test_add_func_load("/api/map_view/disabel_gesture_n",
+                       utc_map_view_disable_gesture_n, i);
+       }
+
+
+       if (1) {                /* Maps View Visual Object Features */
+               __test_add_func_load("/api/map_view/add_marker_type_p",
+                       utc_map_view_add_marker_type_p, i);
+               __test_add_func_load("/api/map_view/add_marker_type_n",
+                       utc_map_view_add_marker_type_n, i);
+               __test_add_func_load("/api/map_view/add_marker_image_p",
+                       utc_map_view_add_marker_image_p, i);
+               __test_add_func_load("/api/map_view/add_marker_image_n",
+                       utc_map_view_add_marker_image_n, i);
+               __test_add_func_load("/api/map_view/add_route_p",
+                       utc_map_view_add_route_p, i);
+               __test_add_func_load("/api/map_view/add_route_n",
+                       utc_map_view_add_route_n, i);
+               __test_add_func_load("/api/map_view/add_image_p",
+                       utc_map_view_add_image_p, i);
+               __test_add_func_load("/api/map_view/add_image_n",
+                       utc_map_view_add_image_n, i);
+               __test_add_func_load("/api/map_view/add_polyline_p",
+                       utc_map_view_add_polyline_p, i);
+               __test_add_func_load("/api/map_view/add_polyline_n",
+                       utc_map_view_add_polyline_n, i);
+               __test_add_func_load("/api/map_view/add_polygon_p",
+                       utc_map_view_add_polygon_p, i);
+               __test_add_func_load("/api/map_view/add_polygon_n",
+                       utc_map_view_add_polygon_n, i);
+               __test_add_func_load("/api/map_view/add_circle_p",
+                       utc_map_view_add_circle_p, i);
+               __test_add_func_load("/api/map_view/add_circle_n",
+                       utc_map_view_add_circle_n, i);
+               __test_add_func_load("/api/map_view/add_text_p",
+                       utc_map_view_add_text_p, i);
+               __test_add_func_load("/api/map_view/add_text_n",
+                       utc_map_view_add_text_n, i);
+               __test_add_func_load("/api/map_view/add_object_p",
+                       utc_map_view_add_object_p, i);
+               __test_add_func_load("/api/map_view/add_object_n",
+                       utc_map_view_add_object_n, i);
+               __test_add_func_load("/api/map_view/add_objects_p",
+                       utc_map_view_add_objects_p, i);
+               __test_add_func_load("/api/map_view/add_objects_n",
+                       utc_map_view_add_objects_n, i);
+               __test_add_func_load("/api/map_view/remove_object_p",
+                       utc_map_view_remove_object_p, i);
+               __test_add_func_load("/api/map_view/remove_object_n",
+                       utc_map_view_remove_object_n, i);
+               __test_add_func_load("/api/map_view/foreach_object_p",
+                       utc_map_view_foreach_object_p, i);
+               __test_add_func_load("/api/map_view/foreach_object_n",
+                       utc_map_view_foreach_object_n, i);
+       }
 #endif
 }
 
+static void __add_map_object_tests(int i)
+{
+#ifndef SUPPRESS_VALGRIND_WARNINGS     /* Valgrind warnings!!! */
+
+               if(1) {         /* Maps View Object */
+
+                       /* Common Features */
+               __test_add_func_load("/api/map_object/create_destroy_p",
+                                    utc_map_object_create_p, i);
+               __test_add_func_load("/api/map_object/create_destroy_n",
+                                    utc_map_object_create_n, i);
+               __test_add_func_load("/api/map_object/get_type_p",
+                                    utc_map_object_get_type_p, i);
+               __test_add_func_load("/api/map_object/get_type_n",
+                                    utc_map_object_get_type_n, i);
+               __test_add_func_load("/api/map_object/move_p",
+                                    utc_map_object_move_p, i);
+               __test_add_func_load("/api/map_object/move_n",
+                                    utc_map_object_move_n, i);
+               __test_add_func_load("/api/map_object/set_visible_p",
+                                    utc_map_object_set_visible_p, i);
+               __test_add_func_load("/api/map_object/set_visible_n",
+                                    utc_map_object_set_visible_n, i);
+               __test_add_func_load("/api/map_object/get_visible_p",
+                                    utc_map_object_get_visible_p, i);
+               __test_add_func_load("/api/map_object/get_visible_n",
+                                    utc_map_object_get_visible_n, i);
+               __test_add_func_load("/api/map_object/hit_test_p",
+                                    utc_map_object_hit_test_p, i);
+               __test_add_func_load("/api/map_object/hit_test_n",
+                                    utc_map_object_hit_test_n, i);
+
+               /* Layer */
+               __test_add_func_load("/api/map_object/group/add_object_p",
+                                    utc_map_object_group_add_object_p, i);
+               __test_add_func_load("/api/map_object/group/add_object_n",
+                                    utc_map_object_group_add_object_n, i);
+               __test_add_func_load("/api/map_object/group/set_objects_p",
+                            utc_map_object_group_set_objects_p, i);
+               __test_add_func_load("/api/map_object/group/set_objects_n",
+                            utc_map_object_group_set_objects_n, i);
+               __test_add_func_load("/api/map_object/group/rem_object_p",
+                            utc_map_object_group_remove_object_p, i);
+               __test_add_func_load("/api/map_object/group/rem_object_n",
+                            utc_map_object_group_remove_object_n, i);
+               __test_add_func_load("/api/map_object/group/foreach_p",
+                            utc_map_object_group_foreach_object_p, i);
+               __test_add_func_load("/api/map_object/group/foreach_n",
+                            utc_map_object_group_foreach_object_n, i);
+
+               /* Poly: common for polygon and polyline */
+               __test_add_func_load("/api/map_object/poly/add_point_p",
+                                    utc_map_object_poly_add_point_p, i);
+               __test_add_func_load("/api/map_object/poly/add_point_n",
+                                    utc_map_object_poly_add_point_n, i);
+               __test_add_func_load("/api/map_object/poly/set_points_p",
+                                    utc_map_object_poly_set_points_p, i);
+               __test_add_func_load("/api/map_object/poly/set_points_n",
+                                    utc_map_object_poly_set_points_n, i);
+               __test_add_func_load("/api/map_object/poly/foreach_p",
+                               utc_map_object_poly_foreach_point_p, i);
+               __test_add_func_load("/api/map_object/poly/foreach_n",
+                               utc_map_object_poly_foreach_point_n, i);
+
+               /* Polyline */
+               __test_add_func_load("/api/map_object/polyline/set_clr_p",
+                               utc_map_object_polyline_set_color_p, i);
+               __test_add_func_load("/api/map_object/polyline/set_clr_n",
+                               utc_map_object_polyline_set_color_n, i);
+               __test_add_func_load("/api/map_object/polyline/get_clr_p",
+                               utc_map_object_polyline_get_color_p, i);
+               __test_add_func_load("/api/map_object/polyline/get_clr_n",
+                               utc_map_object_polyline_get_color_n, i);
+               __test_add_func_load("/api/map_object/polyline/set_wdt_p",
+                               utc_map_object_polyline_set_width_p, i);
+               __test_add_func_load("/api/map_object/polyline/set_wdt_n",
+                               utc_map_object_polyline_set_width_n, i);
+               __test_add_func_load("/api/map_object/polyline/get_wdt_p",
+                               utc_map_object_polyline_get_width_p, i);
+               __test_add_func_load("/api/map_object/polyline/get_wdt_n",
+                               utc_map_object_polyline_get_width_n, i);
+
+               /* Polygon */
+               __test_add_func_load("/api/map_object/polygon/set_clr_p",
+                       utc_map_object_polygon_set_fill_color_p, i);
+               __test_add_func_load("/api/map_object/polygon/set_clr_n",
+                       utc_map_object_polygon_set_fill_color_n, i);
+               __test_add_func_load("/api/map_object/polygon/get_clr_p",
+                       utc_map_object_polygon_get_fill_color_p, i);
+               __test_add_func_load("/api/map_object/polygon/get_clr_n",
+                       utc_map_object_polygon_get_fill_color_n, i);
+
+               /* Marker */
+               __test_add_func_load("/api/map_object/marker/set_coords_p",
+                       utc_map_object_marker_set_coordinates_p, i);
+               __test_add_func_load("/api/map_object/marker/set_coords_n",
+                       utc_map_object_marker_set_coordinates_n, i);
+               __test_add_func_load("/api/map_object/marker/get_coords_p",
+                       utc_map_object_marker_get_coordinates_p, i);
+               __test_add_func_load("/api/map_object/marker/get_coords_n",
+                       utc_map_object_marker_get_coordinates_n, i);
+               __test_add_func_load("/api/map_object/marker/set_scrsz_p",
+                       utc_map_object_marker_set_screen_size_p, i);
+               __test_add_func_load("/api/map_object/marker/set_scrsz_n",
+                       utc_map_object_marker_set_screen_size_n, i);
+               __test_add_func_load("/api/map_object/marker/get_scrsz_p",
+                       utc_map_object_marker_get_screen_size_p, i);
+               __test_add_func_load("/api/map_object/marker/get_scrsz_n",
+                       utc_map_object_marker_get_screen_size_n, i);
+               __test_add_func_load("/api/map_object/marker/set_file_p",
+                       utc_map_object_marker_set_file_path_p, i);
+               __test_add_func_load("/api/map_object/marker/set_file_n",
+                       utc_map_object_marker_set_file_path_n, i);
+               __test_add_func_load("/api/map_object/marker/get_file_p",
+                       utc_map_object_marker_get_image_file_p, i);
+               __test_add_func_load("/api/map_object/marker/get_file_n",
+                       utc_map_object_marker_get_image_file_n, i);
+               __test_add_func_load("/api/map_object/marker/set_type_p",
+                                    utc_map_object_marker_set_type_p, i);
+               __test_add_func_load("/api/map_object/marker/set_type_n",
+                                    utc_map_object_marker_set_type_n, i);
+               __test_add_func_load("/api/map_object/marker/get_type_p",
+                                    utc_map_object_marker_get_type_p, i);
+               __test_add_func_load("/api/map_object/marker/get_type_n",
+                                    utc_map_object_marker_get_type_n, i);
+               __test_add_func_load("/api/map_object/marker/set_text_p",
+                                    utc_map_object_marker_set_text_p, i);
+               __test_add_func_load("/api/map_object/marker/set_text_n",
+                                    utc_map_object_marker_set_text_n, i);
+               __test_add_func_load("/api/map_object/marker/get_text_p",
+                                    utc_map_object_marker_get_text_p, i);
+               __test_add_func_load("/api/map_object/marker/get_text_n",
+                                    utc_map_object_marker_get_text_n, i);
+       }
+
+#endif
+}
+
+static void __add_map_event_data_tests(int i)
+{
+#ifndef SUPPRESS_VALGRIND_WARNINGS     /* Valgrind warnings!!! */
+       if (1) {
+               /* Common Features */
+               __test_add_func_load("/api/map_event_data/create_destroy_p",
+                                    utc_map_event_data_create_p, i);
+               __test_add_func_load("/api/map_event_data/create_destroy_n",
+                                    utc_map_event_data_create_n, i);
+
+               __test_add_func_load("/api/map_event_data/clone_p",
+                                    utc_map_event_data_clone_p, i);
+               __test_add_func_load("/api/map_event_data/clone_n",
+                                    utc_map_event_data_clone_n, i);
+
+               __test_add_func_load("/api/map_event_data/get_type_p",
+                                    utc_map_event_data_get_type_p, i);
+               __test_add_func_load("/api/map_event_data/get_type_n",
+                                    utc_map_event_data_get_type_n, i);
+
+               __test_add_func_load("/api/map_event_data/get_gesture_type_p",
+                                    utc_map_event_data_get_gesture_type_p, i);
+               __test_add_func_load("/api/map_event_data/get_gesture_type_n",
+                                    utc_map_event_data_get_gesture_type_n, i);
+
+               __test_add_func_load("/api/map_event_data/get_action_type_p",
+                                    utc_map_event_data_get_action_type_p, i);
+               __test_add_func_load("/api/map_event_data/get_action_type_n",
+                                    utc_map_event_data_get_action_type_n, i);
+
+               __test_add_func_load("/api/map_event_data/get_center_p",
+                                    utc_map_event_data_get_center_p, i);
+               __test_add_func_load("/api/map_event_data/get_center_n",
+                                    utc_map_event_data_get_center_n, i);
+
+               __test_add_func_load("/api/map_event_data/get_delta_p",
+                                    utc_map_event_data_get_delta_p, i);
+               __test_add_func_load("/api/map_event_data/get_delta_n",
+                                    utc_map_event_data_get_delta_n, i);
+
+               __test_add_func_load("/api/map_event_data/get_xy_p",
+                                    utc_map_event_data_get_xy_p, i);
+               __test_add_func_load("/api/map_event_data/get_xy_n",
+                                    utc_map_event_data_get_xy_n, i);
+
+               __test_add_func_load("/api/map_event_data/get_fingers_p",
+                                    utc_map_event_data_get_fingers_p, i);
+               __test_add_func_load("/api/map_event_data/get_fingers_n",
+                                    utc_map_event_data_get_fingers_n, i);
+
+               __test_add_func_load("/api/map_event_data/get_zoom_factor_p",
+                                    utc_map_event_data_get_zoom_factor_p, i);
+               __test_add_func_load("/api/map_event_data/get_zoom_factor_n",
+                                    utc_map_event_data_get_zoom_factor_n, i);
+
+               __test_add_func_load("/api/map_event_data/get_rotation_angle_p",
+                                    utc_map_event_data_get_rotation_angle_p, i);
+               __test_add_func_load("/api/map_event_data/get_rotation_angle_n",
+                                    utc_map_event_data_get_rotation_angle_n, i);
+
+               __test_add_func_load("/api/map_event_data/get_object_p",
+                                    utc_map_event_data_get_object_p, i);
+               __test_add_func_load("/api/map_event_data/get_object_n",
+                                    utc_map_event_data_get_object_n, i);
+
+       }
+#endif
+}
+
+static void __add_view_tools_tests(int i)
+{
+#ifndef SUPPRESS_VALGRIND_WARNINGS     /* Valgrind warnings!!! */
+
+       if (1) { /* Hit Test */
+               __test_add_func_load("/api/view_tools/hit_test_bnd_box_p",
+                       utc_poly_shape_hit_test_hit_test_bounding_box_p, i);
+               __test_add_func_load("/api/view_tools/hit_test_bnd_box_n",
+                       utc_poly_shape_hit_test_hit_test_bounding_box_n, i);
+
+               __test_add_func_load("/api/view_tools/hit_test_polyline_p",
+                               utc_poly_shape_hit_test_hit_test_polyline_p, i);
+               __test_add_func_load("/api/view_tools/hit_test_polyline_n",
+                               utc_poly_shape_hit_test_hit_test_polyline_n, i);
+
+               __test_add_func_load("/api/view_tools/hit_test_segment_p",
+                               utc_poly_shape_hit_test_hit_test_segment_p, i);
+               __test_add_func_load("/api/view_tools/hit_test_segment_n",
+                               utc_poly_shape_hit_test_hit_test_segment_n, i);
+
+               __test_add_func_load("/api/view_tools/hit_test_vertices_p",
+                               utc_poly_shape_hit_test_hit_test_vertices_p, i);
+               __test_add_func_load("/api/view_tools/hit_test_vertices_n",
+                               utc_poly_shape_hit_test_hit_test_vertices_n, i);
+
+               __test_add_func_load("/api/view_tools/hit_test_pnpoly_p",
+                                    utc_poly_shape_hit_test_pnpoly_p, i);
+               __test_add_func_load("/api/view_tools/hit_test_pnpoly_n",
+                                    utc_poly_shape_hit_test_pnpoly_n, i);
+
+               __test_add_func_load("/api/view_tools/hit_test_p",
+                                    utc_poly_shape_hit_test_hit_test_p, i);
+               __test_add_func_load("/api/view_tools/hit_test_p2",
+                                    utc_poly_shape_hit_test_hit_test_p2, i);
+               __test_add_func_load("/api/view_tools/hit_test_n",
+                                    utc_poly_shape_hit_test_hit_test_n, i);
+       }
+
+       if (1) { /* Construct Marker */
+               __test_add_func_load("/api/view_tools/construct_marker_p",
+                                    utc_construct_marker_p, i);
+               __test_add_func_load("/api/view_tools/construct_marker_n",
+                                    utc_construct_marker_n, i);
+       }
+
+       if (1) { /* Construct Polygon */
+               __test_add_func_load("/api/view_tools/construct_polygon_p",
+                                    utc_construct_polygon_p, i);
+               __test_add_func_load("/api/view_tools/construct_polygon_n",
+                                    utc_construct_polygon_n, i);
+       }
+
+       if (1) { /* Construct Polyline */
+               __test_add_func_load("/api/view_tools/construct_polyline_p",
+                                    utc_construct_polyline_p, i);
+               __test_add_func_load("/api/view_tools/construct_polyline_n",
+                                    utc_construct_polyline_n, i);
+       }
+
+       if (1) { /* Construct Route */
+#ifdef TIZEN_3_0_NEXT_MS
+               __test_add_func_load("/api/view_tools/construct_route_p",
+                                    utc_construct_route_p, i);
+               __test_add_func_load("/api/view_tools/construct_route_n",
+                                    utc_construct_route_n, i);
+
+       /* !!! The old marker constructor will be deleted soom!!! */
+#if 0
+               __test_add_func_load("/api/view_tools/get_start_mrkr_file_p",
+                                    utc_get_start_marker_p, i);
+               __test_add_func_load("/api/view_tools/get_finish_mrkr_file_p",
+                                    utc_get_finish_marker_p, i);
+               __test_add_func_load("/api/view_tools/get_default_mrkr_file_p",
+                                    utc_get_default_marker_p, i);
+
+               __test_add_func_load("/api/view_tools/add_marker_p",
+                                    utc_add_marker_p, i);
+               __test_add_func_load("/api/view_tools/add_marker_n",
+                                    utc_add_marker_n, i);
+
+               __test_add_func_load("/api/view_tools/add_start_marker_p",
+                                    utc_add_start_marker_p, i);
+               __test_add_func_load("/api/view_tools/add_start_marker_n",
+                                    utc_add_start_marker_n, i);
+               __test_add_func_load("/api/view_tools/add_finish_marker_p",
+                                    utc_add_finish_marker_p, i);
+               __test_add_func_load("/api/view_tools/add_finish_marker_n",
+                                    utc_add_finish_marker_n, i);
+
+               __test_add_func_load("/api/view_tools/add_trajectory_p",
+                                    utc_add_trajectory_p, i);
+               __test_add_func_load("/api/view_tools/add_trajectory_n",
+                                    utc_add_trajectory_n, i);
+
+               __test_add_func_load("/api/view_tools/add_trajectory_markers_p",
+                                    utc_add_trajectory_markers_p, i);
+               __test_add_func_load("/api/view_tools/add_trajectory_markers_n",
+                                    utc_add_trajectory_markers_n, i);
+
+               __test_add_func_load("/api/view_tools/add_route_path_p",
+                                    utc_add_route_path_p, i);
+               __test_add_func_load("/api/view_tools/add_route_path_n",
+                                    utc_add_route_path_n, i);
+
+               __test_add_func_load("/api/view_tools/collect_path_points_p",
+                                    utc_collect_path_points_p, i);
+               __test_add_func_load("/api/view_tools/collect_path_points_n",
+                                    utc_collect_path_points_n, i);
+
+               __test_add_func_load("/api/view_tools/add_route_segments_p",
+                                    utc_add_route_segments_p, i);
+               __test_add_func_load("/api/view_tools/add_route_segments_n",
+                                    utc_add_route_segments_n, i);
+
+               __test_add_func_load("/api/view_tools/collect_segments_p",
+                                    utc_collect_segments_p, i);
+               __test_add_func_load("/api/view_tools/collect_segments_n",
+                                    utc_collect_segments_n, i);
+#endif
+#endif /* TIZEN_3_0_NEXT_MS */
+       }
+
+#endif
+}
+
+
 int main(int argc, char **argv)
 {
        /* Testing the tutorial */
@@ -995,53 +1529,70 @@ int main(int argc, char **argv)
        while (iterations-- > 0) {
 
                /* Simple Test */
-               if (1)
+               if (0)
                        __test_add_func_load("/techno/simple_test",
                                __utc_simple_test, i);
 
                /* Plugin Management */
-               if (1)
+               if (0)
                        __add_plugin_tests(i);
 
                /* Session Management */
-               if (1)
+               if (0)
                        __add_session_tests(i);
 
                /* API: Extra Data Structures: List */
-               if (1)
+               if (0)
                        __add_extra_data_structure_tests(i);
 
                /* API: Maps Data Structures: Coordinates, Area */
-               if (1)
+               if (0)
                        __add_maps_data_structure_tests(i);
 
                /* API: Geocode Data Structures: Address */
-               if (1)
+               if (0)
                        __add_geocode_data_structure_tests(i);
 
                /* API: Place Data Structures: Category, Attribute, Contact,
                *  Editorial, Link Object, Media, URL, Review, Rating, Image,
                *  Filter Place */
-               if (1)
+               if (0)
                        __add_place_data_structure_tests(i);
 
                /* API: Route Data Structures: Maneuver, Segment, Route */
-               if (1)
+               if (0)
                        __add_route_data_structure_tests(i);
 
                /* API: Preference Data Structure */
-               if (1)
+               if (0)
                        __add_preference_data_structure_tests(i);
 
                /* API: Preference and Capabilities, Geocode, Place, Route */
-               if (1)
+               if (0)
                        __add_maps_api_tests(i);
 
+               /* API: Maps View */
+               if (1)
+                       __add_map_view_api_tests(i);
+
+               /* API: Maps View Object */
+               if (1)
+                       __add_map_object_tests(i);
+
+               /* API: Maps View Event Data */
+               if (1)
+                       __add_map_event_data_tests(i);
+
+               /* View Tools: Poly Data Hit Test, View Object Constructors */
+               if (1)
+                       __add_view_tools_tests(i);
+
+
                i++;
 
 #ifdef MAPS_SERVICE_LOAD_TEST
                if (sleep_microseconds > 0)
-                       usleep(sleep_microseconds);
+                       g_usleep(sleep_microseconds);
 #endif                         /* MAPS_SERVICE_LOAD_TEST */
        }
 
index e9584cbf27a20b0660f670718cdbd9fe9e5f01d9..617b3f1b6ff199e783c7654685fdf43cd2449ade 100755 (executable)
@@ -43,12 +43,16 @@ class test_env
 
                plugin = __extract_plugin(m);
                g_assert(plugin);
+#ifdef _MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_
                queue = plugin->request_queue;
-               if (session::command_queue::is_async())
+
+               /* We are going to use this queue for view commands */
+               /*if (session::command_queue::is_async())
                        g_assert(queue);
                else
-                       g_assert(!queue);
-
+                       g_assert(!queue);*/
+                       g_assert(queue);
+#endif /*_MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_*/
        }
        ~test_env()
        {
@@ -71,6 +75,7 @@ void utc_command_queue_push_p(void)
        cq->push(new session::command_cancel_request(e.m, -1));
        e.plugin->is_working = false;
 
+#ifdef _MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_
        if (session::command_queue::is_async())
                g_assert_cmpint(g_async_queue_length(e.queue), ==, 1);
 
@@ -78,6 +83,7 @@ void utc_command_queue_push_p(void)
        if (session::command_queue::is_async())
                if (c)
                        delete c;
+#endif /* _MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_ */
 }
 
 void utc_command_queue_push_n(void)
index aaa14728357632d0c39b3e3c2a40df85428051ca..2b31c21705ff5d25c2c8687ca1ea999c47e3ddd1 100644 (file)
@@ -33,7 +33,7 @@ bool __equal_double(const double &d1, const double &d2)
 /* Simple type library, helpful for operating with Maps Objects */
 
 /* Coordinates */
- maps::coordinates::coordinates():object(NULL)
+maps::coordinates::coordinates():object(NULL)
 {
 }
 
@@ -52,7 +52,7 @@ maps::coordinates::coordinates(const coordinates & c):object(NULL)
        *this = c;
 }
 
-maps::coordinates & maps::coordinates::operator=(const coordinates & c)
+maps::coordinates &maps::coordinates::operator=(const coordinates & c)
 {
        if (this != &c) {
                maps_coordinates_destroy(handle);
index 0d143f645da0af807f77d1beebd6606898eecc51..e724051c8611c7a04d50d3efcec89d3c221fc7b5 100644 (file)
@@ -25,6 +25,9 @@ void __utc_print_error_string(int error)
        case MAPS_ERROR_NONE:
                g_print("MAPS_ERROR_NONE\n");
                break;
+       case MAPS_ERROR_PERMISSION_DENIED:
+               g_print("MAPS_ERROR_PERMISSION_DENIED\n");
+               break;
        case MAPS_ERROR_OUT_OF_MEMORY:
                g_print("MAPS_ERROR_OUT_OF_MEMORY\n");
                break;
diff --git a/test/src/view/gesture_test.cpp b/test/src/view/gesture_test.cpp
new file mode 100644 (file)
index 0000000..67800ae
--- /dev/null
@@ -0,0 +1,83 @@
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "gesture_test.h"
+#include "gesture_processor.h"
+#include <glib.h>
+
+
+void utc_test_gesture_pan_p(void)
+{
+}
+void utc_test_gesture_pan_n(void)
+{
+}
+
+void utc_test_gesture_flick_p(void)
+{
+}
+void utc_test_gesture_flick_n(void)
+{
+}
+
+void utc_test_gesture_pinch_p(void)
+{
+}
+void utc_test_gesture_pinch_n(void)
+{
+}
+
+void utc_test_gesture_tap_p(void)
+{
+}
+void utc_test_gesture_tap_n(void)
+{
+}
+
+void utc_test_gesture_double_tap_p(void)
+{
+}
+void utc_test_gesture_double_tap_n(void)
+{
+}
+
+void utc_test_gesture_double_tap_p(void)
+{
+}
+void utc_test_gesture_double_tap_n(void)
+{
+}
+
+void utc_test_gesture_two_finger_tap_p(void)
+{
+}
+void utc_test_gesture_two_finger_tap_n(void)
+{
+}
+
+void utc_test_gesture_zoom_rotate_p(void)
+{
+}
+void utc_test_gesture_zoom_rotate_n(void)
+{
+}
+
+void utc_test_gesture_press_p(void)
+{
+}
+void utc_test_gesture_press_n(void)
+{
+}
diff --git a/test/src/view/gesture_test.h b/test/src/view/gesture_test.h
new file mode 100644 (file)
index 0000000..36118a0
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MAPS_VIEW_TEST_GESTURE_H__
+#define __MAPS_VIEW_TEST_GESTURE_H__
+
+
+void utc_test_gesture_pan_p(void);
+void utc_test_gesture_pan_n(void);
+
+void utc_test_gesture_flick_p(void);
+void utc_test_gesture_flick_n(void);
+
+void utc_test_gesture_pinch_p(void);
+void utc_test_gesture_pinch_n(void);
+
+void utc_test_gesture_tap_p(void);
+void utc_test_gesture_tap_n(void);
+
+void utc_test_gesture_double_tap_p(void);
+void utc_test_gesture_double_tap_n(void);
+
+void utc_test_gesture_double_tap_p(void);
+void utc_test_gesture_double_tap_n(void);
+
+void utc_test_gesture_two_finger_tap_p(void);
+void utc_test_gesture_two_finger_tap_n(void);
+
+void utc_test_gesture_zoom_rotate_p(void);
+void utc_test_gesture_zoom_rotate_n(void);
+
+void utc_test_gesture_press_p(void);
+void utc_test_gesture_press_n(void);
+
+
+#endif /* __MAPS_VIEW_TEST_GESTURE_H__ */
diff --git a/test/src/view/marker_constructor_test.cpp b/test/src/view/marker_constructor_test.cpp
new file mode 100644 (file)
index 0000000..0a2ec69
--- /dev/null
@@ -0,0 +1,88 @@
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "marker_constructor_test.h"
+#include "marker_constructor.h"
+#include "maps_object.h"
+#include <glib.h>
+
+
+void utc_construct_marker_p(void)
+{
+       /* Construct a marker */
+       view::marker_constructor mc;
+       map_object_h marker = mc.construct(maps::coordinates(10.1, 20.1),
+                                          "test_marker.png",
+                                          MAP_MARKER_POI);
+       g_assert_cmpint(mc.get_error(), ==, MAPS_ERROR_NONE);
+       g_assert(marker);
+
+       /* Check Marker Coordinates */
+       maps_coordinates_h coords = NULL;
+       int error = map_object_marker_get_coordinates(marker, &coords);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       double lat = 0, lon = 0;
+       error = maps_coordinates_get_latitude_longitude(coords, &lat, &lon);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert_cmpfloat(lat, >, 10.);
+       g_assert_cmpfloat(lon, >, 20.);
+       error = maps_coordinates_destroy(coords);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       /* Check Marker Image File */
+       char *file_path = NULL;
+       error = map_object_marker_get_image_file(marker, &file_path);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert(file_path);
+       g_assert_cmpstr(file_path, ==, "test_marker.png");
+       g_free(file_path);
+
+       /* Check Marker Type */
+       map_marker_type_e type = MAP_MARKER_NONE;
+       error = map_object_marker_get_type(marker, &type);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert_cmpint(type, ==, MAP_MARKER_POI);
+
+       error = map_object_destroy(marker);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_construct_marker_n(void)
+{
+       view::marker_constructor mc;
+
+       /* Negative Test 1 */
+       map_object_h marker = mc.construct(NULL,
+                                          "test_marker.png",
+                                          MAP_MARKER_POI);
+       g_assert_cmpint(mc.get_error(), ==, MAPS_ERROR_INVALID_PARAMETER);
+       g_assert(!marker);
+
+       /* Negative Test 2 */
+       marker = mc.construct(maps::coordinates(10.1, 20.1),
+                             NULL,
+                             MAP_MARKER_POI);
+       g_assert_cmpint(mc.get_error(), ==, MAPS_ERROR_INVALID_PARAMETER);
+       g_assert(!marker);
+
+       /* Negative Test 3 */
+       marker = mc.construct(maps::coordinates(10.1, 20.1),
+                             "test_marker.png",
+                             map_marker_type_e(-2));
+       g_assert_cmpint(mc.get_error(), ==, MAPS_ERROR_INVALID_PARAMETER);
+       g_assert(!marker);
+}
diff --git a/test/src/view/marker_constructor_test.h b/test/src/view/marker_constructor_test.h
new file mode 100644 (file)
index 0000000..9723feb
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MAPS_VIEW_TEST_MARKER_CONSTRUCTOR_H__
+#define __MAPS_VIEW_TEST_MARKER_CONSTRUCTOR_H__
+
+
+void utc_construct_marker_p(void);
+void utc_construct_marker_n(void);
+
+
+#endif /* __MAPS_VIEW_TEST_MARKER_CONSTRUCTOR_H__ */
diff --git a/test/src/view/poly_shape_hit_test_test.cpp b/test/src/view/poly_shape_hit_test_test.cpp
new file mode 100644 (file)
index 0000000..a5329ff
--- /dev/null
@@ -0,0 +1,268 @@
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "poly_shape_hit_test_test.h"
+#include "poly_shape_hit_test.h"
+#include <glib.h>
+
+class utc_poly_shape_hit_test : public view::poly_shape_hit_test {
+public:
+       bool utc_hit_test_bounding_box(const float x, const float y) const;
+       bool utc_hit_test_polyline(const float x, const float y,
+                                  const bool polygon) const;
+       bool utc_hit_test_segment(const float x1, const float y1,
+                                 const float x2, const float y2,
+                                 const float x, const float y) const;
+       bool utc_hit_test_vertices(const float x, const float y) const;
+       bool utc_pnpoly(const float x, const float y) const;
+};
+
+bool utc_poly_shape_hit_test::utc_hit_test_bounding_box(const float x,
+                                              const float y) const
+{
+       return hit_test_bounding_box(x, y);
+}
+
+bool utc_poly_shape_hit_test::utc_hit_test_polyline(const float x, const float y,
+                                          const bool polygon) const
+{
+       return hit_test_polyline(x, y, polygon);
+}
+
+bool utc_poly_shape_hit_test::utc_hit_test_segment(const float x1, const float y1,
+                                         const float x2, const float y2,
+                                         const float x, const float y) const
+{
+       return hit_test_segment(x1, y1, x2, y2, x, y);
+}
+
+bool utc_poly_shape_hit_test::utc_hit_test_vertices(const float x, const float y) const
+{
+       return hit_test_vertices(x, y);
+}
+
+bool utc_poly_shape_hit_test::utc_pnpoly(float x, float y) const
+{
+       return pnpoly(x, y);
+}
+
+/*bool hit_test(const float x, const float y,
+             const bool polygon) const;*/
+void utc_poly_shape_hit_test_hit_test_p(void)
+{
+       utc_poly_shape_hit_test pdt;
+       pdt.add_point(100, 50);
+       pdt.add_point(200, 50);
+       g_assert(pdt.hit_test(150, 50, false));
+}
+
+void utc_poly_shape_hit_test_hit_test_p2(void)
+{
+       utc_poly_shape_hit_test pdt;
+
+       /* \_/ form */
+       float x[] = { 50, 200, 225, 175, 150, 100,  75,  25};
+       float y[] = {250, 250, 100, 100, 200, 200, 100, 100};
+       for(unsigned int i = 0; i < (sizeof(x) / sizeof(x[0])); i ++)
+               pdt.add_point(x[i], y[i]);
+
+       /* Hit test polygon */
+       g_assert(pdt.hit_test(100, 225, true) == true);
+       g_assert(pdt.hit_test(125, 150, true) == false);
+
+       /* Hit test polyline */
+       g_assert(pdt.hit_test(100, 225, false) == false);
+       g_assert(pdt.hit_test(125, 150, false) == false);
+
+       /* Hit test both polygon and polyline to include their vertices */
+       for(unsigned int i = 0; i < (sizeof(x) / sizeof(x[0])); i ++) {
+               g_assert(pdt.hit_test(x[i], y[i], true) == true);
+               g_assert(pdt.hit_test(x[i], y[i], false) == true);
+       }
+}
+
+void utc_poly_shape_hit_test_hit_test_n(void)
+{
+       utc_poly_shape_hit_test pdt;
+       pdt.add_point(100, 50);
+       pdt.add_point(200, 50);
+       g_assert(!pdt.hit_test(150, 65, false));
+}
+
+/*bool hit_test_bounding_box(const float x, const float y) const;*/
+void utc_poly_shape_hit_test_hit_test_bounding_box_p(void)
+{
+       utc_poly_shape_hit_test pdt;
+       pdt.add_point(50, 100);
+       pdt.add_point(200, 50);
+       g_assert(pdt.utc_hit_test_bounding_box(65, 70) == true);
+}
+
+void utc_poly_shape_hit_test_hit_test_bounding_box_n(void)
+{
+       utc_poly_shape_hit_test pdt;
+       pdt.add_point(50, 100);
+       pdt.add_point(200, 50);
+       g_assert(pdt.utc_hit_test_bounding_box(220, 90) == false);
+}
+
+/*bool hit_test_polyline(const float x, const float y,
+                      const bool polygon) const;*/
+void utc_poly_shape_hit_test_hit_test_polyline_p(void)
+{
+       utc_poly_shape_hit_test pdt;
+
+       /* \_/ form */
+       float x[] = { 50, 200, 225, 175, 150, 100,  75,  25};
+       float y[] = {250, 250, 100, 100, 200, 200, 100, 100};
+       for(unsigned int i = 0; i < (sizeof(x) / sizeof(x[0])); i ++)
+               pdt.add_point(x[i], y[i]);
+
+       /* Hit test */
+       g_assert(pdt.utc_hit_test_polyline(125, 250, true) == true);
+       g_assert(pdt.utc_hit_test_polyline(125, 250, false) == true);
+
+       g_assert(pdt.utc_hit_test_polyline(40, 184, true) == true);
+}
+
+void utc_poly_shape_hit_test_hit_test_polyline_n(void)
+{
+       utc_poly_shape_hit_test pdt;
+
+       /* \_/ form */
+       float x[] = { 50, 200, 225, 175, 150, 100,  75,  25};
+       float y[] = {250, 250, 100, 100, 200, 200, 100, 100};
+       for(unsigned int i = 0; i < (sizeof(x) / sizeof(x[0])); i ++)
+               pdt.add_point(x[i], y[i]);
+
+       /* Hit test */
+       g_assert(pdt.utc_hit_test_polyline(125, 270, true) == false);
+       g_assert(pdt.utc_hit_test_polyline(125, 270, false) == false);
+
+       g_assert(pdt.utc_hit_test_polyline(40, 184, false) == false);
+}
+
+
+/*bool hit_test_segment(const float x1, const float y1,
+                     const float x2, const float y2,
+                     const float x, const float y) const;*/
+void utc_poly_shape_hit_test_hit_test_segment_p(void)
+{
+       utc_poly_shape_hit_test pdt;
+       g_assert(pdt.utc_hit_test_segment(50, 100,
+                                          200, 50,
+                                          100, 84) == true);
+
+       g_assert(pdt.utc_hit_test_segment(50, 100,
+                                          200, 50,
+                                          100, 90) == true);
+
+       g_assert(pdt.utc_hit_test_segment(50, 100,
+                                          200, 50,
+                                          100, 77) == true);
+
+       g_assert(pdt.utc_hit_test_segment(50, 100,
+                                          200, 50,
+                                          50, 100) == true);
+
+       g_assert(pdt.utc_hit_test_segment(50, 100,
+                                          200, 50,
+                                          199, 49) == true);
+}
+
+void utc_poly_shape_hit_test_hit_test_segment_n(void)
+{
+       utc_poly_shape_hit_test pdt;
+       g_assert(pdt.utc_hit_test_segment(50, 100,
+                                          200, 50,
+                                          100, 64) == false);
+
+       g_assert(pdt.utc_hit_test_segment(50, 100,
+                                          200, 50,
+                                          30, 64) == false);
+
+       g_assert(pdt.utc_hit_test_segment(50, 100,
+                                          200, 50,
+                                          220, 64) == false);
+}
+
+
+/*bool hit_test_vertices(const float x, const float y) const;*/
+void utc_poly_shape_hit_test_hit_test_vertices_p(void)
+{
+       utc_poly_shape_hit_test pdt;
+
+       /* \_/ form */
+       float x[] = { 50, 200, 225, 175, 150, 100,  75,  25};
+       float y[] = {250, 250, 100, 100, 200, 200, 100, 100};
+       for(unsigned int i = 0; i < (sizeof(x) / sizeof(x[0])); i ++)
+               pdt.add_point(x[i], y[i]);
+
+       /* Hit test */
+       for(unsigned int i = 0; i < (sizeof(x) / sizeof(x[0])); i ++)
+               g_assert(pdt.utc_hit_test_vertices(x[i], y[i]) == true);
+}
+
+void utc_poly_shape_hit_test_hit_test_vertices_n(void)
+{
+       utc_poly_shape_hit_test pdt;
+
+       /* \_/ form */
+       float x[] = { 50, 200, 225, 175, 150, 100,  75,  25};
+       float y[] = {250, 250, 100, 100, 200, 200, 100, 100};
+       for(unsigned int i = 0; i < (sizeof(x) / sizeof(x[0])); i ++)
+               pdt.add_point(x[i], y[i]);
+
+       /* Hit test */
+       for(unsigned int i = 0; i < (sizeof(x) / sizeof(x[0])); i ++)
+               g_assert(pdt.utc_hit_test_vertices(x[i] - 20, y[i]) == false);
+
+
+       for(unsigned int i = 0; i < (sizeof(x) / sizeof(x[0])); i ++)
+               g_assert(pdt.utc_hit_test_vertices(x[i], y[i] - 20) == false);
+
+}
+
+
+/*int pnpoly(float x, float y) const;*/
+void utc_poly_shape_hit_test_pnpoly_p(void)
+{
+       utc_poly_shape_hit_test pdt;
+
+       /* \_/ form */
+       float x[] = { 50, 200, 225, 175, 150, 100,  75,  25};
+       float y[] = {250, 250, 100, 100, 200, 200, 100, 100};
+       for(unsigned int i = 0; i < (sizeof(x) / sizeof(x[0])); i ++)
+               pdt.add_point(x[i], y[i]);
+
+       /* Hit test */
+       g_assert(pdt.utc_pnpoly(100, 225) == true);
+}
+
+void utc_poly_shape_hit_test_pnpoly_n(void)
+{
+       utc_poly_shape_hit_test pdt;
+
+       /* \_/ form */
+       float x[] = { 50, 200, 225, 175, 150, 100,  75,  25};
+       float y[] = {250, 250, 100, 100, 200, 200, 100, 100};
+       for(unsigned int i = 0; i < (sizeof(x) / sizeof(x[0])); i ++)
+               pdt.add_point(x[i], y[i]);
+
+       /* Hit test */
+       g_assert(pdt.utc_pnpoly(125, 150) == false);
+}
+
diff --git a/test/src/view/poly_shape_hit_test_test.h b/test/src/view/poly_shape_hit_test_test.h
new file mode 100644 (file)
index 0000000..20dfea6
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MAPS_VIEW_TEST_POLY_SHAPE_HIT_TEST_H__
+#define __MAPS_VIEW_TEST_POLY_SHAPE_HIT_TEST_H__
+
+
+
+/*bool hit_test(const float x, const float y,
+             const bool polygon) const;*/
+void utc_poly_shape_hit_test_hit_test_p(void);
+void utc_poly_shape_hit_test_hit_test_p2(void);
+void utc_poly_shape_hit_test_hit_test_n(void);
+
+/*bool hit_test_bounding_box(const float x, const float y) const;*/
+void utc_poly_shape_hit_test_hit_test_bounding_box_p(void);
+void utc_poly_shape_hit_test_hit_test_bounding_box_n(void);
+
+/*bool hit_test_polyline(const float x, const float y,
+                      const bool polygon) const;*/
+void utc_poly_shape_hit_test_hit_test_polyline_p(void);
+void utc_poly_shape_hit_test_hit_test_polyline_n(void);
+
+/*bool hit_test_segment(const float x1, const float y1,
+                     const float x2, const float y2,
+                     const float x, const float y) const;*/
+void utc_poly_shape_hit_test_hit_test_segment_p(void);
+void utc_poly_shape_hit_test_hit_test_segment_n(void);
+
+/*bool hit_test_vertices(const float x, const float y) const;*/
+void utc_poly_shape_hit_test_hit_test_vertices_p(void);
+void utc_poly_shape_hit_test_hit_test_vertices_n(void);
+
+/*int pnpoly(float x, float y) const;*/
+void utc_poly_shape_hit_test_pnpoly_p(void);
+void utc_poly_shape_hit_test_pnpoly_n(void);
+
+#endif /* __MAPS_VIEW_TEST_POLY_SHAPE_HIT_TEST_H__ */
diff --git a/test/src/view/polygon_constructor_test.cpp b/test/src/view/polygon_constructor_test.cpp
new file mode 100644 (file)
index 0000000..39c5b17
--- /dev/null
@@ -0,0 +1,90 @@
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "polygon_constructor_test.h"
+#include "polygon_constructor.h"
+#include "maps_object.h"
+#include <glib.h>
+
+
+static bool __utc_map_object_poly_point_cb(int index, int total,
+                                               maps_coordinates_h point,
+                                               void *user_data)
+{
+       if(user_data) {
+               int *iterations = (int *)user_data;
+               *iterations = *iterations + 1;
+       }
+       int error = maps_coordinates_destroy(point);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       return true;
+}
+
+void utc_construct_polygon_p(void)
+{
+       /* Construct polygon */
+       view::polygon_constructor pc;
+
+       maps_coordinates_list_h path = NULL;
+       maps_coordinates_list_create(&path);
+       double lats[] = {-85, -75, -65, -50, -40, -30, -45};
+       double lons[] = { 80, 110, 100,  90,  70,  80, 140};
+       for(unsigned int i = 0; i < (sizeof(lats) / sizeof(lats[0])); i ++) {
+               maps_coordinates_h c = NULL;
+               maps_coordinates_create(lats[i], lons[i], &c);
+               maps_coordinates_list_append(path, c);
+               maps_coordinates_destroy(c);
+       }
+
+       map_object_h polygon = pc.construct(path, 0x01, 0x02, 0x03, 0x04);
+       g_assert_cmpint(pc.get_error(), ==, MAPS_ERROR_NONE);
+       g_assert(polygon);
+
+       maps_coordinates_list_destroy(path);
+
+       /* Check Polygon path */
+       int iterations = 0;
+       int error = map_object_polygon_foreach_point(polygon,
+                                      __utc_map_object_poly_point_cb,
+                                      &iterations);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert_cmpint(iterations, ==, 7);
+
+       /* Check fill color */
+       unsigned char r = 0;
+       unsigned char g = 0;
+       unsigned char b = 0;
+       unsigned char a = 0;
+       error = map_object_polygon_get_fill_color(polygon, &r, &g, &b, &a);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert_cmpint(r, ==, 0x01);
+       g_assert_cmpint(g, ==, 0x02);
+       g_assert_cmpint(b, ==, 0x03);
+       g_assert_cmpint(a, ==, 0x04);
+
+
+       error = map_object_destroy(polygon);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_construct_polygon_n(void)
+{
+       view::polygon_constructor pc;
+
+       map_object_h polygon = pc.construct(NULL, 0x01, 0x02, 0x03, 0x04);
+       g_assert_cmpint(pc.get_error(), ==, MAPS_ERROR_INVALID_PARAMETER);
+       g_assert(!polygon);
+}
diff --git a/test/src/view/polygon_constructor_test.h b/test/src/view/polygon_constructor_test.h
new file mode 100644 (file)
index 0000000..10a65e5
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MAPS_VIEW_TEST_POLYGON_CONSTRUCTOR_H__
+#define __MAPS_VIEW_TEST_POLYGON_CONSTRUCTOR_H__
+
+
+void utc_construct_polygon_p(void);
+void utc_construct_polygon_n(void);
+
+
+#endif /* __MAPS_VIEW_TEST_POLYGON_CONSTRUCTOR_H__ */
diff --git a/test/src/view/polyline_constructor_test.cpp b/test/src/view/polyline_constructor_test.cpp
new file mode 100644 (file)
index 0000000..081bdbc
--- /dev/null
@@ -0,0 +1,107 @@
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "polyline_constructor_test.h"
+#include "polyline_constructor.h"
+#include "maps_object.h"
+#include <glib.h>
+
+
+static bool __utc_map_object_poly_point_cb(int index, int total,
+                                               maps_coordinates_h point,
+                                               void *user_data)
+{
+       if(user_data) {
+               int *iterations = (int *)user_data;
+               *iterations = *iterations + 1;
+       }
+       int error = maps_coordinates_destroy(point);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       return true;
+}
+
+void utc_construct_polyline_p(void)
+{
+       /* Construct polyline */
+       view::polyline_constructor pc;
+
+       maps_coordinates_list_h path = NULL;
+       maps_coordinates_list_create(&path);
+       double lats[] = {-85, -75, -65, -50, -40, -30, -45};
+       double lons[] = { 80, 110, 100,  90,  70,  80, 140};
+       for(unsigned int i = 0; i < (sizeof(lats) / sizeof(lats[0])); i ++) {
+               maps_coordinates_h c = NULL;
+               maps_coordinates_create(lats[i], lons[i], &c);
+               maps_coordinates_list_append(path, c);
+               maps_coordinates_destroy(c);
+       }
+
+       map_object_h polyline = pc.construct(path, 0x01, 0x02, 0x03, 0x04, 3);
+       g_assert_cmpint(pc.get_error(), ==, MAPS_ERROR_NONE);
+       g_assert(polyline);
+
+       maps_coordinates_list_destroy(path);
+
+       /* Check Polygon path */
+       int iterations = 0;
+       int error = map_object_polyline_foreach_point(polyline,
+                                      __utc_map_object_poly_point_cb,
+                                      &iterations);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert_cmpint(iterations, ==, 7);
+
+       /* Check fill color */
+       unsigned char r = 0;
+       unsigned char g = 0;
+       unsigned char b = 0;
+       unsigned char a = 0;
+       error = map_object_polyline_get_color(polyline, &r, &g, &b, &a);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert_cmpint(r, ==, 0x01);
+       g_assert_cmpint(g, ==, 0x02);
+       g_assert_cmpint(b, ==, 0x03);
+       g_assert_cmpint(a, ==, 0x04);
+
+       /* Check line width */
+       int width = 0;
+       error = map_object_polyline_get_width(polyline, &width);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert_cmpint(width, ==, 3);
+
+       error = map_object_destroy(polyline);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_construct_polyline_n(void)
+{
+       view::polyline_constructor pc;
+
+       /* Negative test 1 */
+       map_object_h polyline = pc.construct(NULL, 0x01, 0x02, 0x03, 0x04, 1);
+       g_assert_cmpint(pc.get_error(), ==, MAPS_ERROR_INVALID_PARAMETER);
+       g_assert(!polyline);
+
+
+       /* Negative test 2 */
+       maps_coordinates_list_h path = NULL;
+       maps_coordinates_list_create(&path);
+       maps_coordinates_list_append(path, maps::coordinates(-85, 80));
+       polyline = pc.construct(path, 0x01, 0x02, 0x03, 0x04, -1);
+       g_assert_cmpint(pc.get_error(), ==, MAPS_ERROR_INVALID_PARAMETER);
+       g_assert(!polyline);
+
+       maps_coordinates_list_destroy(path);
+}
diff --git a/test/src/view/polyline_constructor_test.h b/test/src/view/polyline_constructor_test.h
new file mode 100644 (file)
index 0000000..2339666
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MAPS_VIEW_TEST_POLYLINE_CONSTRUCTOR_H__
+#define __MAPS_VIEW_TEST_POLYLINE_CONSTRUCTOR_H__
+
+
+void utc_construct_polyline_p(void);
+void utc_construct_polyline_n(void);
+
+
+#endif /* __MAPS_VIEW_TEST_POLYLINE_CONSTRUCTOR_H__ */
diff --git a/test/src/view/route_constructor_test.cpp b/test/src/view/route_constructor_test.cpp
new file mode 100644 (file)
index 0000000..30f01a3
--- /dev/null
@@ -0,0 +1,685 @@
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "route_constructor_test.h"
+#include "route_constructor.h"
+#include "maps_object.h"
+#include <glib.h>
+
+#ifdef TIZEN_3_0_NEXT_MS
+class utc_route {
+public:
+       maps::route route;
+public:
+       utc_route();
+};
+
+utc_route::utc_route()
+{
+       maps_route_set_origin(route, maps::coordinates(-85.0, 60.0));
+       maps_route_set_destination(route, maps::coordinates(-45.0, 120.0));
+
+       maps::item_list <maps::coordinates> path;
+       path.add(maps::coordinates(-85, 80));
+       path.add(maps::coordinates(-75, 110));
+       path.add(maps::coordinates(-65, 100));
+       path.add(maps::coordinates(-50, 90));
+       path.add(maps::coordinates(-40, 70));
+       path.add(maps::coordinates(-30, 80));
+       path.add(maps::coordinates(-45, 140));
+       maps_route_set_path(route, path);
+
+       maps::item_list <maps::route_maneuver> maneuvers;
+       maps::route_maneuver m1, m2;
+       maneuvers.add(m1);
+       maneuvers.add(m2);
+
+       maps::item_list <maps::route_segment> segments;
+       maps::route_segment s1, s2, s3;
+
+       /* First segment with detailed path */
+       maps_route_segment_set_origin(s1, maps::coordinates(-85.0, 60.0));
+       maps_route_segment_set_destination(s1, maps::coordinates(-65.0, 80.0));
+       maps::item_list <maps::coordinates> s1_path;
+       s1_path.add(maps::coordinates(-85, 60));
+       s1_path.add(maps::coordinates(-79, 55));
+       s1_path.add(maps::coordinates(-75, 60));
+       s1_path.add(maps::coordinates(-73, 85));
+       s1_path.add(maps::coordinates(-69, 95));
+       s1_path.add(maps::coordinates(-65, 80));
+       maps_route_segment_set_path(s1, s1_path);
+       maps_route_segment_set_maneuvers(s1, maneuvers);
+       segments.add(s1);
+
+       maps_route_segment_set_origin(s2, maps::coordinates(-65.0, 80.0));
+       maps_route_segment_set_destination(s2, maps::coordinates(-40.0, 50.0));
+       maps_route_segment_set_maneuvers(s2, maneuvers);
+       segments.add(s2);
+
+       maps_route_segment_set_origin(s3, maps::coordinates(-40.0, 50.0));
+       maps_route_segment_set_destination(s3, maps::coordinates(-45.0, 120.0));
+       maps_route_segment_set_maneuvers(s3, maneuvers);
+       segments.add(s3);
+
+       maps_route_set_segments(route, segments);
+}
+
+void utc_construct_route_p(void)
+{
+       utc_route r;
+
+       /* Construct route view object */
+       view::route_constructor rc;
+
+       map_object_h route_object = rc.construct(NULL,
+                                                     r.route);
+       g_assert_cmpint(rc.get_error(), ==, MAPS_ERROR_NONE);
+       g_assert(route_object);
+
+       /* Check if the route object includes route handle */
+       maps_route_h route_handle = NULL;
+       int error = map_object_route_get_content(route_object,
+                                                     &route_handle);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert(route_handle);
+
+       error = maps_route_destroy(route_handle);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = map_object_destroy(route_object);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_construct_route_n(void)
+{
+       view::route_constructor rc;
+       map_object_h route_object = rc.construct(NULL, NULL);
+       g_assert_cmpint(rc.get_error(), ==, MAPS_ERROR_INVALID_PARAMETER);
+       g_assert(!route_object);
+}
+
+
+
+       /* !!! The old marker constructor will be deleted soom!!! */
+#if 0
+static bool __utc_map_object_group_object_cb(int index, int total,
+                                                 map_object_h object,
+                                                 void *user_data)
+{
+       if(user_data) {
+               int *iterations = (int *)user_data;
+               *iterations = *iterations + 1;
+       }
+       g_assert(object);
+       return true;
+}
+
+void utc_construct_route_p(void)
+{
+       /* Preparing test route */
+       utc_route r;
+
+
+       /* Construct route view object */
+       view::route_constructor rc;
+       map_object_h route_object = rc.construct(r.route);
+       g_assert_cmpint(rc.get_error(), ==, MAPS_ERROR_NONE);
+       g_assert(route_object);
+
+       /* Check if the route object includes route handle */
+       maps_route_h route_handle = NULL;
+       int error = map_object_group_get_route(route_object,
+                                                    &route_handle);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert(route_handle);
+
+       error = maps_route_destroy(route_handle);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       /* Check if route includes several objects */
+       int iterations = 0;
+       error = map_object_group_foreach_object(route_object,
+                                  __utc_map_object_group_object_cb,
+                                  &iterations);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert_cmpint(iterations, >, 0);
+
+       error = map_object_destroy(route_object);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_construct_route_n(void)
+{
+       view::route_constructor rc;
+       map_object_h route_object = rc.construct(NULL);
+       g_assert_cmpint(rc.get_error(), ==, MAPS_ERROR_INVALID_PARAMETER);
+       g_assert(!route_object);
+}
+
+
+/*----------------------------------------------------------------------------*/
+/*void static const char *get_start_marker_image();*/
+void utc_get_start_marker_p(void)
+{
+       g_assert(view::route_constructor::get_start_marker_image());
+}
+
+/*static const char *get_finish_marker_image();*/
+void utc_get_finish_marker_p(void)
+{
+       g_assert(view::route_constructor::get_finish_marker_image());
+}
+
+/*static const char *get_default_marker_image();*/
+void utc_get_default_marker_p(void)
+{
+       g_assert(view::route_constructor::get_default_marker_image());
+}
+
+/*----------------------------------------------------------------------------*/
+class utc_route_constructor : public view::route_constructor {
+public:
+       static int utc_add_marker(map_object_h route_object,
+                                 const maps_coordinates_h coords,
+                                 map_marker_type_e type);
+       void utc_add_start_marker(map_object_h route_object,
+                                 maps_route_h route);
+       void utc_add_finish_marker(map_object_h route_object,
+                                  maps_route_h route);
+
+       static int utc_add_trajectory(map_object_h route_object,
+                                     maps_item_list_h route_points);
+
+       static bool utc_add_trajectory_markers(int index,
+                                              int total,
+                                              void *data,
+                                              void *user_data);
+
+       void utc_add_route_path(map_object_h route_object,
+                               maps_route_h route);
+       static bool utc_collect_path_points(int index, int total,
+                                           maps_coordinates_h coordinates,
+                                           void *user_data);
+
+       void utc_add_route_segments(map_object_h route_object,
+                                   maps_route_h route);
+       static bool utc_collect_segments(int index, int total,
+                                        maps_route_segment_h segment,
+                                        void *user_data);
+};
+
+int utc_route_constructor::utc_add_marker(map_object_h route_object,
+                                         const maps_coordinates_h coords,
+                                         map_marker_type_e type)
+{
+       return add_marker(route_object, coords, type);
+}
+
+void utc_route_constructor::utc_add_start_marker(map_object_h route_object,
+                                                maps_route_h route)
+{
+       add_start_marker(route_object, route);
+}
+
+void utc_route_constructor::utc_add_finish_marker(map_object_h
+                                                 route_object,
+                                                 maps_route_h route)
+{
+       add_finish_marker(route_object, route);
+}
+
+int utc_route_constructor::utc_add_trajectory(map_object_h route_object,
+                                             maps_item_list_h route_points)
+{
+       return add_trajectory(route_object, route_points);
+}
+
+bool utc_route_constructor::utc_add_trajectory_markers(int index,
+                                                      int total,
+                                                      void *data,
+                                                      void *user_data)
+{
+       return add_trajectory_markers(index, total, data, user_data);
+}
+
+void utc_route_constructor::utc_add_route_path(map_object_h route_object,
+                                              maps_route_h route)
+{
+       add_route_path(route_object, route);
+}
+
+bool utc_route_constructor::utc_collect_path_points(int index, int total,
+                                                   maps_coordinates_h
+                                                   coordinates,
+                                                   void *user_data)
+{
+       return collect_path_points(index, total, coordinates, user_data);
+}
+
+void utc_route_constructor::utc_add_route_segments(map_object_h
+                                                  route_object,
+                                                  maps_route_h route)
+{
+       add_route_segments(route_object, route);
+}
+
+bool utc_route_constructor::utc_collect_segments(int index, int total,
+                                                maps_route_segment_h segment,
+                                                void *user_data)
+{
+       return collect_segments(index, total, segment, user_data);
+}
+
+/*----------------------------------------------------------------------------*/
+class test_env
+{
+ public:
+       map_object_h o;
+       int iterations;
+ public:
+       test_env() : o(NULL), iterations(0)
+       {
+               /* Create a test view object */
+               int error = map_object_create(MAP_OBJECT_GROUP, &o);
+               g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+               g_assert(o);
+       }
+       ~test_env()
+       {
+               /* Destroy a test view object */
+               const int error = map_object_destroy(o);
+               g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       }
+};
+
+
+/*----------------------------------------------------------------------------*/
+/*static int add_marker(map_object_h route_object,
+                                      const maps_coordinates_h coords,
+                                      map_marker_type_e type);*/
+void utc_add_marker_p(void)
+{
+       test_env e;
+       utc_route_constructor rc;
+
+       int error = rc.utc_add_marker(e.o,
+                                     maps::coordinates(-85.0, 60.0),
+                                     MAP_MARKER_POI);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = map_object_group_foreach_object(e.o,
+                                  __utc_map_object_group_object_cb,
+                                  &e.iterations);
+       g_assert_cmpint(e.iterations, ==, 1);
+
+}
+void utc_add_marker_n(void)
+{
+       test_env e;
+       utc_route_constructor rc;
+
+       /* Negative test 1 */
+       int error = rc.utc_add_marker(NULL,
+                                     maps::coordinates(-85.0, 60.0),
+                                     MAP_MARKER_POI);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       /* Negative test 2 */
+       error = rc.utc_add_marker(e.o,
+                                 NULL,
+                                 MAP_MARKER_POI);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = map_object_group_foreach_object(e.o,
+                                  __utc_map_object_group_object_cb,
+                                  &e.iterations);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NOT_FOUND);
+       g_assert_cmpint(e.iterations, ==, 0);
+}
+
+/*void add_start_marker(map_object_h route_object,
+                     maps_route_h route);*/
+void utc_add_start_marker_p(void)
+{
+       test_env e;
+       utc_route_constructor rc;
+       utc_route r;
+
+       rc.utc_add_start_marker(e.o, r.route);
+       g_assert_cmpint(rc.get_error(), ==, MAPS_ERROR_NONE);
+
+       int error = map_object_group_foreach_object(e.o,
+                                  __utc_map_object_group_object_cb,
+                                  &e.iterations);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert_cmpint(e.iterations, ==, 1);
+}
+void utc_add_start_marker_n(void)
+{
+       test_env e;
+       utc_route_constructor rc;
+       utc_route r;
+
+       rc.utc_add_start_marker(NULL, r.route);
+       g_assert_cmpint(rc.get_error(), ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       rc.utc_add_start_marker(e.o, NULL);
+       g_assert_cmpint(rc.get_error(), ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       int error = map_object_group_foreach_object(e.o,
+                                  __utc_map_object_group_object_cb,
+                                  &e.iterations);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NOT_FOUND);
+       g_assert_cmpint(e.iterations, ==, 0);
+
+}
+
+/*void add_finish_marker(map_object_h route_object,
+                      maps_route_h route);*/
+void utc_add_finish_marker_p(void)
+{
+       test_env e;
+       utc_route_constructor rc;
+       utc_route r;
+
+       rc.utc_add_finish_marker(e.o, r.route);
+       g_assert_cmpint(rc.get_error(), ==, MAPS_ERROR_NONE);
+
+       int error = map_object_group_foreach_object(e.o,
+                                  __utc_map_object_group_object_cb,
+                                  &e.iterations);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert_cmpint(e.iterations, ==, 1);
+}
+void utc_add_finish_marker_n(void)
+{
+       test_env e;
+       utc_route_constructor rc;
+       utc_route r;
+
+       rc.utc_add_finish_marker(NULL, r.route);
+       g_assert_cmpint(rc.get_error(), ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       rc.utc_add_finish_marker(e.o, NULL);
+       g_assert_cmpint(rc.get_error(), ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       int error = map_object_group_foreach_object(e.o,
+                                  __utc_map_object_group_object_cb,
+                                  &e.iterations);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NOT_FOUND);
+       g_assert_cmpint(e.iterations, ==, 0);
+}
+
+/*static int add_trajectory(map_object_h route_object,
+                         maps_item_list_h route_points);*/
+void utc_add_trajectory_p(void)
+{
+       test_env e;
+       utc_route_constructor rc;
+
+       maps::item_list <maps::coordinates> path;
+       path.add(maps::coordinates(-85, 80));
+       path.add(maps::coordinates(-75, 110));
+       path.add(maps::coordinates(-65, 100));
+
+       int error = rc.utc_add_trajectory(e.o, path);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+       error = map_object_group_foreach_object(e.o,
+                                  __utc_map_object_group_object_cb,
+                                  &e.iterations);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert_cmpint(e.iterations, >=, 3);
+}
+void utc_add_trajectory_n(void)
+{
+       test_env e;
+       utc_route_constructor rc;
+
+       maps::item_list <maps::coordinates> path;
+       path.add(maps::coordinates(-85, 80));
+       path.add(maps::coordinates(-75, 110));
+       path.add(maps::coordinates(-65, 100));
+
+       /* Negative test 1 */
+       int error = rc.utc_add_trajectory(NULL, path);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = rc.utc_add_trajectory(e.o, NULL);
+       g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       error = map_object_group_foreach_object(e.o,
+                                  __utc_map_object_group_object_cb,
+                                  &e.iterations);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NOT_FOUND);
+       g_assert_cmpint(e.iterations, ==, 0);
+}
+
+/*static bool add_trajectory_markers(int index,
+                                  int total,
+                                  void *data,
+                                  void *user_data);*/
+void utc_add_trajectory_markers_p(void)
+{
+       test_env e;
+       utc_route_constructor rc;
+
+       bool ret = rc.utc_add_trajectory_markers(0, 1,
+                                                maps::coordinates(-75, 110),
+                                                e.o);
+       g_assert(ret);
+       int error = map_object_group_foreach_object(e.o,
+                                  __utc_map_object_group_object_cb,
+                                  &e.iterations);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert_cmpint(e.iterations, ==, 1);
+}
+void utc_add_trajectory_markers_n(void)
+{
+       test_env e;
+       utc_route_constructor rc;
+
+       /* Negative test 1 */
+       bool ret = rc.utc_add_trajectory_markers(0, 1, NULL, e.o);
+       g_assert(!ret);
+
+       /* Negative test 2 */
+       ret = rc.utc_add_trajectory_markers(0, 1,
+                                           maps::coordinates(-75, 110),
+                                           NULL);
+       g_assert(!ret);
+
+
+       int error = map_object_group_foreach_object(e.o,
+                                  __utc_map_object_group_object_cb,
+                                  &e.iterations);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NOT_FOUND);
+       g_assert_cmpint(e.iterations, ==, 0);
+}
+
+/*void add_route_path(map_object_h route_object,
+                   maps_route_h route);*/
+void utc_add_route_path_p(void)
+{
+       test_env e;
+       utc_route_constructor rc;
+       utc_route r;
+
+       rc.utc_add_route_path(e.o, r.route);
+       g_assert_cmpint(rc.get_error(), ==, MAPS_ERROR_NONE);
+       int error = map_object_group_foreach_object(e.o,
+                                  __utc_map_object_group_object_cb,
+                                  &e.iterations);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert_cmpint(e.iterations, >, 0);
+}
+void utc_add_route_path_n(void)
+{
+       test_env e;
+       utc_route_constructor rc;
+       utc_route r;
+
+       /* Negative test 1 */
+       rc.utc_add_route_path(NULL, r.route);
+       g_assert_cmpint(rc.get_error(), ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       /* Negative test 2 */
+       rc.utc_add_route_path(e.o, NULL);
+       g_assert_cmpint(rc.get_error(), ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       int error = map_object_group_foreach_object(e.o,
+                                  __utc_map_object_group_object_cb,
+                                  &e.iterations);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NOT_FOUND);
+       g_assert_cmpint(e.iterations, ==, 0);
+}
+
+/*static bool collect_path_points(int index, int total,
+                               maps_coordinates_h coordinates,
+                               void *user_data);*/
+void utc_collect_path_points_p(void)
+{
+       utc_route_constructor rc;
+       maps::item_list <maps::coordinates> path;
+       bool ret = rc.utc_collect_path_points(0, 1,
+                                       maps::coordinates(-75, 110).clone(),
+                                       path);
+       g_assert(ret);
+}
+void utc_collect_path_points_n(void)
+{
+       utc_route_constructor rc;
+       bool ret = rc.utc_collect_path_points(0, 1, NULL, NULL);
+       g_assert(!ret);
+}
+
+/*void add_route_segments(map_object_h route_object,
+                       maps_route_h route);*/
+void utc_add_route_segments_p(void)
+{
+       test_env e;
+       utc_route_constructor rc;
+       utc_route r;
+
+       rc.utc_add_route_segments(e.o, r.route);
+       g_assert_cmpint(rc.get_error(), ==, MAPS_ERROR_NONE);
+
+       int error = map_object_group_foreach_object(e.o,
+                                  __utc_map_object_group_object_cb,
+                                  &e.iterations);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert_cmpint(e.iterations, >, 0);
+}
+void utc_add_route_segments_n(void)
+{
+       test_env e;
+       utc_route_constructor rc;
+       utc_route r;
+
+       /* Negative test 1 */
+       rc.utc_add_route_segments(NULL, r.route);
+       g_assert_cmpint(rc.get_error(), ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       /* Negative test 2 */
+       rc.utc_add_route_segments(e.o, NULL);
+       g_assert_cmpint(rc.get_error(), ==, MAPS_ERROR_INVALID_PARAMETER);
+
+       int error = map_object_group_foreach_object(e.o,
+                                  __utc_map_object_group_object_cb,
+                                  &e.iterations);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NOT_FOUND);
+       g_assert_cmpint(e.iterations, ==, 0);
+}
+
+/*static bool collect_segments(int index, int total,
+                            maps_route_segment_h segment,
+                            void *user_data);*/
+void  utc_collect_segments_p(void)
+{
+       test_env e;
+       utc_route_constructor rc;
+
+       /* Preparing test segment */
+       maps::route_segment s1;
+       maps_route_segment_set_origin(s1, maps::coordinates(-85.0, 60.0));
+       maps_route_segment_set_destination(s1, maps::coordinates(-65.0, 80.0));
+
+       maps::item_list <maps::coordinates> s1_path;
+       s1_path.add(maps::coordinates(-85, 60));
+       s1_path.add(maps::coordinates(-79, 55));
+       s1_path.add(maps::coordinates(-75, 60));
+       s1_path.add(maps::coordinates(-73, 85));
+       s1_path.add(maps::coordinates(-69, 95));
+       s1_path.add(maps::coordinates(-65, 80));
+       maps_route_segment_set_path(s1, s1_path);
+
+       maps::item_list <maps::route_maneuver> maneuvers;
+       maps::route_maneuver m1, m2;
+       maneuvers.add(m1);
+       maneuvers.add(m2);
+       maps_route_segment_set_maneuvers(s1, maneuvers);
+
+       bool ret = rc.utc_collect_segments(0, 1, s1.clone(), e.o);
+       g_assert(ret);
+
+       int error = map_object_group_foreach_object(e.o,
+                                  __utc_map_object_group_object_cb,
+                                  &e.iterations);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+       g_assert_cmpint(e.iterations, >, 0);
+}
+void  utc_collect_segments_n(void)
+{
+       test_env e;
+       utc_route_constructor rc;
+
+       /* Preparing test segment */
+       maps::route_segment s1;
+       maps_route_segment_set_origin(s1, maps::coordinates(-85.0, 60.0));
+       maps_route_segment_set_destination(s1, maps::coordinates(-65.0, 80.0));
+
+       maps::item_list <maps::coordinates> s1_path;
+       s1_path.add(maps::coordinates(-85, 60));
+       s1_path.add(maps::coordinates(-79, 55));
+       s1_path.add(maps::coordinates(-75, 60));
+       s1_path.add(maps::coordinates(-73, 85));
+       s1_path.add(maps::coordinates(-69, 95));
+       s1_path.add(maps::coordinates(-65, 80));
+       maps_route_segment_set_path(s1, s1_path);
+
+       maps::item_list <maps::route_maneuver> maneuvers;
+       maps::route_maneuver m1, m2;
+       maneuvers.add(m1);
+       maneuvers.add(m2);
+       maps_route_segment_set_maneuvers(s1, maneuvers);
+
+       /* Negative test 1 */
+       bool ret = rc.utc_collect_segments(0, 1, NULL, e.o);
+       g_assert(!ret);
+
+       /* Negative test 2 */
+       ret = rc.utc_collect_segments(0, 1, s1.clone(), NULL);
+       g_assert(!ret);
+
+       int error = map_object_group_foreach_object(e.o,
+                                  __utc_map_object_group_object_cb,
+                                  &e.iterations);
+       g_assert_cmpint(error, ==, MAPS_ERROR_NOT_FOUND);
+       g_assert_cmpint(e.iterations, ==, 0);
+}
+#endif
+
+#endif /* TIZEN_3_0_NEXT_MS */
diff --git a/test/src/view/route_constructor_test.h b/test/src/view/route_constructor_test.h
new file mode 100644 (file)
index 0000000..0a5e23d
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MAPS_VIEW_TEST_ROUTE_CONSTRUCTOR_H__
+#define __MAPS_VIEW_TEST_ROUTE_CONSTRUCTOR_H__
+
+
+#ifdef TIZEN_3_0_NEXT_MS
+void utc_construct_route_p(void);
+void utc_construct_route_n(void);
+
+       /* !!! The old marker constructor will be deleted soom!!! */
+#if 0
+/*void static const char *get_start_marker_image();*/
+void utc_get_start_marker_p(void);
+
+/*static const char *get_finish_marker_image();*/
+void utc_get_finish_marker_p(void);
+
+/*static const char *get_default_marker_image();*/
+void utc_get_default_marker_p(void);
+
+/*static int add_marker(map_object_h route_object,
+                                      const maps_coordinates_h coords,
+                                      map_marker_type_e type);*/
+void utc_add_marker_p(void);
+void utc_add_marker_n(void);
+
+/*void add_start_marker(map_object_h route_object,
+                     maps_route_h route);*/
+void utc_add_start_marker_p(void);
+void utc_add_start_marker_n(void);
+
+/*void add_finish_marker(map_object_h route_object,
+                      maps_route_h route);*/
+void utc_add_finish_marker_p(void);
+void utc_add_finish_marker_n(void);
+
+/*static int add_trajectory(map_object_h route_object,
+                         maps_item_list_h route_points);*/
+void utc_add_trajectory_p(void);
+void utc_add_trajectory_n(void);
+
+/*static bool add_trajectory_markers(int index,
+                                  int total,
+                                  void *data,
+                                  void *user_data);*/
+void utc_add_trajectory_markers_p(void);
+void utc_add_trajectory_markers_n(void);
+
+/*void add_route_path(map_object_h route_object,
+                   maps_route_h route);*/
+void utc_add_route_path_p(void);
+void utc_add_route_path_n(void);
+
+/*static bool collect_path_points(int index, int total,
+                               maps_coordinates_h coordinates,
+                               void *user_data);*/
+void utc_collect_path_points_p(void);
+void utc_collect_path_points_n(void);
+
+/*void add_route_segments(map_object_h route_object,
+                       maps_route_h route);*/
+void utc_add_route_segments_p(void);
+void utc_add_route_segments_n(void);
+
+/*static bool collect_segments(int index, int total,
+                            maps_route_segment_h segment,
+                            void *user_data);*/
+void  utc_collect_segments_p(void);
+void  utc_collect_segments_n(void);
+#endif
+
+#endif /* TIZEN_3_0_NEXT_MS */
+
+#endif /* __MAPS_VIEW_TEST_ROUTE_CONSTRUCTOR_H__ */