// Nothing to do.
}
-void TangramView::initNetworkRequests() {
- char* proxyAddress = NULL;
- get_proxy_address(&proxyAddress);
-
- initUrlRequests(proxyAddress);
-
- g_free(proxyAddress);
-}
-
-void TangramView::deinitNetworkRequests() {
- stopUrlRequests();
-}
-
mapzen_error_e TangramView::create(maps_view_h view, maps_plugin_map_view_ready_cb callback, const char* providerKey)
{
if (!view) {
return error;
}
- setRenderCallbackFunction([=](){
- ecore_main_loop_thread_safe_call_async(&renderingCb, m_image);
- });
-
m_readyCb = callback;
// TODO: What to do for multiple instances
- setEvasGlAPI(m_api);
+ Tangram::setEvasGlAPI(m_api);
+
+ Tangram::UrlClient::Options urlOptions;
+ char* proxyAddress = NULL;
+ get_proxy_address(&proxyAddress);
+ urlOptions.proxyAddress = proxyAddress;
+ g_free(proxyAddress);
+
+ auto platform = std::shared_ptr<Tangram::TizenPlatform>(new Tangram::TizenPlatform(urlOptions));
+ //auto platform = std::make_shared<Tangram::TizenPlatform>();
+
+ platform->setRenderCallbackFunction([=](){
+ ecore_main_loop_thread_safe_call_async(&renderingCb, m_image);
+ });
// Set up the tangram map.
- m_map = new Tangram::Map();
+ m_map = new Tangram::Map(platform);
float scaleFactor = elm_config_scale_get();
MAPS_LOGD("evas_gl_context_create() set PixelScale %f", scaleFactor);
}
if (m_map) {
- setRenderCallbackFunction(nullptr);
+ static_cast<Tangram::TizenPlatform*>(m_map->getPlatform().get())->setRenderCallbackFunction(nullptr);
removeAllObjects();
delete m_map;
m_map = nullptr;
m_map->setPosition(m_lng, m_lat);
}
- requestRender();
+ m_map->getPlatform()->requestRender();
return MAPZEN_ERROR_NONE;
}
mapzen_error_e TangramView::updateMarker(maps_view_object_h object, Tangram::MarkerID tvMarker)
{
- std::string styleString = "";
maps_coordinates_h mapsCoord = nullptr;
double lat = 0.0, lng = 0.0;
int markerWidth = 0, markerHeight = 0;
int error = MAPS_ERROR_NONE;
unsigned char *imgData = nullptr;
- const char* styleFormat = "{ style: 'sdk-point-overlay', color: white, size: [%fpx, %fpx], collide: false, anchor: %s, transition: { [show, hide]: { time: 0s } } }";
+ const char* styleFormat = "{ style: 'sdk-point-overlay', color: white, size: [%dpx, %dpx], collide: false, anchor: %s, transition: { [show, hide]: { time: 0s } } }";
static std::string anchor;
float scaledWidth = scaleFactor * markerWidth;
float scaledHeight = scaleFactor * markerHeight;
- int sz = std::snprintf(nullptr, 0, styleFormat, scaledWidth, scaledHeight, anchor.c_str());
- styleString.resize(sz+1);
- std::snprintf(&styleString[0], styleString.size(), styleFormat, scaledWidth, scaledHeight, anchor.c_str());
+ char styleString[256];
+ std::snprintf(styleString, sizeof(styleString), styleFormat, int(scaledWidth), int(scaledHeight), anchor.c_str());
- MAPS_LOGD("Marker Style String: %s", styleString.c_str());
- m_map->markerSetStyling(tvMarker, styleString.c_str());
+ MAPS_LOGD("Marker Style String: %s", styleString);
+ m_map->markerSetStylingFromString(tvMarker, styleString);
error = maps_view_object_marker_get_coordinates(object, &mapsCoord);
if (error != MAPS_ERROR_NONE) { break; }
mapzen_error_e TangramView::updatePolyline(maps_view_object_h object, Tangram::MarkerID tvMarker)
{
- std::string styleString = "";
int error = MAPS_ERROR_NONE;
Tangram::Coordinates coords = {};
unsigned char r = 0, g = 0, b = 0, a = 0;
error = maps_view_object_polyline_get_width(object, &width);
if (error != MAPS_ERROR_NONE) { break; }
- int sz = std::snprintf(nullptr, 0, styleFormat, r, g, b, a, width);
- styleString.resize(sz+1);
- std::snprintf(&styleString[0], styleString.size(), styleFormat, r, g, b, a, width);
+ char styleString[256];
+ std::snprintf(styleString, sizeof(styleString), styleFormat, r, g, b, a, width);
- MAPS_LOGD("Polyline Style String: %s", styleString.c_str());
+ MAPS_LOGD("Polyline Style String: %s", styleString);
- m_map->markerSetStyling(tvMarker, styleString.c_str());
+ m_map->markerSetStylingFromString(tvMarker, styleString);
error = maps_view_object_polyline_foreach_point(object, emplaceCoord, &coords);
if (error != MAPS_ERROR_NONE) { break; }
mapzen_error_e TangramView::updatePolygon(maps_view_object_h object, Tangram::MarkerID tvMarker)
{
- std::string styleString = "";
int error = MAPS_ERROR_NONE;
Tangram::Coordinates coords = {};
unsigned char r = 0, g = 0, b = 0, a = 0;
error = maps_view_object_polygon_get_fill_color(object, &r, &g, &b, &a);
if (error != MAPS_ERROR_NONE) { break; }
- int sz = std::snprintf(nullptr, 0, styleFormat, r, g, b, a);
- styleString.resize(sz+1);
- std::snprintf(&styleString[0], styleString.size(), styleFormat, r, g, b, a);
+ char styleString[256];
+ std::snprintf(styleString, sizeof(styleString), styleFormat, r, g, b, a);
- MAPS_LOGD("Polygon Style String: %s", styleString.c_str());
+ MAPS_LOGD("Polygon Style String: %s", styleString);
- m_map->markerSetStyling(tvMarker, styleString.c_str());
+ m_map->markerSetStylingFromString(tvMarker, styleString);
error = maps_view_object_polygon_foreach_point(object, emplaceCoord, &coords);
if (error != MAPS_ERROR_NONE) { break; }
if (newViewType != m_viewType) {
m_buildingsEnabled = true;
m_publicTransitEnabled = false;
- m_language = "eng";
+ m_language = "en";
m_isProviderKeySet = false;
}
if (buildings_enabled != m_buildingsEnabled) {
m_buildingsEnabled = buildings_enabled;
if (m_buildingsEnabled) {
- sceneUpdates.push_back( {"global.building_extrude", "true"} );
+ sceneUpdates.push_back( {"global.sdk_building_extrude", "true"} );
} else {
- sceneUpdates.push_back( {"global.building_extrude", "false"} );
+ sceneUpdates.push_back( {"global.sdk_building_extrude", "false"} );
}
}
maps_view_get_language(view, &language);
if (m_language != language) {
m_language = language;
- sceneUpdates.push_back( {"global.ux_language", m_language.c_str()} );
+ sceneUpdates.push_back( {"global.ux_language", m_language.substr(0, 2).c_str()} );
}
free(language);
// set provider key for vector tiles
if (m_providerKey.size() > 0 && !m_isProviderKeySet) {
MAPS_LOGD("Queueing API key update: %s", m_providerKey.c_str());
- sceneUpdates.push_back( {"sources.mapzen.url_params.api_key", m_providerKey.c_str()} );
+ sceneUpdates.push_back( {"global.sdk_mapzen_api_key", m_providerKey.c_str()} );
m_isProviderKeySet = true;
}