From: Varun Date: Wed, 14 Sep 2016 21:21:16 +0000 (-0400) Subject: Add anchor for STICKER/PIN markers X-Git-Tag: submit/tizen_3.0/20161108.012559~30 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1ef4592d9d31aad75f6b63add050d3275a16f9a0;p=platform%2Fcore%2Flocation%2Fmaps-plugin-mapzen.git Add anchor for STICKER/PIN markers Change-Id: I739d6e84f23b7f100eaf09a25bc93449cd6befd3 --- diff --git a/src/mapzen/tangram_view.cpp b/src/mapzen/tangram_view.cpp index 1529bbf..9cc7b2b 100644 --- a/src/mapzen/tangram_view.cpp +++ b/src/mapzen/tangram_view.cpp @@ -548,20 +548,29 @@ mapzen_error_e TangramView::updateObject(maps_view_object_h object, Tangram::Mar switch(type) { case MAPS_VIEW_OBJECT_MARKER: { - // TODO: distinguish between MAPS_VIEW_MARKER_PIN and MAPS_VIEW_MARKER_STICKER (pin vs billboard?) // TODO: use image passed with the view object, not available in tangram yet! + maps_view_marker_type_e markerType; + error = maps_view_object_marker_get_type(object, &markerType); + if (error != MAPS_ERROR_NONE || markerType < MAPS_VIEW_MARKER_PIN || markerType > MAPS_VIEW_MARKER_STICKER) { break; } + maps_coordinates_h mapsCoord = nullptr; double lat = 0.0, lng = 0.0; int markerWidth = 0, markerHeight = 0; - const char* styleFormat = "{ style: 'ux-icons-overlay', sprite: 'ux-search-active', size: [%dpx, %dpx], collide: false, anchor: top, transition: { [show, hide]: { time: 0s } } }"; + const char* styleFormat = "{ style: 'ux-icons-overlay', sprite: 'ux-search-active', size: [%dpx, %dpx], collide: false, anchor: %s, transition: { [show, hide]: { time: 0s } } }"; + static std::string anchor; + + anchor = "center"; + if (markerType == MAPS_VIEW_MARKER_PIN) { + anchor = "top"; + } error = maps_view_object_marker_get_size(object, &markerWidth, &markerHeight); if (error != MAPS_ERROR_NONE) { break; } - int sz = std::snprintf(nullptr, 0, styleFormat, markerWidth, markerHeight); + int sz = std::snprintf(nullptr, 0, styleFormat, markerWidth, markerHeight, anchor.c_str()); styleString.resize(sz+1); - std::snprintf(&styleString[0], styleString.size(), styleFormat, markerWidth, markerHeight); + std::snprintf(&styleString[0], styleString.size(), styleFormat, markerWidth, markerHeight, anchor.c_str()); m_map->markerSetStyling(tvMarker, styleString.c_str());