Adds utility functions to convert between mapzen_error_e and maps_error_e 10/80310/2
authorMatt Blair <blair1618@gmail.com>
Fri, 24 Jun 2016 21:43:48 +0000 (17:43 -0400)
committerJongmun Woo <jongmun.woo@samsung.com>
Tue, 19 Jul 2016 01:11:41 +0000 (18:11 -0700)
Change-Id: I31012e0e007957fafdb3210fa50e3a675b33b4a1

src/mapzen/mapzen_types.h
src/mapzen/mapzen_util.c
src/mapzen/mapzen_util.h
src/mapzen/tangram_view.cpp
src/mapzen/tangram_view.hpp
src/mapzen_plugin.c

index 2c41b02..00f452a 100644 (file)
@@ -72,6 +72,14 @@ typedef enum {
        DRIVING_STYLE_AGGRESSIVE
 } route_driving_style;
 
+typedef enum {
+       TANGRAM_VIEW_NORMAL = 0,
+       TANGRAM_VIEW_TERRAIN,
+       TANGRAM_VIEW_SATELLITE,
+       TANGRAM_VIEW_HYBRID,
+       TANGRAM_VIEW_NOT_SUPPORTED
+} tangram_view_type;
+
 typedef struct {
        gdouble latitude;
        gdouble longitude;
index 593e32f..31bbd72 100644 (file)
@@ -16,6 +16,8 @@
 
 #include "mapzen_util.h"
 #include "mapzen_debug.h"
+#include <maps_error.h>
+#include <maps_view.h>
 #include <math.h>
 
 #define PI 3.14159265359
@@ -43,3 +45,66 @@ void calculate_point(gdouble Lat1, gdouble Lon1, int dBearing, gdouble dist, coo
        }
 }
 
