summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt1
-rwxr-xr-xinc/here_api.h4
-rw-r--r--inc/here_place.h2
-rw-r--r--inc/here_view.h11
-rw-r--r--src/here_api.cpp11
-rw-r--r--src/here_plugin.cpp11
-rwxr-xr-xsrc/here_view.cpp30
7 files changed, 64 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b5b0751..d8d85b2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,7 +19,6 @@ SET(dependents
evas
ecore-evas
elementary
- vconf
)
INCLUDE(FindPkgConfig)
diff --git a/inc/here_api.h b/inc/here_api.h
index 7ad11ef..6eaacc5 100755
--- a/inc/here_api.h
+++ b/inc/here_api.h
@@ -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
diff --git a/inc/here_place.h b/inc/here_place.h
index c4ea6cb..78a3892 100644
--- a/inc/here_place.h
+++ b/inc/here_place.h
@@ -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>
diff --git a/inc/here_view.h b/inc/here_view.h
index 1bc024a..a29884a 100644
--- a/inc/here_view.h
+++ b/inc/here_view.h
@@ -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;
diff --git a/src/here_api.cpp b/src/here_api.cpp
index 912641f..d8f8c04 100644
--- a/src/here_api.cpp
+++ b/src/here_api.cpp
@@ -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;
+}
diff --git a/src/here_plugin.cpp b/src/here_plugin.cpp
index 076dad8..125834c 100644
--- a/src/here_plugin.cpp
+++ b/src/here_plugin.cpp
@@ -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"
diff --git a/src/here_view.cpp b/src/here_view.cpp
index 0caa3bc..5dcf6fa 100755
--- a/src/here_view.cpp
+++ b/src/here_view.cpp
@@ -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