[ACR-655] Add Overlay object API 26/73926/5 accepted/tizen/common/20160615.193829 accepted/tizen/ivi/20160616.003343 accepted/tizen/mobile/20160616.003412 accepted/tizen/tv/20160616.003310 accepted/tizen/wearable/20160616.003404 submit/tizen/20160615.105814 submit/tizen/20160615.112319
authorjongmun.woo <jongmun.woo@samsung.com>
Fri, 10 Jun 2016 05:36:59 +0000 (14:36 +0900)
committerchanywa <cbible.kim@samsung.com>
Wed, 15 Jun 2016 10:44:05 +0000 (19:44 +0900)
Signed-off-by: jongmun.woo <jongmun.woo@samsung.com>
Change-Id: I41f0c3276ddaefa82bc891a8facb57193cf3776c

CMakeLists.txt
inc/here_api.h
inc/here_place.h
inc/here_view.h
src/here_api.cpp
src/here_plugin.cpp
src/here_view.cpp

index b5b0751..d8d85b2 100644 (file)
@@ -19,7 +19,6 @@ SET(dependents
        evas
        ecore-evas
        elementary
-       vconf
        )
 
 INCLUDE(FindPkgConfig)
index 7ad11ef..6eaacc5 100755 (executable)
@@ -17,7 +17,7 @@
 #define _LOCATION_HERE_API_H_
 
 #include <maps_plugin.h>
-#include <maps_view.h>
+#include <maps_view_plugin.h>
 
 int HerePluginInit(maps_plugin_h *hPlugin, const char *module = NULL);
 
@@ -107,4 +107,6 @@ int HerePluginGetMaxZoomLevel(maps_view_h hView, int *nMaxZoomLevel);
 
 int HerePluginOnViewObject(maps_view_h hView, const maps_view_object_h object, maps_view_object_operation_e operation);
 
+int HerePluginCaptureSnapshot(maps_view_h hView, void **data, int *w, int *h, maps_view_colorspace_type_e *cs);
+
 #endif //_LOCATION_HERE_API_H_
\ No newline at end of file
index c4ea6cb..78a3892 100644 (file)
@@ -30,7 +30,7 @@
 #include <maps_place_link_object_plugin.h>
 #include <maps_place_editorial_plugin.h>
 #include <maps_place_review_plugin.h>
-#include <maps_place_category_plugin.h>
+#include <maps_place_category.h>
 
 //map engine header
 #include <finder/DiscoveryQuery.h>
index 1bc024a..a29884a 100644 (file)
@@ -57,11 +57,15 @@ public:
        here_error_e setScalebarEnabled(maps_view_h view, bool enable);
        here_error_e getScalebarEnabled(maps_view_h view, bool *enabled);
        here_error_e convertScreenToGeolocation(maps_view_h view, int x, int y, maps_coordinates_h *coord);
-       here_error_e convertGeolocationToScreen(maps_view_h view, const maps_coordinates_h coord, int *x, int *y);
+       here_error_e convertGeolocationToScreen(maps_view_h view,
+                                                               const maps_coordinates_h coord, int *x, int *y);
+       here_error_e captureSnapshot(maps_view_h view, void **data, int *width, int *height,
+                                                               maps_view_colorspace_type_e *cs);
 
        here_error_e getMinZoomLevel(maps_view_h view, int *zoom);
        here_error_e getMaxZoomLevel(maps_view_h view, int *zoom);
-       here_error_e onViewObject(maps_view_h view, const maps_view_object_h object, maps_view_object_operation_e operation);
+       here_error_e onViewObject(maps_view_h view, const maps_view_object_h object,
+                                                               maps_view_object_operation_e operation);
 
 private:
        here_error_e initOpenGL();
@@ -72,7 +76,8 @@ private:
        static Eina_Bool __idlerCb(void *data);
        static void __renderingCb(void *data);
        static void __pixelGetCb(void *data, Evas_Object *obj);
-       static void __processViewObject(maps_view_h view, const maps_view_object_h object, maps_view_object_operation_e operation);
+       static void __processViewObject(maps_view_h view, const maps_view_object_h object,
+                                                               maps_view_object_operation_e operation);
 
 private:
        Here::Maps::GeoTiledMap *__map;
index 912641f..d8f8c04 100644 (file)
@@ -795,3 +795,14 @@ int HerePluginOnViewObject(maps_view_h hView, const maps_view_object_h object,
                error = vh->onViewObject(hView, object, operation);
        return error;
 }
+
+int HerePluginCaptureSnapshot(maps_view_h view, void **data,
+       int *w, int *h, maps_view_colorspace_type_e *cs)
+{
+       HereView *vh = NULL;
+       int maps_error = maps_view_get_maps_plugin_view_handle(view, (void**)&vh);
+       here_error_e error = (here_error_e)ConvertToHereError(maps_error);
+       if (error == HERE_ERROR_NONE && vh)
+               error = vh->captureSnapshot(view, data, w, h, cs);
+       return error;
+}
index 076dad8..125834c 100644 (file)
@@ -118,6 +118,7 @@ EXPORT_API int maps_plugin_is_service_supported(maps_service_e service, bool *su
                case MAPS_SERVICE_SEARCH_PLACE_LIST:
                case MAPS_SERVICE_SEARCH_GET_PLACE_DETAILS:
                case MAPS_SERVICE_VIEW:
+               case MAPS_SERVICE_VIEW_SNAPSHOT:
                        *supported = TRUE;
                        break;
                default:
@@ -393,5 +394,15 @@ EXPORT_API int maps_plugin_get_center(maps_view_h hView, maps_coordinates_h *cen
        return ConvertToMapsError(ret);
 }
 
+EXPORT_API int maps_plugin_capture_snapshot(maps_view_h view, void **data,
+       int *width, int *height, maps_view_colorspace_type_e *cs)
+{
+       int ret = HerePluginCaptureSnapshot(view, data, width, height, cs);
+
+       if (ret != HERE_ERROR_NONE)
+               MAPS_LOGD("here_error_e = %d", ret);
+
+       return ConvertToMapsError(ret);
+}
 } // end of extern "C"
 
index 0caa3bc..5dcf6fa 100755 (executable)
@@ -530,4 +530,34 @@ void HereView::__processViewObject(maps_view_h view, const maps_view_object_h ob
        }
 }
 
+here_error_e HereView::captureSnapshot(maps_view_h view, void **data, int *width, int *height,
+       maps_view_colorspace_type_e *cs)
+{
+       if (!__isInitialized || !__map || __w <= 0 || __h <= 0)
+               return HERE_ERROR_SERVICE_NOT_AVAILABLE;
+
+       int sizeOfLine = (__w * 4);
+       unsigned char *readData = (unsigned char*)malloc(sizeOfLine * __h);
+       if (!readData)
+               return HERE_ERROR_OUT_OF_MEMORY;
+
+       *data = (void*)malloc(sizeOfLine * __h);
+       if (!*data) {
+               free(readData);
+               return HERE_ERROR_OUT_OF_MEMORY;
+       }
+
+       __map->PaintMap(__w, __h);
+       __api->glReadPixels(0, 0, __w, __h, GL_RGBA, GL_UNSIGNED_BYTE, readData);
+       for(int i = 0; i < __h; i++)
+               memcpy((unsigned char*)*data + sizeOfLine * i, readData + sizeOfLine * (__h - i - 1), sizeOfLine);
+       free(readData);
+
+       *width = __w;
+       *height = __h;
+       *cs = MAPS_VIEW_COLORSPACE_RGBA8888;
+
+       return HERE_ERROR_NONE;
+}
+
 HERE_PLUGIN_END_NAMESPACE