+int convert_maps_error_to_mapzen_error(int error)
+{
+       switch (error) {
+       case MAPS_ERROR_NONE:                  return MAPZEN_ERROR_NONE;
+       case MAPS_ERROR_PERMISSION_DENIED:     return MAPZEN_ERROR_PERMISSION_DENIED;
+       case MAPS_ERROR_OUT_OF_MEMORY:         return MAPZEN_ERROR_OUT_OF_MEMORY;
+       case MAPS_ERROR_INVALID_PARAMETER:     return MAPZEN_ERROR_INVALID_PARAMETER;
+       case MAPS_ERROR_NOT_SUPPORTED:         return MAPZEN_ERROR_NOT_SUPPORTED;
+       case MAPS_ERROR_CONNECTION_TIME_OUT:   return MAPZEN_ERROR_CONNECTION_TIMED_OUT;
+       case MAPS_ERROR_NETWORK_UNREACHABLE:   return MAPZEN_ERROR_NETWORK_UNREACHABLE;
+       case MAPS_ERROR_INVALID_OPERATION:     return MAPZEN_ERROR_INVALID_OPERATION;
+       case MAPS_ERROR_KEY_NOT_AVAILABLE:     return MAPZEN_ERROR_KEY_NOT_AVAILABLE;
+       case MAPS_ERROR_RESOURCE_BUSY:         return MAPZEN_ERROR_RESOURCE_BUSY;
+       case MAPS_ERROR_CANCELED:              return MAPZEN_ERROR_CANCELED;
+       case MAPS_ERROR_UNKNOWN:               return MAPZEN_ERROR_UNKNOWN;
+       case MAPS_ERROR_SERVICE_NOT_AVAILABLE: return MAPZEN_ERROR_SERVICE_NOT_AVAILABLE;
+       case MAPS_ERROR_NOT_FOUND:             return MAPZEN_ERROR_NOT_FOUND;
+       default: return MAPZEN_ERROR_UNKNOWN;
+       }
+}
+
+int convert_mapzen_error_to_maps_error(int error)
+{
+       switch (error) {
+       case MAPZEN_ERROR_NONE:                  return MAPS_ERROR_NONE;
+       case MAPZEN_ERROR_PERMISSION_DENIED:     return MAPS_ERROR_PERMISSION_DENIED;
+       case MAPZEN_ERROR_OUT_OF_MEMORY:         return MAPS_ERROR_OUT_OF_MEMORY;
+       case MAPZEN_ERROR_INVALID_PARAMETER:     return MAPS_ERROR_INVALID_PARAMETER;
+       case MAPZEN_ERROR_NOT_SUPPORTED:         return MAPS_ERROR_NOT_SUPPORTED;
+       case MAPZEN_ERROR_CONNECTION_TIMED_OUT:  return MAPS_ERROR_CONNECTION_TIME_OUT;
+       case MAPZEN_ERROR_NETWORK_UNREACHABLE:   return MAPS_ERROR_NETWORK_UNREACHABLE;
+       case MAPZEN_ERROR_INVALID_OPERATION:     return MAPS_ERROR_INVALID_OPERATION;
+       case MAPZEN_ERROR_KEY_NOT_AVAILABLE:     return MAPS_ERROR_KEY_NOT_AVAILABLE;
+       case MAPZEN_ERROR_RESOURCE_BUSY:         return MAPS_ERROR_RESOURCE_BUSY;
+       case MAPZEN_ERROR_CANCELED:              return MAPS_ERROR_CANCELED;
+       case MAPZEN_ERROR_UNKNOWN:               return MAPS_ERROR_UNKNOWN;
+       case MAPZEN_ERROR_SERVICE_NOT_AVAILABLE: return MAPS_ERROR_SERVICE_NOT_AVAILABLE;
+       case MAPZEN_ERROR_NOT_FOUND:             return MAPS_ERROR_NOT_FOUND;
+       default: return MAPS_ERROR_UNKNOWN;
+       }
+}
+
+int convert_tangram_view_type_to_maps_view_type(int maps_view_type)
+{
+       switch (maps_view_type) {
+       case TANGRAM_VIEW_NORMAL:       return MAPS_VIEW_TYPE_NORMAL;
+       case TANGRAM_VIEW_TERRAIN:      return MAPS_VIEW_TYPE_TERRAIN;
+       case TANGRAM_VIEW_SATELLITE:    /*NOT SUPPORTED BY TANGRAM*/
+       case TANGRAM_VIEW_HYBRID:       /*NOT SUPPORTED BY TANGRAM*/
+       default: return MAPS_VIEW_TYPE_NORMAL;
+       }
+}
+
+int convert_maps_view_type_to_tangram_view_type(int maps_view_type)
+{
+       switch (maps_view_type) {
+       case MAPS_VIEW_TYPE_NORMAL:     return TANGRAM_VIEW_NORMAL;
+       case MAPS_VIEW_TYPE_SATELLITE:  return TANGRAM_VIEW_NOT_SUPPORTED;
+       case MAPS_VIEW_TYPE_TERRAIN:    return TANGRAM_VIEW_TERRAIN;
+       case MAPS_VIEW_TYPE_HYBRID:     return TANGRAM_VIEW_NOT_SUPPORTED;
+       default: return TANGRAM_VIEW_NORMAL;
+       }
+}
index 36a6ca0..bda7bd5 100644 (file)
@@ -24,4 +24,9 @@
 
 void calculate_point(gdouble Lat1, gdouble Lon1, int dBearing, gdouble dist, coords_s **coord);
 
+int convert_maps_error_to_mapzen_error(int error);
+int convert_mapzen_error_to_maps_error(int error);
+int convert_tangram_view_type_to_maps_view_type(int maps_view_type);
+int convert_maps_view_type_to_tangram_view_type(int maps_view_type);
+
 #endif /* _MAPZEN_UTIL_H_ */
index 409b155..6b3b663 100644 (file)
  * limitations under the License.
  */
 
