evas
ecore-evas
elementary
- vconf
)
INCLUDE(FindPkgConfig)
#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);
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
#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>
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();
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;
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;
+}
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:
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"
}
}
+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