This depends on Change 99078 to function correctly, please merge that first. 79/99079/3
authorMatt Blair <blair1618@gmail.com>
Tue, 1 Nov 2016 21:24:53 +0000 (17:24 -0400)
committerJongmun Woo <jongmun.woo@samsung.com>
Mon, 28 Nov 2016 05:30:47 +0000 (21:30 -0800)
Place marker view objects above all other map labels

 - There is a known issue where markers are temporarily incorrectly sized after
   changing map styles
 - Use 'sdk-point-overlay' style for markers
 - Remove the 'texture' parameter from 'sdk-point-overlay' at scene load time
   so that custom bitmaps can be used instead of the sprite sheet
 - Clean up the tangram_view_type enum
 - Use 'setMapType' in 'TangramView::create' to start loading the initial scene

Change-Id: Ie5a15448e0dd86463d565f014f7c9de543707735

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

index 6023bf8..6c64776 100644 (file)
@@ -115,9 +115,7 @@ typedef enum {
 typedef enum {
        TANGRAM_VIEW_NORMAL = 0,
        TANGRAM_VIEW_TERRAIN,
-       TANGRAM_VIEW_SATELLITE,
-       TANGRAM_VIEW_HYBRID,
-       TANGRAM_VIEW_NOT_SUPPORTED
+       TANGRAM_VIEW_NONE
 } tangram_view_type;
 
 typedef struct {
index 9128a10..a7eca38 100644 (file)
@@ -203,8 +203,6 @@ 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;
        }
 }
@@ -212,10 +210,10 @@ 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)
 {
        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_NORMAL:             return TANGRAM_VIEW_NORMAL;
+       case MAPS_VIEW_TYPE_SATELLITE:  return TANGRAM_VIEW_NONE;
        case MAPS_VIEW_TYPE_TERRAIN:    return TANGRAM_VIEW_TERRAIN;
-       case MAPS_VIEW_TYPE_HYBRID:     return TANGRAM_VIEW_NOT_SUPPORTED;
-       default: return TANGRAM_VIEW_NORMAL;
+       case MAPS_VIEW_TYPE_HYBRID:             return TANGRAM_VIEW_NONE;
+       default: return TANGRAM_VIEW_NONE;
        }
 }
index b241d28..51bd130 100644 (file)
@@ -127,7 +127,9 @@ mapzen_error_e TangramView::create(maps_view_h view, maps_plugin_map_view_ready_
        MAPS_LOGD("evas_gl_context_create() set PixelScale %f", scaleFactor);
        m_map->setPixelScale(scaleFactor);
 
-       m_map->loadSceneAsync(NORMAL_SCENE_FILE_PATH, false, sceneLoadedCb, (void*)view);
+       // Start loading the scene by setting the map type.
+       setMapType(view);
+
        if (providerKey) {
                m_providerKey = providerKey;
        }
@@ -618,7 +620,7 @@ mapzen_error_e TangramView::updateMarker(maps_view_object_h object, Tangram::Mar
        int error = MAPS_ERROR_NONE;
        unsigned char *imgData = nullptr;
 
-       const char* styleFormat = "{ style: 'points', color: white, size: [%fpx, %fpx], collide: false, anchor: %s, transition: { [show, hide]: { time: 0s } } }";
+       const char* styleFormat = "{ style: 'sdk-point-overlay', color: white, size: [%fpx, %fpx], collide: false, anchor: %s, transition: { [show, hide]: { time: 0s } } }";
 
        static std::string anchor;
 
@@ -876,6 +878,10 @@ void TangramView::setMapType(maps_view_h view)
                m_viewType = newViewType;
                m_map->loadSceneAsync(newSceneFile, false, sceneLoadedCb, (void*)view);
                m_isProviderKeySet = false;
+
+               // When the scene is changed, update the 'sdk-point-overlay' style to remove it's texture;
+               // this allows us to use this style for markers with custom bitmaps.
+               m_map->queueSceneUpdate("styles.sdk-point-overlay.texture", "null");
        }
 
        bool buildings_enabled = false;
index 51dafdb..395ad6e 100644 (file)
@@ -115,7 +115,7 @@ private:
        std::mutex m_viewObjectMutex;
 
        maps_plugin_map_view_ready_cb m_readyCb = nullptr;
-       tangram_view_type m_viewType = TANGRAM_VIEW_NORMAL;
+       tangram_view_type m_viewType = TANGRAM_VIEW_NONE;
 
        MapViewObjects m_mapViewObjs; //current set of map objects
 };