- #include "tangram_view.hpp"
- #include "tangram/tangram.h"
+#include "mapzen_util.h"
+#include "mapzen_plugin_internal.h"
+#include "tangram_view.hpp"
+#include "tangram/tangram.h"
 
 TangramView::TangramView()
 {
@@ -29,14 +31,145 @@ TangramView::~TangramView()
 
 mapzen_error_e TangramView::create(maps_view_h view, maps_plugin_map_view_ready_cb callback)
 {
-       // TODO
-       return MAPZEN_ERROR_SERVICE_NOT_AVAILABLE;
+       if (!view) {
+               return MAPZEN_ERROR_INVALID_PARAMETER;
+       }
+
+       int maps_error = MAPS_ERROR_NONE;
+       maps_error = maps_view_get_viewport(view, &m_image);
+       if (maps_error != MAPS_ERROR_NONE) {
+               return (mapzen_error_e)convert_maps_error_to_mapzen_error(maps_error);
+       }
+
+       maps_error = maps_view_get_screen_location(view, &m_x, &m_y, &m_w, &m_h);
+       if (maps_error == MAPS_ERROR_NONE) {
+               return (mapzen_error_e)convert_maps_error_to_mapzen_error(maps_error);
+       }
+
+       // Create an OpenGL context.
+       {
+               m_config = evas_gl_config_new();
+               if (!m_config) {
+                       MAPS_LOGE("evas_gl_config_new() failed");
+                       return MAPZEN_ERROR_SERVICE_NOT_AVAILABLE;
+               }
+
+               m_config->color_format = EVAS_GL_RGBA_8888;
+               m_config->depth_bits   = EVAS_GL_DEPTH_BIT_24;
+               m_config->stencil_bits = EVAS_GL_STENCIL_NONE;
+               m_config->options_bits = EVAS_GL_OPTIONS_DIRECT;
+
+               m_gl = evas_gl_new(evas_object_evas_get(m_image));
+               if (!m_gl) {
+                       MAPS_LOGE("evas_gl_new() failed");
+                       return MAPZEN_ERROR_SERVICE_NOT_AVAILABLE;
+               }
+
+               m_api = evas_gl_api_get(m_gl);
+               if (!m_api) {
+                       MAPS_LOGE("evas_gl_api_get() failed");
+                       return MAPZEN_ERROR_SERVICE_NOT_AVAILABLE;
+               }
+
+               m_context = evas_gl_context_create(m_gl, nullptr);
+               if (!m_context) {
+                       MAPS_LOGE("evas_gl_context_create() failed");
+                       return MAPZEN_ERROR_SERVICE_NOT_AVAILABLE;
+               }
+       }
+
+       // Set up rendering surface.
+       auto error = setupOpenGlSurface(view);
+       if (error != MAPZEN_ERROR_NONE) {
+               return error;
+       }
+
+       // Set up the tangram map.
+       // TODO: Decide where scene file will be stored and how it will be configurable.
+       Tangram::initialize("scene.yaml");
+       Tangram::setupGL();
+       Tangram::resize(m_w, m_h);
+
+       m_isInitialized = true;
+
+       return MAPZEN_ERROR_NONE;
+}
+
+mapzen_error_e TangramView::setupOpenGlSurface(maps_view_h view)
+{
+       if (!view || !m_gl || !m_config || !m_image || !m_context) {
+               return MAPZEN_ERROR_INVALID_PARAMETER;
+       }
+
+       // Remove any previous pixel callback on the image.
+       evas_object_image_pixels_get_callback_set(m_image, nullptr, nullptr);
+
+       if (m_surface) {
+               // Destroy the old surface.
+               evas_object_image_native_surface_set(m_image, nullptr);
+               evas_gl_surface_destroy(m_gl, m_surface);
+       }
+
+       m_w = MAX(m_w, 1);
+       m_h = MAX(m_h, 1);
+
+       evas_object_image_size_set(m_image, m_w, m_h);
+
+       Evas_Native_Surface native_surface;
+       m_surface = evas_gl_surface_create(m_gl, m_config, m_w, m_h);
+       if (!m_surface) {
+               MAPS_LOGE("evas_gl_surface_create() failed");
+               return MAPZEN_ERROR_SERVICE_NOT_AVAILABLE;
+       }
+
+       if (!evas_gl_native_surface_get(m_gl, m_surface, &native_surface)) {
+               // Could not get the native surface information, so destroy the surface and exit.
+               evas_gl_make_current(m_gl, nullptr, nullptr);
+               evas_gl_surface_destroy(m_gl, m_surface);
+               m_surface = nullptr;
+               MAPS_LOGE("evas_gl_native_surface_get() failed");
+               return MAPZEN_ERROR_SERVICE_NOT_AVAILABLE;
+       }
+
+       // Set the native surface information and pixel callback on the image.
+       evas_object_image_native_surface_set(m_image, &native_surface);
+       evas_object_image_pixels_get_callback_set(m_image, pixelGetCb, view);
+
+       return MAPZEN_ERROR_NONE;
 }
 
 mapzen_error_e TangramView::destroy(maps_view_h view)
 {
-       // TODO
-       return MAPZEN_ERROR_SERVICE_NOT_AVAILABLE;
+       if (!view) {
+               return MAPZEN_ERROR_INVALID_PARAMETER;
+       }
+
+       m_isInitialized = false;
+
+       if (m_image) {
+               evas_object_image_pixels_get_callback_set(m_image, nullptr, nullptr);
+       }
+
+       if (m_gl) {
+               if (m_surface && m_context) {
+                       evas_gl_make_current(m_gl, m_surface, m_context);
+               }
+               if (m_surface) {
+                       evas_object_image_native_surface_set(m_image, nullptr);
+                       evas_gl_surface_destroy(m_gl, m_surface);
+               }
+               if (m_context) {
+                       evas_gl_context_destroy(m_gl, m_context);
+               }
+               evas_gl_free(m_gl);
+               m_gl = nullptr;
+       }
+
+       if (m_config) {
+               evas_gl_config_free(m_config);
+       }
+
+       return MAPZEN_ERROR_NONE;
 }
 
 mapzen_error_e TangramView::render(maps_view_h view, const maps_coordinates_h coord, double zoom, double angle)
@@ -51,7 +184,7 @@ mapzen_error_e TangramView::moveCenter(maps_view_h view, int delta_x, int delta_
                return MAPZEN_ERROR_INVALID_PARAMETER;
        }
 
-       if (!isInitialized) {
+       if (!m_isInitialized) {
                return MAPZEN_ERROR_SERVICE_NOT_AVAILABLE;
        }
 
@@ -62,8 +195,8 @@ mapzen_error_e TangramView::moveCenter(maps_view_h view, int delta_x, int delta_
        // The delta_x and delta_y values are in pixels, so we need to determine the equivalent displacement in
        // longitude and latitude to set the new center position.
 
-       double x = 0.5 * w + (double)delta_x;
-       double y = 0.5 * h + (double)delta_y; // TODO: Check whether sign of delta_y needs to be flipped.
+       double x = 0.5 * m_w + (double)delta_x;
+       double y = 0.5 * m_h + (double)delta_y; // TODO: Check whether sign of delta_y needs to be flipped.
        Tangram::screenToWorldCoordinates(x, y);
        Tangram::setPosition(x, y);
 
@@ -76,7 +209,7 @@ mapzen_error_e TangramView::getCenter(maps_view_h view, maps_coordinates_h *cent
                return MAPZEN_ERROR_INVALID_PARAMETER;
        }
 
-       if (!isInitialized) {
+       if (!m_isInitialized) {
                return MAPZEN_ERROR_SERVICE_NOT_AVAILABLE;
        }
 
@@ -109,7 +242,7 @@ mapzen_error_e TangramView::convertScreenToGeolocation(maps_view_h view, int x,
                return MAPZEN_ERROR_INVALID_PARAMETER;
        }
 
-       if (!isInitialized) {
+       if (!m_isInitialized) {
                return MAPZEN_ERROR_SERVICE_NOT_AVAILABLE;
        }
 
@@ -150,24 +283,6 @@ mapzen_error_e TangramView::onViewObject(maps_view_h view, const maps_view_objec
        return MAPZEN_ERROR_SERVICE_NOT_AVAILABLE;
 }
 
-mapzen_error_e TangramView::initOpenGL()
-{
-       // TODO
-       return MAPZEN_ERROR_SERVICE_NOT_AVAILABLE;
-}
-
-mapzen_error_e TangramView::initOpenGLSurface(maps_view_h view)
-{
-       // TODO
-       return MAPZEN_ERROR_SERVICE_NOT_AVAILABLE;
-}
-
-mapzen_error_e TangramView::initMap(maps_view_h view, maps_plugin_map_view_ready_cb callback)
-{
-       // TODO
-       return MAPZEN_ERROR_SERVICE_NOT_AVAILABLE;
-}
-
 void TangramView::setMapType(maps_view_h view)
 {
        // TODO
index 72d5098..7c50135 100644 (file)
@@ -45,9 +45,7 @@ public:
        mapzen_error_e onViewObject(maps_view_h view, const maps_view_object_h object, maps_view_object_operation_e operation);
 
 private:
-       mapzen_error_e initOpenGL();
-       mapzen_error_e initOpenGLSurface(maps_view_h view);
-       mapzen_error_e initMap(maps_view_h view, maps_plugin_map_view_ready_cb callback);
+       mapzen_error_e setupOpenGlSurface(maps_view_h view);
        void setMapType(maps_view_h view);
        static Eina_Bool idlerCb(void *data);
        static void readyMapCb(maps_view_h view);
@@ -57,20 +55,25 @@ private:
 
 private:
 
-       Evas_Object *image = nullptr;
-       Evas_GL_Context *context = nullptr;
-       Evas_GL_Surface *surface = nullptr;
-       Evas_GL_Config *config = nullptr;
-       Evas_GL *gl = nullptr;
-       Evas_GL_API *api = nullptr;
+       Evas_Object *m_image = nullptr;
+       Evas_GL_Context *m_context = nullptr;
+       Evas_GL_Surface *m_surface = nullptr;
+       Evas_GL_Config *m_config = nullptr;
+       Evas_GL *m_gl = nullptr;
+       Evas_GL_API *m_api = nullptr;
 
-       bool isInitialized = false;
+       bool m_isInitialized = false;
 
-       int x = 0, y = 0, w = 0, h = 0;
-       double lat = 0., lng = 0., zoom = 0., angle = 0.;
+       int m_x = 0; 
+       int m_y = 0;
+       int m_w = 0;
+       int m_h = 0;
+       double m_lat = 0.;
+       double m_lng = 0.;
+       double m_zoom = 0.;
+       double m_angle = 0.;
 
-       Ecore_Idler *idler = nullptr;
-       bool redraw = false;
+       bool m_redraw = false;
 
-       maps_plugin_map_view_ready_cb readyCb = nullptr;
+       maps_plugin_map_view_ready_cb m_readyCb = nullptr;
 };
index c9ea500..5d4e712 100644 (file)
@@ -43,41 +43,6 @@ static maps_item_hashtable_h preference_plugin = NULL;
 
 int __maps_service_instance_count = 0;
 
-static int __convert_to_maps_error(int ret)
-{
-       switch (ret) {
-       case MAPZEN_ERROR_NONE:
-               return MAPS_ERROR_NONE;
-       case MAPZEN_ERROR_PERMISSION_DENIED:
-               return MAPS_ERROR_PERMISSION_DENIED;
-       case MAPZEN_ERROR_OUT_OF_MEMORY:
-               return MAPS_ERROR_OUT_OF_MEMORY;
-       case MAPZEN_ERROR_INVALID_PARAMETER:
-               return MAPS_ERROR_INVALID_PARAMETER;
-       case MAPZEN_ERROR_NOT_SUPPORTED:
-               return MAPS_ERROR_NOT_SUPPORTED;
-       case MAPZEN_ERROR_CONNECTION_TIMED_OUT:
-               return MAPS_ERROR_CONNECTION_TIME_OUT;
-       case MAPZEN_ERROR_NETWORK_UNREACHABLE:
-               return MAPS_ERROR_NETWORK_UNREACHABLE;
-       case MAPZEN_ERROR_INVALID_OPERATION:
-               return MAPS_ERROR_INVALID_OPERATION;
-       case MAPZEN_ERROR_KEY_NOT_AVAILABLE:
-               return MAPS_ERROR_KEY_NOT_AVAILABLE;
-       case MAPZEN_ERROR_RESOURCE_BUSY:
-               return MAPS_ERROR_RESOURCE_BUSY;
-       case MAPZEN_ERROR_CANCELED:
-               return MAPS_ERROR_CANCELED;
-       case MAPZEN_ERROR_UNKNOWN:
-               return MAPS_ERROR_UNKNOWN;
-       case MAPZEN_ERROR_SERVICE_NOT_AVAILABLE:
-               return MAPS_ERROR_SERVICE_NOT_AVAILABLE;
-       case MAPZEN_ERROR_NOT_FOUND:
-               return MAPS_ERROR_NOT_FOUND;
-       default:
-               return MAPS_ERROR_UNKNOWN;
-       }
-}
 /*
 static maps_route_turn_type_e __convert_route_turn_type(int index)
 {
@@ -156,7 +121,7 @@ EXPORT_API int maps_plugin_init_module(maps_plugin_h *plugin, const char* module
                __plugin = plugin;
        }
 
-       return __convert_to_maps_error(ret);
+       return convert_mapzen_error_to_maps_error(ret);
 }
 
 EXPORT_API int maps_plugin_init(maps_plugin_h *plugin)
@@ -178,7 +143,7 @@ EXPORT_API int maps_plugin_shutdown(maps_plugin_h plugin)
                __plugin = NULL;
        }
 
-       return __convert_to_maps_error(ret);
+       return convert_mapzen_error_to_maps_error(ret);
 }
 
 EXPORT_API int maps_plugin_is_service_supported(maps_service_e service, bool *supported)
@@ -296,7 +261,7 @@ static void __mapzen_geocode_cb(mapzen_error_e result, int request_id, GList *co
 
        if ((result != MAPZEN_ERROR_NONE) || (co_ordinates == NULL)) {
                MAPS_LOGD(">>>>> Invalid GEOCODE result <<<<<");
-               calldata_geocode->callback((maps_error_e)__convert_to_maps_error(result), calldata_geocode->reqID, 0, 0, NULL, calldata_geocode->data);
+               calldata_geocode->callback((maps_error_e)convert_mapzen_error_to_maps_error(result), calldata_geocode->reqID, 0, 0, NULL, calldata_geocode->data);
        } else {
                int total_count = (int) g_list_length(co_ordinates);
                int index = 0;
@@ -357,7 +322,7 @@ EXPORT_API int maps_plugin_geocode(const char *address, const maps_preference_h
 
        int ret = mapzen_geocode(geocode_req, __mapzen_geocode_cb, __request_id, (void *) calldata_geocode);
 
-       return __convert_to_maps_error(ret);
+       return convert_mapzen_error_to_maps_error(ret);
 }
 
 EXPORT_API int maps_plugin_geocode_inside_area(const char *address, const maps_area_h bounds, const maps_preference_h preference, maps_service_geocode_cb callback, void *user_data, int *request_id)
@@ -414,7 +379,7 @@ EXPORT_API int maps_plugin_geocode_inside_area(const char *address, const maps_a
 
        int ret = mapzen_geocode(geocode_req, __mapzen_geocode_cb, __request_id, (void *) calldata_geocode);
 
-       return __convert_to_maps_error(ret);
+       return convert_mapzen_error_to_maps_error(ret);
 }
 
 EXPORT_API int maps_plugin_geocode_by_structured_address(const maps_address_h address, const maps_preference_h preference, maps_service_geocode_cb callback, void *user_data, int *request_id)
@@ -523,7 +488,7 @@ EXPORT_API int maps_plugin_geocode_by_structured_address(const maps_address_h ad
 
        int ret = mapzen_geocode(geocode_req, __mapzen_geocode_cb, __request_id, (void *) calldata_geocode);
 
-       return __convert_to_maps_error(ret);
+       return convert_mapzen_error_to_maps_error(ret);
 }
 
 static void __mapzen_reverse_geocode_cb(mapzen_error_e result, int request_id, mapzen_address_resp_s *address, void *user_data)
@@ -531,7 +496,7 @@ static void __mapzen_reverse_geocode_cb(mapzen_error_e result, int request_id, m
        MAPS_LOGD("Got REV GEOCODE callback from ENGINE");
        callback_info_reverse_geocode *calldata_reverse_geocode = (callback_info_reverse_geocode *) user_data;
        if (result != MAPZEN_ERROR_NONE || address == NULL) {
-               calldata_reverse_geocode->callback((maps_error_e) __convert_to_maps_error(result), calldata_reverse_geocode->reqID, 0, 0, NULL, calldata_reverse_geocode->data);
+               calldata_reverse_geocode->callback((maps_error_e) convert_mapzen_error_to_maps_error(result), calldata_reverse_geocode->reqID, 0, 0, NULL, calldata_reverse_geocode->data);
        } else {
                int total_count = 1;
                int index = 0;
@@ -586,7 +551,7 @@ EXPORT_API int maps_plugin_reverse_geocode(double latitude, double longitude, co
 
        int ret = mapzen_reverse_geocode(reverse_geocode_req, __mapzen_reverse_geocode_cb, __request_id, (void *) calldata_reverse_geocode);
 
-       return __convert_to_maps_error(ret);
+       return convert_mapzen_error_to_maps_error(ret);
 }
 
 static void __mapzen_route_cb(mapzen_error_e result, int request_id, mapzen_route_resp_s *route_info, void *user_data)
@@ -742,11 +707,11 @@ static void __mapzen_route_cb(mapzen_error_e result, int request_id, mapzen_rout
                maps_route_set_path(route, path_list);
                maps_item_list_destroy(path_list);
 
-               bool b = calldata_route->callback((maps_error_e)__convert_to_maps_error(result), calldata_route->reqID, 0, 1, route, calldata_route->data);
+               bool b = calldata_route->callback((maps_error_e)convert_mapzen_error_to_maps_error(result), calldata_route->reqID, 0, 1, route, calldata_route->data);
                if (!b)
                        return;
        } else {
-               calldata_route->callback((maps_error_e)__convert_to_maps_error(result), calldata_route->reqID, 0, 0, NULL, calldata_route->data);
+               calldata_route->callback((maps_error_e)convert_mapzen_error_to_maps_error(result), calldata_route->reqID, 0, 0, NULL, calldata_route->data);
        }
 }
 
@@ -849,7 +814,7 @@ EXPORT_API int maps_plugin_search_route(const maps_coordinates_h origin, const m
 
        int ret = mapzen_start_route(route_req, __mapzen_route_cb, __request_id, (void *)calldata_route);
 
-       return __convert_to_maps_error(ret);
+       return convert_mapzen_error_to_maps_error(ret);
 }
 
 EXPORT_API int maps_plugin_search_route_waypoints(const maps_coordinates_h *waypoint_list, int waypoint_num, maps_preference_h preference, maps_service_search_route_cb callback, void *user_data, int *request_id)
@@ -964,7 +929,7 @@ EXPORT_API int maps_plugin_search_route_waypoints(const maps_coordinates_h *wayp
 
        int ret = mapzen_start_route(route_req, __mapzen_route_cb, __request_id, (void *)calldata_route);
 
-       return __convert_to_maps_error(ret);
+       return convert_mapzen_error_to_maps_error(ret);
 }
 
 static void __mapzen_place_search_cb(mapzen_error_e result, int request_id, GList *places, void *user_data)
@@ -975,7 +940,7 @@ static void __mapzen_place_search_cb(mapzen_error_e result, int request_id, GLis
 
        if (result != MAPZEN_ERROR_NONE || places == NULL) {
                MAPS_LOGD("Got places result from ENGINE...result is NULL");
-               calldata_place->callback((maps_error_e) __convert_to_maps_error(result), calldata_place->reqID, 0, 0, NULL, calldata_place->data);
+               calldata_place->callback((maps_error_e) convert_mapzen_error_to_maps_error(result), calldata_place->reqID, 0, 0, NULL, calldata_place->data);
        } else {
                guint total_count = 0;
                int index = 0;
@@ -1057,7 +1022,7 @@ static void __mapzen_place_search_cb(mapzen_error_e result, int request_id, GLis
                                /*maps_item_list_remove_all(image_list, maps_place_image_destroy); */
                                /*maps_item_list_destroy(image_list); */
 
-                               bool b = calldata_place->callback((maps_error_e)__convert_to_maps_error(result), calldata_place->reqID, index, total_count, place, calldata_place->data);
+                               bool b = calldata_place->callback((maps_error_e)convert_mapzen_error_to_maps_error(result), calldata_place->reqID, index, total_count, place, calldata_place->data);
                                if (!b)
                                        return;
 
@@ -1066,7 +1031,7 @@ static void __mapzen_place_search_cb(mapzen_error_e result, int request_id, GLis
                                temp_place = temp_place->next;
                        }
                } else {
-                       calldata_place->callback((maps_error_e)__convert_to_maps_error(result), calldata_place->reqID, index, total_count, NULL, calldata_place->data);
+                       calldata_place->callback((maps_error_e)convert_mapzen_error_to_maps_error(result), calldata_place->reqID, index, total_count, NULL, calldata_place->data);
                }
        }
 }
@@ -1363,7 +1328,7 @@ EXPORT_API int maps_plugin_search_place(const maps_coordinates_h position, int d
 
        int ret = mapzen_search_place(place_req, __mapzen_place_search_cb, __request_id, (void *) calldata_place);
 
-       return __convert_to_maps_error(ret);
+       return convert_mapzen_error_to_maps_error(ret);
 }
 
 EXPORT_API int maps_plugin_search_place_by_area(const maps_area_h boundary, const maps_place_filter_h filter, const maps_preference_h preference, maps_service_search_place_cb callback, void *user_data, int *request_id)
@@ -1462,7 +1427,7 @@ EXPORT_API int maps_plugin_search_place_by_area(const maps_area_h boundary, cons
 
        int ret = mapzen_search_place(place_req, __mapzen_place_search_cb, __request_id, (void *) calldata_place);
 
-       return __convert_to_maps_error(ret);
+       return convert_mapzen_error_to_maps_error(ret);
 }
 
 EXPORT_API int maps_plugin_search_place_list(const maps_area_h boundary, const maps_place_filter_h filter, const maps_preference_h preference, maps_service_search_place_list_cb callback, void *user_data, int *request_id)
@@ -1684,7 +1649,7 @@ EXPORT_API int maps_plugin_search_place_by_address(const char *address, const ma
 
        int ret = mapzen_search_place(place_req, __mapzen_place_search_cb, __request_id, (void *) calldata_place);
 
-       return __convert_to_maps_error(ret);
+       return convert_mapzen_error_to_maps_error(ret);
 }
 
 EXPORT_API int maps_plugin_cancel_request(int request_id)
@@ -1695,5 +1660,5 @@ EXPORT_API int maps_plugin_cancel_request(int request_id)
 
        int ret = mapzen_cancel_request(request_id);
 
-       return __convert_to_maps_error(ret);
+       return convert_mapzen_error_to_maps_error(ret);
 }