Synchronized with Tizen 2.4 mapping branch 79/56979/3 mapping
authorchanywa <cbible.kim@samsung.com>
Thu, 14 Jan 2016 05:58:13 +0000 (14:58 +0900)
committerchanywa <cbible.kim@samsung.com>
Fri, 5 Feb 2016 05:01:33 +0000 (14:01 +0900)
Change-Id: Icdc888881b92183683e42f91288ea4c65aa0e4d2

39 files changed:
CMakeLists.txt
heremaps-uc/src/heremaps-uc.c
inc/engine/common/HereMaps_global.h
inc/engine/debug/MemCheck.h [new file with mode: 0644]
inc/engine/graphic/Bitmap.h
inc/engine/internal/RestEngine.h
inc/engine/maps/GeoTile.h
inc/engine/maps/GeoTiledMap.h
inc/engine/tilefetcher/TileFetcherCache.h [new file with mode: 0755]
inc/engine/tilefetcher/TileFetcherQueryListener.h
inc/here_api.h [changed mode: 0644->0755]
inc/here_geocode.h [changed mode: 0644->0755]
inc/here_manager.h [changed mode: 0644->0755]
inc/here_place.h [changed mode: 0644->0755]
inc/here_revgeocode.h [changed mode: 0644->0755]
inc/here_route.h [changed mode: 0644->0755]
inc/here_utils.h [changed mode: 0644->0755]
inc/here_view.h [new file with mode: 0644]
inc/here_view_objects.h [new file with mode: 0755]
lib/aarch64/libheremaps-engine.so.1
lib/aarch64/libheremaps-engine.so.1.0.6_10 [new file with mode: 0755]
lib/aarch64/libheremaps-engine.so.1.0.6_9 [deleted file]
lib/arm/libheremaps-engine.so.1
lib/arm/libheremaps-engine.so.1.0.6_10 [new file with mode: 0755]
lib/arm/libheremaps-engine.so.1.0.6_9 [deleted file]
lib/i586/libheremaps-engine.so.1
lib/i586/libheremaps-engine.so.1.0.6_10 [new file with mode: 0755]
lib/i586/libheremaps-engine.so.1.0.6_9 [deleted file]
lib/x86_64/libheremaps-engine.so.1
lib/x86_64/libheremaps-engine.so.1.0.6_10 [new file with mode: 0755]
lib/x86_64/libheremaps-engine.so.1.0.6_9 [deleted file]
packaging/maps-plugin-here.spec
src/here_api.cpp [changed mode: 0644->0755]
src/here_manager.cpp [changed mode: 0644->0755]
src/here_place.cpp [changed mode: 0644->0755]
src/here_plugin.cpp [changed mode: 0644->0755]
src/here_utils.cpp [changed mode: 0644->0755]
src/here_view.cpp [new file with mode: 0755]
src/here_view_objects.cpp [new file with mode: 0755]

index ab5a7ecd2269f3bdecd7ec7ffe7af8cd2920932c..7d8b6824c45e44155f8d7e99edcbb9265806713e 100644 (file)
@@ -6,7 +6,19 @@ SET(CMAKE_INSTALL_PREFIX /usr)
 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
 
 # Dependencies
-SET(dependents "glib-2.0 gmodule-2.0 libxml-2.0 dlog capi-network-connection capi-appfw-app-manager capi-maps-service capi-appfw-application")
+SET(dependents 
+       glib-2.0
+       gmodule-2.0
+       libxml-2.0
+       dlog
+       capi-maps-service
+       capi-network-connection
+       capi-appfw-app-manager
+       capi-appfw-application
+       evas
+       ecore-evas
+       elementary
+       )
 
 INCLUDE(FindPkgConfig)
 pkg_check_modules(pkgs REQUIRED ${dependents})
@@ -58,6 +70,8 @@ SET(SRCS
        src/here_multirevgeocode.cpp
        src/here_route.cpp
        src/here_utils.cpp
+       src/here_view.cpp
+       src/here_view_objects.cpp
 )
 
 ADD_LIBRARY(${pkg_name} SHARED ${SRCS})
index 2621092a7a7811fbe5ff7190f002e8a7564f93e2..8713e65ec50cef12f2cb675dff11ead852371a59 100644 (file)
@@ -72,15 +72,13 @@ static void read_file(heremaps_uc_app_data *ad)
        if (fp == NULL)
                LS_LOGE("UC_FILE open fail");
        else {
-               ret = fread(buf, 15, 1, fp);
+               ret = fread(buf, 1, 15, fp);
                fclose(fp);
 
-               if (ret > 0)
-               {
+               if (ret > 0) {
                        data = strtok_r(buf, "=", &save_token);
                        data = strtok_r(NULL, "=", &save_token);
-               }
-               else
+               } else
                        LS_LOGE("UC_FILE read fail");
        }
 
@@ -140,7 +138,6 @@ static void agree_btn_cb(void *data, Evas_Object * obj, void *event)
        heremaps_uc_app_data *ad = (heremaps_uc_app_data *) data;
 
        save_file("Yes", ad);
-
        elm_exit();
 }
 
@@ -336,9 +333,8 @@ int main(int argc, char *argv[])
        ret = APP_ERROR_NONE;
        ret = ui_app_main(argc, argv, &event_callback, &ad);
 
-       if (ret != APP_ERROR_NONE) {
+       if (ret != APP_ERROR_NONE)
                LS_LOGE("ui_app_main() is failed. err=%d", ret);
-       }
 
        return ret;
 
index a13ea2f7c5dcf9637b41751ef28c98e01e07a021..bf9aff1fe9754eb8be1a798d7df7e35e47e5ad84 100755 (executable)
@@ -25,6 +25,8 @@
 #define TIZEN_CUSTOMIZATION
 
 /* sub-features */
+#define TIZEN_SUPPORT_LIMIT_RETRYING_FETCHING_TILES    /* limit the number of retrying when failed fetching tiles */
+#define TIZEN_SUPPORT_TILE_FILE_CACHE
 #define TIZEN_SUPPORT_POST_METHOD
 #define TIZEN_SUPPORT_CRYPTO_LOCK                      /* mutex locking system for SSL */
 
diff --git a/inc/engine/debug/MemCheck.h b/inc/engine/debug/MemCheck.h
new file mode 100644 (file)
index 0000000..2f8522c
--- /dev/null
@@ -0,0 +1,58 @@
+//
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#ifndef MEM_CHECK_H
+#define MEM_CHECK_H
+
+#include <map>
+#include <glib.h>
+
+#include "common/HereMaps_global.h"
+#include "base/BaseObject.h"
+
+TIZEN_MAPS_BEGIN_NAMESPACE
+
+#ifdef TIZEN_PROFILING_MEMLEAK
+typedef std::map<void*,String> MemBlocks;
+
+class EXPORT_API MemCheck
+{
+public:
+       MemCheck();
+       ~MemCheck();
+
+       static MemCheck& getInstance();
+       void add(void *ptr, const char *file, const char *func, int line);
+       void remove(void *ptr, const char *file, const char *func, int line);
+       void report();
+
+private:
+       class MemCheckImpl;
+       MemCheckImpl *__impl;
+};
+
+#define MEMCHECK_ADD(p)                TIZEN_MAPS_NAMESPACE_PREFIX::MemCheck::getInstance().add(p, __FILE__, __FUNCTION__, __LINE__)
+#define MEMCHECK_REMOVE(p)     TIZEN_MAPS_NAMESPACE_PREFIX::MemCheck::getInstance().remove(p, __FILE__, __FUNCTION__, __LINE__)
+#define MEMCHECK_REPORT(p)     TIZEN_MAPS_NAMESPACE_PREFIX::MemCheck::getInstance().report()
+#else
+#define MEMCHECK_ADD(p)
+#define MEMCHECK_REMOVE(p)
+#define MEMCHECK_REPORT(p)
+#endif
+
+TIZEN_MAPS_END_NAMESPACE
+
+#endif // MEM_CHECK_H
\ No newline at end of file
index 07b016216eb1433a9e933184c2414c1d82e49d34..c6497fc3e974170865cdb9dc90c0be699c327dc9 100755 (executable)
@@ -59,6 +59,7 @@ private:
     int bytes_per_pixel;
     BitmapPixelFormat pixel_format;
     unsigned char* buffer;
+    pthread_mutex_t mutex;
 
     void BitBlt(int xDest, int yDest, unsigned char *pSrcBuffer, int xSour, int ySour, int wSour, int hSour, int nPitch, unsigned long opacity = 255);
 };
index 7132e97807dd62bf0a95a62ac879b1ab65e11fe5..dd0707b89e6f6cd5cd0d52278fbae8ff1a91ed1c 100755 (executable)
@@ -135,6 +135,10 @@ public:
 
 #ifdef TIZEN_MIGRATION
     void FireImpl(void* pArgs);
+#ifdef TIZEN_MIGRATION_RESTENGINE_FIREIMPL_THREAD
+    static void *FireImplThreadFunc(void *pArgs);
+    static void FireImplThreadCleanUp(void *pArgs);
+#endif
 #endif
 
 private:
@@ -209,6 +213,9 @@ private:
     //classes allowed to access this internal instance
     friend class RestItem;
     friend class QueryListener;
+#ifdef TIZEN_SUPPORT_TILE_FILE_CACHE
+    friend class TileFetcherQuery;
+#endif
 
     //members
     class RestEngineImpl;
index 8b325b2cd10a5a1b6f0d97fa8ba94417d953e98f..a0d6910e3cd6a48c0b3ed7b44d1afcf88ddcbf72 100755 (executable)
@@ -270,6 +270,12 @@ public:
      */
     void AbortLoading();
 
+#ifdef TIZEN_SUPPORT_LIMIT_RETRYING_FETCHING_TILES
+    int GetTryCount();
+
+    int SetTryCount(int cnt);
+#endif
+
 private:
     HERE_MAPS_NO_COPY_NO_ASSIGN(GeoTile);
 
index 304ad22d67fe8fb9e674b41345a484f5c3c788a7..9848e35efc9531d9979cb16c9633d28385a33dc5 100755 (executable)
@@ -77,6 +77,34 @@ public:
         MT_Terrain_Day,                 ///< Indicates a terrain day map.
         MT_Hybrid_Day,                  ///< Indicates a hybrid day map        
                                         ///  (satellite, with roads and labels).
+#ifdef TIZEN_MIGRATION
+       MT_Normal_Day_Grey,
+       MT_Normal_Day_Transit,
+       MT_Normal_Night_Transit,
+       MT_Normal_Traffic_Day,
+       MT_Normal_Traffic_Night,
+       MT_Normal_Day_Custom,
+       MT_Normal_Night,
+       MT_Normal_Night_Grey,
+       MT_Pedestrian_Day,
+       MT_Pedestrian_Day_Mobile,
+       MT_Pedestrian_Night,
+       MT_Pedestrian_Night_Mobile,
+       MT_Carnav_Day_Grey,
+       MT_Normal_Day_Mobile,
+       MT_Normal_Day_Grey_Mobile,
+       MT_Normal_Day_Transit_Mobile,
+       MT_Normal_Night_Transit_Mobile,
+       MT_Normal_Night_Mobile,
+       MT_Normal_Night_Grey_Mobile,
+       MT_Reduced_Day,
+       MT_Reduced_Night,
+       MT_Hybrid_Day_Transit,
+       MT_Hybrid_Grey_Day,
+       MT_Hybrid_Traffic_Day,
+       MT_Hybrid_Day_Mobile,
+       MT_Terrain_Day_Mobile,
+#endif
         MT_Last_Entry_Undefined         ///< Indicates that the map type is not
                                         ///  defined. 
     };
@@ -121,7 +149,11 @@ public:
      * 
      * @param zoomLevel A value indicating the new zoom level.
      */
+    #ifdef TIZEN_MIGRATION
+    void SetZoomLevel(double zoomLevel, bool bUpdate=true);
+    #else
     void SetZoomLevel(double zoomLevel);
+    #endif
     
     /**
      * This method retrieves the map zoom level.
@@ -314,11 +346,7 @@ public:
      * @param slot A function object to be called when the map has
      *        been updated. 
      */
-#ifdef TIZEN_MIGRATION
-     void SetUpdateMapSignal(UpdateMapSignalFunctor slot, void *data);
-#else
      void SetUpdateMapSignal(UpdateMapSignalFunctor slot);
-#endif
 
      /**
       * This method sets the map type.
@@ -402,6 +430,13 @@ public:
     void SetEvasGlApi(Evas_GL_API *__glapi);
 #endif
 
+#ifdef TIZEN_SUPPORT_TILE_FILE_CACHE
+    /**
+     * This method invalidates (clears) the file cache for tiles.
+     */
+    void ClearTileFileCache();
+#endif
+
 private:
     bool HandleTileReady(int level, int x, int y, unsigned int uLevelProvider);
     bool DrawLogo(UInt uWidth, UInt uHeight, UInt aMapX = 0, UInt aMapY = 0);
@@ -414,6 +449,9 @@ private:
     int GetDisplayDPI() const;
     void ClearMarkers();
     void SetRootPixmap(DrawableBitmapPtr rootPixmap);
+    #ifdef TIZEN_MIGRATION
+    void ExtendLimitOfCachedTiles();
+    #endif
 
 private:
     friend class GeoMapObject;
diff --git a/inc/engine/tilefetcher/TileFetcherCache.h b/inc/engine/tilefetcher/TileFetcherCache.h
new file mode 100755 (executable)
index 0000000..738ba11
--- /dev/null
@@ -0,0 +1,118 @@
+//
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#ifndef TILEFETCHERCACHE_H
+#define TILEFETCHERCACHE_H
+
+#include <list>
+#include <time.h>
+#include <glib.h>
+#include "common/HereMaps_global.h"
+
+#include "tilefetcher/TileFetcherQueryListener.h"
+#include "common/RestItemHandle.h"
+#include "common/TileKey.h"
+
+
+
+TIZEN_MAPS_BEGIN_NAMESPACE
+
+class TileCache
+{
+public:
+       int hash;
+       long size;
+       long hit;
+       long timestamp;
+
+       TileCache(int _hash, long _size=0, long _hit=0)
+       {
+               hash = _hash;
+               size = _size;
+               hit = _hit;
+
+               time_t _time;
+               time(&_time);
+               timestamp = _time;
+       }
+};
+
+typedef std::list<TileCache> TileCacheList;
+
+class TileFetcherCache
+{
+public:
+       TileFetcherCache();
+
+       virtual ~TileFetcherCache();
+
+       static TileFetcherCache& GetInstance();
+
+       void shutdown();
+
+       bool remove(const int hash);
+
+       bool isFound(const int hash);
+
+       TileCacheList::iterator find(const int hash);
+
+       unsigned long read(const int hash, unsigned char *&buffer, unsigned long &size);
+
+       unsigned long write(const int hash, const unsigned char *buffer, const unsigned long size);
+
+       void clearCache();
+
+       Here::Maps::RestItemHandle::RequestId load(const Here::Maps::TileKey &rKey, Here::Maps::TileFetcherQueryListener &rListener);
+
+       void abort(void *pArg);
+
+       void fire(void *pArg);
+
+private:
+       HERE_MAPS_NO_COPY_NO_ASSIGN(TileFetcherCache);
+
+       void __initCache();
+
+       static bool __compareTileCache(const TileCache& first, const TileCache& second);
+
+       bool __checkCapacity(void);
+
+       bool __isAvailableSpace(void);
+
+       bool __isAvailableCount(void);
+
+       bool __getCachePath(char *path, int size);
+
+       bool __getFilePath(int hash, char *path, int size);
+
+       static gboolean __fireTimer(gpointer data);
+
+       static gboolean __fireIdler(gpointer data);
+
+       static void __timerDestroy(gpointer data);
+
+       static void __idlerDestroy(gpointer data);
+
+       //members
+       class TileFetcherCacheImpl;
+       TileFetcherCacheImpl* m_pImpl;
+
+       char __cachePath[256];
+};
+
+TIZEN_MAPS_END_NAMESPACE
+
+#endif
index f4675f2c1207ffbe6579696fe7336c5d0d9327f2..bbdf05ee3050ed448d574dd3312319f621d1fc69 100644 (file)
@@ -58,6 +58,10 @@ private:
 
     void OnReplySuccess(BaseReply& rReply);
 
+    #ifdef TIZEN_MIGRATION
+    void OnFailure(const BaseReply& rReply);
+    #endif
+
 };
 
 HERE_MAPS_END_NAMESPACE
old mode 100644 (file)
new mode 100755 (executable)
index 6c764ab..c1be63c
@@ -17,6 +17,7 @@
 #define _LOCATION_HERE_API_H_
 
 #include <maps_plugin.h>
+#include <map_view.h>
 
 int HerePluginInit(maps_plugin_h *hPlugin);
 
@@ -76,4 +77,33 @@ int HerePluginSearchRouteWaypoints(const maps_coordinates_h* hWaypointList, int
 
 int HerePluginCancelRequest(int nReqId);
 
-#endif //_LOCATION_HERE_API_H_
\ No newline at end of file
+/* Mapping API */
+
+int HerePluginSetMapView(const map_view_h hView);
+
+int HerePluginRenderMap(const maps_coordinates_h mapsCoord, const double dZoom, const double dAngle,
+       maps_plugin_render_map_cb pCbFunc, void* pUserData, int* nReqId);
+
+int HerePluginRenderMapArea(const maps_area_h hArea, const double dZoom, const double dAngle,
+       maps_plugin_render_map_cb pCbFunc, void* pUserData, int* nReqId);
+
+int HerePluginMoveCenter(const int delta_x, const int delta_y,
+       maps_plugin_render_map_cb pCbFunc, void* pUserData, int* nReqId);
+
+int HerePluginDrawMap(Evas* pCanvas, const int x, const int y,
+       const int nWidth, const int nHeight);
+
+int HerePluginGetCenter(maps_coordinates_h *center);
+
+int HerePluginScreenToGeography(const int x, const int y, maps_coordinates_h *mapsCoord);
+
+int HerePluginGeographyToScreen(const maps_coordinates_h mapsCoord, int *x, int *y);
+
+int HerePluginGetMinZoomLevel(int *nMinZoomLevel);
+
+int HerePluginGetMaxZoomLevel(int *nMaxZoomLevel);
+
+int HerePluginOnViewObject(const map_object_h object,
+                               const map_object_operation_e operation);
+
+#endif //_LOCATION_HERE_API_H_
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
index b44bdd6..7b2467f
@@ -67,10 +67,11 @@ public:
                HERE_SVC_REV_GEOCODE,
                HERE_SVC_PLACE,
                HERE_SVC_ROUTE,
-               HERE_SVC_MULTI_REV_GEOCODE
+               HERE_SVC_MULTI_REV_GEOCODE,
+               HERE_SVC_VIEW
        };
 
-       void* CreateInstance(HereSvcType nHereSvc, void* pCbFunc, void* pUserData, int *nReqId);
+       void* CreateInstance(HereSvcType nHereSvc, void* pCbFunc = NULL, void* pUserData = NULL, int *nReqId = NULL);
        here_error_e CloseInstance(int nReqId);
        here_error_e CancelInstance(int nReqId);
        here_error_e SetCredentials(const char* provider_key);
old mode 100644 (file)
new mode 100755 (executable)
index 8a62ab9..ce2488a
@@ -73,7 +73,7 @@ public:
        here_error_e PrepareDiscoveryPreference(maps_preference_h hPref);
        here_error_e PrepareDiscoveryFilter(maps_place_filter_h hFilter);
 
-       here_error_e StartDiscoveryPlace(maps_coordinates_h hCoord, int nDistance);
+       here_error_e StartDiscoveryPlace(maps_coordinates_h hCoord, const int nDistance);
        here_error_e StartDiscoveryPlace(maps_area_h hArea, const char *szAddr = "");
 
        here_error_e PreparePlaceDetailsQuery();
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
index c46e64d..ebd0656
@@ -30,6 +30,7 @@
 #include <maps_preference.h>
 #include <maps_route_maneuver.h>
 #include <maps_service.h>
+#include <map_view.h>
 
 //plug-in header
 #include "here_types.h"
@@ -42,6 +43,7 @@
 #include <common/GeoCoordinates.h>
 #include <common/GeoBoundingBox.h>
 #include <common/GeoBoundingCircle.h>
+#include <maps/GeoTiledMap.h>
 
 #define HERE_PLUGIN_BEGIN_NAMESPACE  namespace Here { namespace PlugIn {
 #define HERE_PLUGIN_END_NAMESPACE    }}
@@ -127,6 +129,7 @@ public:
        static GeoRouteQuery::FeatureType Convert(maps_route_feature_e nVal);
        static GeoRouteQuery::FeatureWeight Convert(maps_route_feature_weight_e nVal);
        static Maneuver::InstructionDirection Convert(maps_route_turn_type_e nVal);
+       static GeoTiledMap::MapType Convert(map_view_type_e nVal);
        static maps_route_turn_type_e Convert(Maneuver::InstructionDirection nVal);
        static GeoBoundingBox& Convert(maps_area_h hArea, GeoBoundingBox& Box);
        static maps_area_h& Convert(GeoBoundingBox Box, maps_area_h& hArea);
diff --git a/inc/here_view.h b/inc/here_view.h
new file mode 100644 (file)
index 0000000..505404e
--- /dev/null
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef HERE_VIEW_H
+#define HERE_VIEW_H
+
+#include <deque>
+
+//plug-in header
+#include "here_manager.h"
+#include "here_base.h"
+#include "here_view_objects.h"
+
+//maps-service header
+#include <maps_service.h>
+#include <map_view.h>
+
+//map engine header
+#include <maps/GeoTiledMap.h>
+#include <Ecore.h>
+#include <Ecore_Evas.h>
+#include <graphic/Grp_Util.h>
+#include <maps/GeoMapObjectMarker.h>
+#include <maps/GeoMapObjectPolygon.h>
+#include <maps/GeoMapObjectPolyline.h>
+
+HERE_PLUGIN_BEGIN_NAMESPACE
+
+using namespace HERE_MAPS_NAMESPACE_PREFIX;
+
+
+typedef struct _GLData
+{
+       Here::Maps::GeoTiledMap *map;
+
+       Evas_Object     *img;
+       Evas_GL_Context *ctx;
+       Evas_GL_Surface *sfc;
+       Evas_GL_Config  *cfg;
+       Evas_GL         *gl;
+       Evas_GL_API     *api;
+
+       bool isInitialized;
+
+       int x, y, w, h;
+       double lat, lng, zoom, angle;
+
+       map_view_h hView;
+
+       // to remove // UpdatedObjects updatedObjects;
+       HereViewObjects visualObjects;
+       PendingObjects pendingObjects;
+       Ecore_Idler *idler;
+       bool redraw;
+} GLData;
+
+
+class HereView
+: public HereBase
+{
+public:
+       HereView(void *pCbFunc, void *pUserData, int nReqId);
+       ~HereView();
+
+       here_error_e Init(map_view_h hView);
+       static here_error_e Close();
+       here_error_e RenderMap(const maps_coordinates_h mapsCoord, const double dZoom, const double dAngle);
+       here_error_e RenderMapByArea(const maps_area_h hArea, const double dZoom, const double dAngle);
+       static here_error_e DrawMap(Evas* pCanvas, const int x, const int y, const int nWidth, const int nHeight);
+       here_error_e MoveCenter(const int delta_x, const int delta_y);
+       here_error_e GetCenter(maps_coordinates_h *center);
+       here_error_e ScreenToGeography(const int x, const int y, maps_coordinates_h *mapsCoord);
+       here_error_e GeographyToScreen(const maps_coordinates_h mapsCoord, int *x, int *y);
+
+       static here_error_e GetMinZoomLevel(int *nMinZoomLevel);
+       static here_error_e GetMaxZoomLevel(int *nMaxZoomLevel);
+       static here_error_e OnViewObject(const map_object_h object, const map_object_operation_e operation);
+
+       here_error_e AddObject(map_object_h obj);
+       static void RenderingCb(void *data);
+       static bool foreachObject(int index, int total, map_object_h object, void *user_data);
+       static GLData* GetImplHandler();
+
+private:
+
+       here_error_e InitOpenGL(GLData *gld);
+       here_error_e InitOpenGLSurface(GLData *gld);
+       here_error_e InitMap(GLData *gld);
+       static Eina_Bool __idlerCb(void *data);
+       static void __renderingCb(void *data);
+       static void __pixelGetCb(void *data, Evas_Object *obj);
+       static void __processViewObject(const map_object_h object, const map_object_operation_e operation);
+
+       static GLData *m_pImpl;
+
+};
+
+HERE_PLUGIN_END_NAMESPACE
+
+#endif
diff --git a/inc/here_view_objects.h b/inc/here_view_objects.h
new file mode 100755 (executable)
index 0000000..1cb44ff
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef HERE_VIEW_OBJECTS_H
+#define HERE_VIEW_OBJECTS_H
+
+#include <deque>
+
+//plug-in header
+#include "here_manager.h"
+#include "here_base.h"
+
+//maps-service header
+#include <maps_service.h>
+#include <map_view.h>
+
+//map engine header
+#include <maps/GeoTiledMap.h>
+#include <maps/GeoMapObjectMarker.h>
+#include <maps/GeoMapObjectPolygon.h>
+#include <maps/GeoMapObjectPolyline.h>
+
+
+HERE_PLUGIN_BEGIN_NAMESPACE
+
+using namespace HERE_MAPS_NAMESPACE_PREFIX;
+
+
+typedef std::map<map_object_h, const GeoMapObject*> VisualObjects;
+typedef std::pair<map_object_h, const map_object_operation_e> PendingObject;
+typedef std::deque<PendingObject> PendingObjects;
+// to remove // typedef std::deque<map_object_h> UpdatedObjects;
+
+class HereViewObjects
+{
+public:
+       HereViewObjects();
+       virtual ~HereViewObjects();
+
+       void set(GeoTiledMap *map, Evas *evas);
+       // to remove // void update(UpdatedObjects objects);
+
+       here_error_e add(map_object_h hObj);
+       here_error_e move(map_object_h hObj);
+       here_error_e update(map_object_h hObj);
+       here_error_e setVisible(map_object_h hObj);
+       here_error_e remove(map_object_h hObj);
+       here_error_e removeAll();
+
+private:
+       here_error_e __add(map_object_h hObj);
+       here_error_e __remove(map_object_h hObj);
+       here_error_e __update(map_object_h hObj, GeoMapObject *hereObject);
+       here_error_e __updateMarker(map_object_h hMarker, GeoMapObjectMarker *hereMarker);
+       here_error_e __updatePolygon(map_object_h hPolygon, GeoMapObjectPolygon *herePolygon);
+       here_error_e __updatePolyline(map_object_h hPolyline, GeoMapObjectPolyline *herePolyline);
+       here_error_e __updateRoute(map_object_h hRoute);
+       here_error_e __setVisible(map_object_h hObj, bool bVisible);
+
+       static bool __foreachForCoordinates(int index, maps_coordinates_h coordinates, void *user_data);
+       static bool __foreachForAddingGroupObjects(int index, int total, map_object_h object, void *user_data);
+       static bool __foreachForRemovingGroupObjects(int index, int total, map_object_h object, void *user_data);
+       static bool __foreachForUpdatingGroupObjects(int index, int total, map_object_h object, void *user_data);
+       static bool __foreachForSettingVisibleGroupObjects(int index, int total, map_object_h object, void *user_data);
+
+       VisualObjects __currentObjects;
+       GeoTiledMap *__map;
+       Evas *__evas;
+       pthread_mutex_t __mutex;
+};
+
+HERE_PLUGIN_END_NAMESPACE
+
+#endif /* HERE_VIEW_OBJECTS_H */
+
index ece39bdaa903e7ca070e5e77fb2b4fbfec5b71ee..0653c319807896ffe6f91c1b6aa348fb4ef55541 120000 (symlink)
@@ -1 +1 @@
-libheremaps-engine.so.1.0.6_9
\ No newline at end of file
+libheremaps-engine.so.1.0.6_10
\ No newline at end of file
diff --git a/lib/aarch64/libheremaps-engine.so.1.0.6_10 b/lib/aarch64/libheremaps-engine.so.1.0.6_10
new file mode 100755 (executable)
index 0000000..db26c6d
Binary files /dev/null and b/lib/aarch64/libheremaps-engine.so.1.0.6_10 differ
diff --git a/lib/aarch64/libheremaps-engine.so.1.0.6_9 b/lib/aarch64/libheremaps-engine.so.1.0.6_9
deleted file mode 100755 (executable)
index dec06a3..0000000
Binary files a/lib/aarch64/libheremaps-engine.so.1.0.6_9 and /dev/null differ
index ece39bdaa903e7ca070e5e77fb2b4fbfec5b71ee..0653c319807896ffe6f91c1b6aa348fb4ef55541 120000 (symlink)
@@ -1 +1 @@
-libheremaps-engine.so.1.0.6_9
\ No newline at end of file
+libheremaps-engine.so.1.0.6_10
\ No newline at end of file
diff --git a/lib/arm/libheremaps-engine.so.1.0.6_10 b/lib/arm/libheremaps-engine.so.1.0.6_10
new file mode 100755 (executable)
index 0000000..45b4597
Binary files /dev/null and b/lib/arm/libheremaps-engine.so.1.0.6_10 differ
diff --git a/lib/arm/libheremaps-engine.so.1.0.6_9 b/lib/arm/libheremaps-engine.so.1.0.6_9
deleted file mode 100755 (executable)
index bb449cb..0000000
Binary files a/lib/arm/libheremaps-engine.so.1.0.6_9 and /dev/null differ
index ece39bdaa903e7ca070e5e77fb2b4fbfec5b71ee..0653c319807896ffe6f91c1b6aa348fb4ef55541 120000 (symlink)
@@ -1 +1 @@
-libheremaps-engine.so.1.0.6_9
\ No newline at end of file
+libheremaps-engine.so.1.0.6_10
\ No newline at end of file
diff --git a/lib/i586/libheremaps-engine.so.1.0.6_10 b/lib/i586/libheremaps-engine.so.1.0.6_10
new file mode 100755 (executable)
index 0000000..555119e
Binary files /dev/null and b/lib/i586/libheremaps-engine.so.1.0.6_10 differ
diff --git a/lib/i586/libheremaps-engine.so.1.0.6_9 b/lib/i586/libheremaps-engine.so.1.0.6_9
deleted file mode 100755 (executable)
index 46f5e30..0000000
Binary files a/lib/i586/libheremaps-engine.so.1.0.6_9 and /dev/null differ
index ece39bdaa903e7ca070e5e77fb2b4fbfec5b71ee..0653c319807896ffe6f91c1b6aa348fb4ef55541 120000 (symlink)
@@ -1 +1 @@
-libheremaps-engine.so.1.0.6_9
\ No newline at end of file
+libheremaps-engine.so.1.0.6_10
\ No newline at end of file
diff --git a/lib/x86_64/libheremaps-engine.so.1.0.6_10 b/lib/x86_64/libheremaps-engine.so.1.0.6_10
new file mode 100755 (executable)
index 0000000..2441f32
Binary files /dev/null and b/lib/x86_64/libheremaps-engine.so.1.0.6_10 differ
diff --git a/lib/x86_64/libheremaps-engine.so.1.0.6_9 b/lib/x86_64/libheremaps-engine.so.1.0.6_9
deleted file mode 100755 (executable)
index 7f478d9..0000000
Binary files a/lib/x86_64/libheremaps-engine.so.1.0.6_9 and /dev/null differ
index 9c80636c8ead53533dc34f8d92cb4b14a3a7945c..03a614d89e777b698d3a0e94890af27008f8310a 100644 (file)
@@ -32,6 +32,9 @@ BuildRequires: pkgconfig(json-c)
 BuildRequires: pkgconfig(libpng)
 BuildRequires: pkgconfig(cairo)
 BuildRequires: boost-devel
+BuildRequires: capi-maps-service-devel
+BuildRequires: elementary-devel
+BuildRequires: pkgconfig(ecore-evas)
 #
 Requires(post): /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
old mode 100644 (file)
new mode 100755 (executable)
index fdcc8ad..8da4a07
@@ -22,6 +22,7 @@
 #include "here_place.h"
 #include "here_route.h"
 #include <common/HereConfig.h>
+#include "here_view.h"
 
 using namespace HERE_PLUGIN_NAMESPACE_PREFIX;
 
@@ -57,9 +58,7 @@ int HerePluginSetProviderKey(const char* szKey)
        if (!HereManager::GetHandler())
                return HERE_ERROR_INVALID_OPERATION;
 
-       here_error_e error = HereManager::GetHandler()->SetCredentials(szKey);
-
-       return error;
+       return HereManager::GetHandler()->SetCredentials(szKey);
 }
 
 int HerePluginGetProviderKey(char** szKey)
@@ -70,9 +69,7 @@ int HerePluginGetProviderKey(char** szKey)
        if (!HereManager::GetHandler())
                return HERE_ERROR_INVALID_OPERATION;
 
-       here_error_e error = HereManager::GetHandler()->GetCredentials(szKey);
-
-       return error;
+       return HereManager::GetHandler()->GetCredentials(szKey);
 }
 
 int HerePluginSetPreference(maps_preference_h hPref)
@@ -83,9 +80,7 @@ int HerePluginSetPreference(maps_preference_h hPref)
        if (!HereManager::GetHandler())
                return HERE_ERROR_INVALID_OPERATION;
 
-       here_error_e error = HereManager::GetHandler()->SetPreference(hPref);
-
-       return error;
+       return HereManager::GetHandler()->SetPreference(hPref);
 }
 
 int HerePluginGetPreference(maps_preference_h *hPref)
@@ -96,9 +91,7 @@ int HerePluginGetPreference(maps_preference_h *hPref)
        if (!HereManager::GetHandler())
                return HERE_ERROR_INVALID_OPERATION;
 
-       here_error_e error = HereManager::GetHandler()->GetPreference(hPref);
-
-       return error;
+       return HereManager::GetHandler()->GetPreference(hPref);
 }
 
 int HerePluginGeocode(const char* szAddr,
@@ -583,3 +576,185 @@ int HerePluginCancelRequest(int nReqId)
 
        return (HereManager::GetHandler()->CancelInstance(nReqId));
 }
+
+int HerePluginSetMapView(const map_view_h hView)
+{
+       if (!HereManager::GetHandler())
+               return HERE_ERROR_INVALID_OPERATION;
+
+       /* creating instance */
+       HereView *pView =
+               (HereView*)(HereManager::GetHandler()->CreateInstance(HereManager::HERE_SVC_VIEW));
+
+       if(!pView)
+               return HERE_ERROR_SERVICE_NOT_AVAILABLE;
+
+       /* sending request */
+       here_error_e error = HERE_ERROR_NONE;
+
+       if (hView)
+               error = pView->Init(hView);
+       else
+               error = pView->Close();
+
+       delete pView;
+
+       return error;
+}
+
+int HerePluginRenderMap(const maps_coordinates_h mapsCoord, const double dZoom, const double dAngle,
+       maps_plugin_render_map_cb pCbFunc, void* pUserData, int* nReqId)
+{
+       if (!mapsCoord || !pCbFunc || !nReqId)
+               return HERE_ERROR_INVALID_PARAMETER;
+
+       if (!HereManager::GetHandler())
+               return HERE_ERROR_INVALID_OPERATION;
+
+       HereView *pView =
+               (HereView*)(HereManager::GetHandler()->CreateInstance(HereManager::HERE_SVC_VIEW,
+               (void*)pCbFunc, pUserData, nReqId));
+
+       if(!pView)
+               return HERE_ERROR_SERVICE_NOT_AVAILABLE;
+
+       /* sending request */
+       here_error_e error = pView->RenderMap(mapsCoord, dZoom, dAngle);
+       delete pView;
+
+       return error;
+}
+
+int HerePluginRenderMapArea(const maps_area_h hArea, const double dZoom, const double dAngle,
+       maps_plugin_render_map_cb pCbFunc, void* pUserData, int* nReqId)
+{
+       if (!hArea || !pCbFunc || !nReqId)
+               return HERE_ERROR_INVALID_PARAMETER;
+
+       if (!HereManager::GetHandler())
+               return HERE_ERROR_INVALID_OPERATION;
+
+       HereView *pView =
+               (HereView*)(HereManager::GetHandler()->CreateInstance(HereManager::HERE_SVC_VIEW,
+               (void*)pCbFunc, pUserData, nReqId));
+
+       if(!pView)
+               return HERE_ERROR_SERVICE_NOT_AVAILABLE;
+
+       /* sending request */
+       here_error_e error = pView->RenderMapByArea(hArea, dZoom, dAngle);
+       delete pView;
+
+       return error;
+}
+
+int HerePluginMoveCenter(const int delta_x, const int delta_y,
+       maps_plugin_render_map_cb pCbFunc, void* pUserData, int* nReqId)
+{
+       if (!pCbFunc || !nReqId)
+               return HERE_ERROR_INVALID_PARAMETER;
+
+       if (!HereManager::GetHandler())
+               return HERE_ERROR_INVALID_OPERATION;
+
+       HereView *pView =
+               (HereView*)(HereManager::GetHandler()->CreateInstance(HereManager::HERE_SVC_VIEW,
+               (void*)pCbFunc, pUserData, nReqId));
+
+       if(!pView)
+               return HERE_ERROR_SERVICE_NOT_AVAILABLE;
+
+       /* sending request */
+       here_error_e error = pView->MoveCenter(delta_x, delta_y);
+       delete pView;
+
+       return error;
+}
+
+int HerePluginDrawMap(Evas* pCanvas, const int x, const int y,
+       const int nWidth, const int nHeight)
+{
+       return HERE_ERROR_NONE;
+}
+
+int HerePluginGetCenter(maps_coordinates_h *center)
+{
+       if (!center)
+               return HERE_ERROR_INVALID_PARAMETER;
+
+       if (!HereManager::GetHandler())
+               return HERE_ERROR_INVALID_OPERATION;
+
+       /* creating instance */
+       HereView *pView =
+               (HereView*)(HereManager::GetHandler()->CreateInstance(HereManager::HERE_SVC_VIEW));
+
+       if(!pView)
+               return HERE_ERROR_SERVICE_NOT_AVAILABLE;
+
+       /* sending request */
+       here_error_e error = pView->GetCenter(center);
+       delete pView;
+
+       return error;
+}
+
+int HerePluginScreenToGeography(const int x, const int y, maps_coordinates_h *mapsCoord)
+{
+       if (!mapsCoord)
+               return HERE_ERROR_INVALID_PARAMETER;
+
+       if (!HereManager::GetHandler())
+               return HERE_ERROR_INVALID_OPERATION;
+
+       /* creating instance */
+       HereView *pView =
+               (HereView*)(HereManager::GetHandler()->CreateInstance(HereManager::HERE_SVC_VIEW));
+
+       if(!pView)
+               return HERE_ERROR_SERVICE_NOT_AVAILABLE;
+
+       /* sending request */
+       here_error_e error = pView->ScreenToGeography(x, y, mapsCoord);
+       delete pView;
+
+       return error;
+}
+
+int HerePluginGeographyToScreen(const maps_coordinates_h mapsCoord, int *x, int *y)
+{
+       if (!mapsCoord || !x || !y)
+               return HERE_ERROR_INVALID_PARAMETER;
+
+       if (!HereManager::GetHandler())
+               return HERE_ERROR_INVALID_OPERATION;
+
+       /* creating instance */
+       HereView *pView =
+               (HereView*)(HereManager::GetHandler()->CreateInstance(HereManager::HERE_SVC_VIEW));
+
+       if(!pView)
+               return HERE_ERROR_SERVICE_NOT_AVAILABLE;
+
+       /* sending request */
+       here_error_e error = pView->GeographyToScreen(mapsCoord, x, y);
+       delete pView;
+
+       return error;
+}
+
+int HerePluginGetMinZoomLevel(int *nMinZoomLevel)
+{
+       return HereView::GetMinZoomLevel(nMinZoomLevel);
+}
+
+int HerePluginGetMaxZoomLevel(int *nMaxZoomLevel)
+{
+       return HereView::GetMaxZoomLevel(nMaxZoomLevel);
+}
+
+int HerePluginOnViewObject(const map_object_h object,
+                          const map_object_operation_e operation)
+{
+       return HereView::OnViewObject(object, operation);
+}
old mode 100644 (file)
new mode 100755 (executable)
index 50c256d..59f0632
@@ -26,6 +26,7 @@
 #include "here_route.h"
 #include "here_utils.h"
 #include <common/HereConfig.h>
+#include "here_view.h"
 #include <app.h>
 #include <iostream>
 #include <fstream>
@@ -112,28 +113,32 @@ void* HereManager::CreateInstance(HereSvcType nHereSvc, void* pCbFunc,
 {
        HereBase *pHere = NULL;
 
-       *nReqId = m_nNextReqId++;
+       int reqId = m_nNextReqId++;
+       if (nReqId) *nReqId = reqId;
 
        switch(nHereSvc)
        {
        case HERE_SVC_GEOCODE:
-               pHere = (HereBase*)new (std::nothrow) HereGeocode(pCbFunc, pUserData, *nReqId);
+               pHere = (HereBase*)new (std::nothrow) HereGeocode(pCbFunc, pUserData, reqId);
                break;
 
        case HERE_SVC_REV_GEOCODE:
-               pHere = (HereBase*)new (std::nothrow) HereRevGeocode(pCbFunc, pUserData, *nReqId);
+               pHere = (HereBase*)new (std::nothrow) HereRevGeocode(pCbFunc, pUserData, reqId);
                break;
 
        case HERE_SVC_PLACE:
-               pHere = (HereBase*)new (std::nothrow) HerePlace(pCbFunc, pUserData, *nReqId);
+               pHere = (HereBase*)new (std::nothrow) HerePlace(pCbFunc, pUserData, reqId);
                break;
 
        case HERE_SVC_ROUTE:
-               pHere = (HereBase*)new (std::nothrow) HereRoute(pCbFunc, pUserData, *nReqId);
+               pHere = (HereBase*)new (std::nothrow) HereRoute(pCbFunc, pUserData, reqId);
                break;
 
        case HERE_SVC_MULTI_REV_GEOCODE:
                pHere = (HereBase*)new (std::nothrow) HereMultiRevGeocode(pCbFunc, pUserData, *nReqId);
+
+       case HERE_SVC_VIEW:
+               pHere = (HereBase*)new (std::nothrow) HereView(pCbFunc, pUserData, reqId);
                break;
 
        default:
old mode 100644 (file)
new mode 100755 (executable)
index 6ce6344..e0b859f
@@ -131,13 +131,16 @@ here_error_e HerePlace::PrepareDiscoveryFilter(maps_place_filter_h hFilter)
 
                ret = maps_place_category_get_id(mapsCate, &szId);
                if (ret == MAPS_ERROR_NONE && szId && *szId)
-               {
                        hereCate.SetCategoryId(CategoryId(szId));
-                       hereCateList.push_back(hereCate);
-                       m_pDiscoveryQuery->SetCategoriesFilter(hereCateList);
+               else if (hereCate.GetTitle().size() > 0)
+               {
+                       hereCate.SetCategoryId(CategoryId(hereCate.GetTitle()));
+                       hereCate.SetTitle("");
                }
                g_free(szId);
 
+               hereCateList.push_back(hereCate);
+               m_pDiscoveryQuery->SetCategoriesFilter(hereCateList);
                maps_place_category_destroy(mapsCate);
        }
 
@@ -147,6 +150,17 @@ here_error_e HerePlace::PrepareDiscoveryFilter(maps_place_filter_h hFilter)
                m_pDiscoveryQuery->SetSearchText(szName);
        g_free(szName);
 
+       char *szKeyword = NULL;
+       ret = maps_place_filter_get_keyword(hFilter, &szKeyword);
+       if (ret == MAPS_ERROR_NONE && szKeyword && *szKeyword)
+       {
+               String szSearchText = m_pDiscoveryQuery->GetSearchText();
+               if (szSearchText.size() > 0) szSearchText += " ";
+               szSearchText += szKeyword;
+               m_pDiscoveryQuery->SetSearchText(szSearchText);
+       }
+       g_free(szKeyword);
+
        return HERE_ERROR_NONE;
 }
 
@@ -155,8 +169,9 @@ here_error_e HerePlace::StartDiscoveryPlace(maps_coordinates_h hCoord, int nDist
        if (!hCoord || nDistance < 0)
                return HERE_ERROR_INVALID_PARAMETER;
 
+       int meters = (int)(HereUtils::ConvertDistance(nDistance, m_eDistanceUnit, MAPS_DISTANCE_UNIT_M) + 0.5);
        maps_area_h area = NULL;
-       maps_area_create_circle(hCoord, nDistance, &area);
+       maps_area_create_circle(hCoord, meters, &area);
        here_error_e error = StartDiscoveryPlace(area);
        maps_area_destroy(area);
        return error;
@@ -185,12 +200,13 @@ here_error_e HerePlace::StartDiscoveryPlace(maps_area_h hArea, const char *szAdd
        GeoBoundingBox geoBox;
        GeoBoundingCircle geoCircle;
 
+
        /* Merge search text with other search text being in preference */
-       String szSearchText = szAddr;
-       if (m_pDiscoveryQuery->GetSearchText().size() > 0 &&
-               szSearchText != m_pDiscoveryQuery->GetSearchText())
+       String szSearchText = (szAddr ? szAddr : "");
+       if (m_pDiscoveryQuery->GetSearchText().size() > 0)
        {
-               szSearchText += " " + m_pDiscoveryQuery->GetSearchText();
+               if (szSearchText.size() > 0) szSearchText += " ";
+               szSearchText += m_pDiscoveryQuery->GetSearchText();
        }
        m_pDiscoveryQuery->SetSearchText(szSearchText);
 
@@ -449,7 +465,8 @@ void HerePlace::OnDiscoverReply (const DiscoveryReply &Reply)
                        }
 
                        /* distance */
-                       maps_place_set_distance(mapsPlace, HereUtils::ConvertDistance((int)herePlaceIt->GetDistance(), m_eDistanceUnit));
+                       maps_place_set_distance(mapsPlace,
+                               HereUtils::ConvertDistance((int)herePlaceIt->GetDistance(), m_eDistanceUnit) + 0.5);
 
                        /* sponser */
                        /* herePlaceList.GetIsSponsored() */
old mode 100644 (file)
new mode 100755 (executable)
index 55898a3..b10bdba
@@ -261,5 +261,113 @@ EXPORT_API int maps_plugin_cancel_request(int request_id)
        return ConvertToMapsError(ret);
 }
 
+/* Mapping */
+EXPORT_API int maps_plugin_set_map_view(const map_view_h view)
+{
+       int ret = HerePluginSetMapView(view);
+
+       MAPS_LOGD("here_error_e = %d", ret);
+
+       return ConvertToMapsError(ret);
+}
+
+EXPORT_API int maps_plugin_render_map(const maps_coordinates_h coordinates,
+                                       const double zoom_factor,
+                                       const double rotation_angle,
+                                       maps_plugin_render_map_cb callback,
+                                       void* user_data,
+                                       int* request_id)
+
+{
+       int ret = HerePluginRenderMap(coordinates, zoom_factor, rotation_angle,
+                                       callback, user_data, request_id);
+
+       if (ret != HERE_ERROR_NONE)
+               MAPS_LOGD("here_error_e = %d", ret);
+
+       return ConvertToMapsError(ret);
+}
+
+EXPORT_API int maps_plugin_render_map_area(const maps_area_h area,
+                                       const double zoom_factor,
+                                       const double rotation_angle,
+                                       maps_plugin_render_map_cb callback,
+                                       void* user_data,
+                                       int* request_id)
+{
+       int ret = HerePluginRenderMapArea(area, zoom_factor, rotation_angle,
+                                       callback, user_data, request_id);
+
+       if (ret != HERE_ERROR_NONE)
+               MAPS_LOGD("here_error_e = %d", ret);
+
+       return ConvertToMapsError(ret);
+}
+
+EXPORT_API int maps_plugin_move_center(const int delta_x, const int delta_y,
+                                       maps_plugin_render_map_cb callback,
+                                       void* user_data,
+                                       int* request_id)
+{
+       int ret = HerePluginMoveCenter(delta_x, delta_y,
+                                       callback, user_data, request_id);
+
+       if (ret != HERE_ERROR_NONE)
+               MAPS_LOGD("here_error_e = %d", ret);
+
+       return ConvertToMapsError(ret);
+}
+
+EXPORT_API int maps_plugin_draw_map(Evas* canvas, const int x, const int y,
+                                   const int width, const int height)
+{
+       int ret = HerePluginDrawMap(canvas, x, y, width, height);
+
+       if (ret != HERE_ERROR_NONE)
+               MAPS_LOGD("here_error_e = %d", ret);
+
+       return ConvertToMapsError(ret);
+}
+
+EXPORT_API int maps_plugin_get_center(maps_coordinates_h *center)
+{
+       int ret = HerePluginGetCenter(center);
+       return ConvertToMapsError(ret);
+}
+
+EXPORT_API int maps_plugin_screen_to_geography(const int x, const int y,
+                                              maps_coordinates_h *mapsCoord)
+{
+       int ret = HerePluginScreenToGeography(x, y, mapsCoord);
+       return ConvertToMapsError(ret);
+}
+
+EXPORT_API int maps_plugin_geography_to_screen(const maps_coordinates_h mapsCoord,
+                                              int* x, int* y)
+{
+       int ret = HerePluginGeographyToScreen(mapsCoord, x, y);
+       return ConvertToMapsError(ret);
+}
+
+EXPORT_API int maps_plugin_get_min_zoom_level(int *min_zoom_level)
+{
+       int ret = HerePluginGetMinZoomLevel(min_zoom_level);
+       return ConvertToMapsError(ret);
+}
+
+EXPORT_API int maps_plugin_get_max_zoom_level(int *max_zoom_level)
+{
+       int ret = HerePluginGetMaxZoomLevel(max_zoom_level);
+       return ConvertToMapsError(ret);
+}
+
+EXPORT_API int maps_plugin_on_object(const map_object_h object,
+                              const map_object_operation_e operation)
+{
+       int ret = HerePluginOnViewObject(object, operation);
+       return ConvertToMapsError(ret);
+}
+
+
 } // end of extern "C"
 
old mode 100644 (file)
new mode 100755 (executable)
index 07680b8..c945ec5
@@ -224,6 +224,31 @@ Maneuver::InstructionDirection HereUtils::Convert(maps_route_turn_type_e nVal)
        return Maneuver::ID_NoDirection;
 }
 
+GeoTiledMap::MapType HereUtils::Convert(map_view_type_e nVal)
+{
+       switch (nVal)
+       {
+               case MAP_VIEW_TYPE_DAY:
+                       return GeoTiledMap::MT_Normal_Day;
+               case MAP_VIEW_TYPE_SATELLITE:
+                       return GeoTiledMap::MT_Satellite_Day;
+               case MAP_VIEW_TYPE_TRANSIT:
+                       return GeoTiledMap::MT_Normal_Day_Transit;
+               case MAP_VIEW_TYPE_TRAFFIC:
+                       return GeoTiledMap::MT_Normal_Traffic_Day;
+               case MAP_VIEW_TYPE_HYBRID_DAY:
+                       return GeoTiledMap::MT_Hybrid_Day;
+               case MAP_VIEW_TYPE_HYBRID_TRANSIT:
+                       return GeoTiledMap::MT_Hybrid_Day_Transit;
+               case MAP_VIEW_TYPE_HYBRID_TRAFFIC:
+                       return GeoTiledMap::MT_Hybrid_Traffic_Day;
+               case MAP_VIEW_TYPE_TERRAIN:   
+                       return GeoTiledMap::MT_Terrain_Day;
+               default: break;
+       }
+       return GeoTiledMap::MT_Normal_Day;
+}
+
 maps_error_e HereUtils::ConvertHttpCodeToMapsError(int nVal)
 {
        switch (nVal)
diff --git a/src/here_view.cpp b/src/here_view.cpp
new file mode 100755 (executable)
index 0000000..97684ec
--- /dev/null
@@ -0,0 +1,582 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "here_view.h"
+#include <Elementary.h>
+
+using namespace HERE_PLUGIN_NAMESPACE_PREFIX;
+
+static const char SIG_LOADED[] = "loaded";
+
+
+HERE_PLUGIN_BEGIN_NAMESPACE
+
+GLData *HereView::m_pImpl = NULL;
+
+HereView::HereView(void *pCbFunc, void *pUserData, int nReqId)
+{
+       m_pCbFunc = pCbFunc;
+       m_pUserData = pUserData;
+       m_nReqId = nReqId;
+}
+
+HereView::~HereView()
+{
+}
+
+GLData* HereView::GetImplHandler()
+{
+       return m_pImpl;
+}
+
+here_error_e HereView::Init(map_view_h hView)
+{
+       if (!hView)
+               return HERE_ERROR_INVALID_PARAMETER;
+
+       if (m_pImpl)
+               return HERE_ERROR_INVALID_OPERATION;
+
+       if (!m_pImpl)
+       {
+               m_pImpl = new (std::nothrow) GLData();
+
+               if (!m_pImpl)
+                       return HERE_ERROR_INVALID_PARAMETER;
+
+               m_pImpl->idler = ecore_idler_add(__idlerCb, (void*)m_pImpl);
+       }
+
+       here_error_e error = HERE_ERROR_NONE;
+       int error2 = MAPS_ERROR_NONE;
+
+       do {
+               error2 = map_view_get_port(hView, &m_pImpl->img);
+               if (error2 != MAPS_ERROR_NONE) break;
+
+               error2 = map_view_get_geometry(hView, &m_pImpl->x, &m_pImpl->y, &m_pImpl->w, &m_pImpl->h);
+               if (error2 != MAPS_ERROR_NONE) break;
+
+               m_pImpl->hView = hView;
+
+               error = InitOpenGL(m_pImpl);
+               if (error != HERE_ERROR_NONE) break;
+
+               error = InitOpenGLSurface(m_pImpl);
+               if (error != HERE_ERROR_NONE) break;
+
+               error = InitMap(m_pImpl);
+       } while(0);
+
+       if (error == HERE_ERROR_NONE && error2 != MAPS_ERROR_NONE)
+               error = (here_error_e)ConvertToHereError(error2);
+
+       return error;
+}
+
+here_error_e HereView::InitOpenGL(GLData *gld)
+{
+       if (!gld)
+               return HERE_ERROR_INVALID_PARAMETER;
+
+
+       gld->cfg = evas_gl_config_new();
+       if (!gld->cfg)
+       {
+               MAPS_LOGE("evas_gl_config_new() failed");
+               return HERE_ERROR_SERVICE_NOT_AVAILABLE;
+       }
+
+       gld->cfg->color_format = EVAS_GL_RGBA_8888;    // Surface Color Format
+       gld->cfg->depth_bits   = EVAS_GL_DEPTH_NONE;   // Surface Depth Format
+       gld->cfg->stencil_bits = EVAS_GL_STENCIL_NONE; // Surface Stencil Format
+       gld->cfg->options_bits = EVAS_GL_OPTIONS_DIRECT; // Configuration options (here, no extra options)
+
+       gld->gl = evas_gl_new(evas_object_evas_get(gld->img));
+       if (!gld->gl)
+       {
+               MAPS_LOGE("evas_gl_new() failed");
+               return HERE_ERROR_SERVICE_NOT_AVAILABLE;
+       }
+
+       gld->api = evas_gl_api_get(gld->gl);
+       if (!gld->api)
+       {
+               MAPS_LOGE("evas_gl_api_get() failed");
+               return HERE_ERROR_SERVICE_NOT_AVAILABLE;
+       }
+
+       gld->ctx = evas_gl_context_create(gld->gl, NULL);
+       if (!gld->ctx)
+       {
+               MAPS_LOGE("evas_gl_context_create() failed");
+               return HERE_ERROR_SERVICE_NOT_AVAILABLE;
+       }
+
+       return HERE_ERROR_NONE;
+}
+
+here_error_e HereView::InitOpenGLSurface(GLData *gld)
+{
+       if (!gld || !gld->gl || !gld->cfg || !gld->img || !gld->ctx)
+               return HERE_ERROR_INVALID_PARAMETER;
+
+
+       evas_object_image_pixels_get_callback_set(gld->img, NULL, NULL);
+
+       if (gld->sfc)
+       {
+               evas_object_image_native_surface_set(gld->img, NULL);
+               evas_gl_surface_destroy(gld->gl, gld->sfc);
+       }
+
+       m_pImpl->w = MAX(m_pImpl->w, 1);
+       m_pImpl->h = MAX(m_pImpl->h, 1);
+
+       evas_object_image_size_set(gld->img, gld->w, gld->h);
+
+       Evas_Native_Surface ns;
+       gld->sfc = evas_gl_surface_create(gld->gl, gld->cfg, gld->w, gld->h);
+       if (!gld->sfc)
+       {
+               MAPS_LOGE("evas_gl_surface_create() failed");
+               return HERE_ERROR_SERVICE_NOT_AVAILABLE;
+       }
+
+       if (!evas_gl_native_surface_get(gld->gl, gld->sfc, &ns))
+       {
+               evas_gl_make_current(gld->gl, NULL, NULL);
+               evas_gl_surface_destroy(gld->gl, gld->sfc);
+               gld->sfc = NULL;
+               MAPS_LOGE("evas_gl_native_surface_get() faile");
+               return HERE_ERROR_SERVICE_NOT_AVAILABLE;
+       }
+
+       evas_object_image_native_surface_set(gld->img, &ns);
+
+       evas_object_image_pixels_get_callback_set(gld->img, __pixelGetCb, this);
+
+       gld->isInitialized = true;
+       //MAPS_LOGD("initializing is Done!!!");
+
+       return HERE_ERROR_NONE;
+}
+
+here_error_e HereView::InitMap(GLData *gld)
+{
+       if (!gld)
+               return HERE_ERROR_INVALID_PARAMETER;
+
+       gld->map = new (std::nothrow) GeoTiledMap();
+
+       if (!gld->map)
+               return HERE_ERROR_OUT_OF_MEMORY;
+
+       gld->map->SetEvasGlApi(gld->api);
+
+       MAPS_LOGD("gld->api=%p, m_pImpl->api=%p", gld->api, m_pImpl->api);
+
+       gld->map->SetMapSize(Dimension(gld->w,gld->h));
+
+       //gld->map->SetUpdateMapSignal(RenderingCb, this);
+
+       m_pImpl->visualObjects.set(gld->map, evas_object_evas_get(gld->img));
+
+       return HERE_ERROR_NONE;
+}
+
+here_error_e HereView::Close()
+{
+       if (m_pImpl)
+       {
+               m_pImpl->isInitialized = false;
+
+               if (m_pImpl->map)
+               {
+                       m_pImpl->map->SetUpdateMapSignal(NULL);
+               }
+
+               m_pImpl->visualObjects.set(NULL, NULL);
+
+               if (m_pImpl->img)
+               {
+                       evas_object_image_pixels_get_callback_set(m_pImpl->img, NULL, NULL);
+               }
+
+               if (m_pImpl->idler)
+               {
+                       ecore_idler_del(m_pImpl->idler);
+                       m_pImpl->idler = NULL;
+               }
+
+               if (m_pImpl->map)
+               {
+                       m_pImpl->map->SetUpdateMapSignal(NULL);
+                       delete m_pImpl->map;
+                       m_pImpl->map = NULL;
+               }
+
+               if (m_pImpl->gl)
+               {
+                       evas_gl_make_current(m_pImpl->gl, m_pImpl->sfc, m_pImpl->ctx);
+
+                       if (m_pImpl->sfc)
+                       {
+                               evas_object_image_native_surface_set(m_pImpl->img, NULL);
+                               evas_gl_surface_destroy(m_pImpl->gl, m_pImpl->sfc);
+                               m_pImpl->sfc = NULL;
+                       }
+
+                       if (m_pImpl->ctx)
+                       {
+                               evas_gl_context_destroy(m_pImpl->gl, m_pImpl->ctx);
+                               m_pImpl->ctx = NULL;
+                       }
+
+                       evas_gl_free(m_pImpl->gl);
+                       m_pImpl->gl = NULL;
+               }
+
+               if (m_pImpl->cfg)
+               {
+                       evas_gl_config_free(m_pImpl->cfg);
+                       m_pImpl->cfg = NULL;
+               }
+
+               delete m_pImpl;
+               m_pImpl = NULL;
+       }
+
+       return HERE_ERROR_NONE;
+}
+
+void HereView::__pixelGetCb(void *data, Evas_Object *obj)
+{
+       if (!m_pImpl || !m_pImpl->map) return;
+       if (!m_pImpl->gl || !m_pImpl->sfc || !m_pImpl->ctx) return;
+
+       evas_gl_make_current(m_pImpl->gl, m_pImpl->sfc, m_pImpl->ctx);
+       m_pImpl->map->PaintMap(m_pImpl->w, m_pImpl->h);
+}
+
+void HereView::__renderingCb(void *data)
+{
+       if (!data) return;
+       evas_object_image_pixels_dirty_set((Evas_Object*)data, EINA_TRUE);
+}
+
+here_error_e HereView::RenderMap(const maps_coordinates_h mapsCoord,
+       const double dZoom, const double dAngle)
+{
+       if (!m_pImpl || !m_pImpl->isInitialized || !m_pImpl->map || !m_pImpl->api)
+               return HERE_ERROR_SERVICE_NOT_AVAILABLE;
+
+       if (!mapsCoord)
+               return HERE_ERROR_INVALID_PARAMETER;
+
+#ifdef TIZEN_SUPPORT_TILE_FILE_CACHE
+       /* When the theme is changed, clear cache */
+       map_view_type_e map_type;
+       map_view_get_type(m_pImpl->hView, &map_type);
+       if (m_pImpl->map->GetMapType() != HereUtils::Convert(map_type))
+       {
+               MAPS_LOGD("Clear cache, because map type is changed.");
+               m_pImpl->map->ClearCache();
+               m_pImpl->map->ClearTileFileCache();
+               m_pImpl->map->SetMapType(HereUtils::Convert(map_type));
+       }
+#endif
+
+       /* resize window */
+       int x, y, w, h;
+       map_view_get_geometry(m_pImpl->hView, &x, &y, &w, &h);
+       m_pImpl->w = MAX(m_pImpl->w, 1);
+       m_pImpl->h = MAX(m_pImpl->h, 1);
+
+       if (x != m_pImpl->x || y != m_pImpl->y || w != m_pImpl->w || h != m_pImpl->h)
+       {
+               m_pImpl->x = x;
+               m_pImpl->y = y;
+               m_pImpl->w = w;
+               m_pImpl->h = h;
+
+               m_pImpl->api->glViewport(0, 0, m_pImpl->w, m_pImpl->h);
+               m_pImpl->map->SetMapSize(Dimension(m_pImpl->w,m_pImpl->h));
+               InitOpenGLSurface(m_pImpl);
+       }
+
+       /* callback */
+       GeoTiledMap::UpdateMapSignalFunctor callback = std::tr1::bind(&__renderingCb, m_pImpl->img);
+       m_pImpl->map->SetUpdateMapSignal(callback);
+
+       /* zoom level */
+       if (m_pImpl->map->GetZoomLevel() != dZoom)
+       {
+               m_pImpl->zoom = dZoom;
+               m_pImpl->map->SetZoomLevel(dZoom, false);
+       }
+
+       /* angle */
+       m_pImpl->angle = dAngle;
+
+       /* center */
+       double lat, lng;
+       maps_coordinates_get_latitude(mapsCoord, &lat);
+       maps_coordinates_get_longitude(mapsCoord, &lng);
+
+       GeoCoordinates geoCoord(lat, lng);
+       m_pImpl->lat = lat;
+       m_pImpl->lng = lng;
+       m_pImpl->map->SetCenter(geoCoord);
+
+       return HERE_ERROR_NONE;
+}
+
+here_error_e HereView::RenderMapByArea(const maps_area_h hArea, const double dZoom, const double dAngle)
+{
+       if (!m_pImpl || !m_pImpl->isInitialized || !m_pImpl->map || !m_pImpl->map->GetRootPixmap() || !m_pImpl->api)
+               return HERE_ERROR_SERVICE_NOT_AVAILABLE;
+
+       if (!hArea)
+               return HERE_ERROR_INVALID_PARAMETER;
+
+       return HERE_ERROR_NONE;
+}
+
+here_error_e HereView::MoveCenter(const int delta_x, const int delta_y)
+{
+       if (!m_pImpl || !m_pImpl->isInitialized || !m_pImpl->map || !m_pImpl->map->GetRootPixmap() || !m_pImpl->api)
+               return HERE_ERROR_SERVICE_NOT_AVAILABLE;
+
+       if (delta_x == 0 && delta_y == 0)
+               return HERE_ERROR_NONE;
+
+       m_pImpl->map->Pan(delta_x, delta_y);
+
+       return HERE_ERROR_NONE;
+}
+
+here_error_e HereView::DrawMap(Evas* pCanvas, const int x, const int y, const int nWidth, const int nHeight)
+{
+       if (!m_pImpl || !m_pImpl->isInitialized || !m_pImpl->map || !m_pImpl->map->GetRootPixmap() || !m_pImpl->api)
+               return HERE_ERROR_SERVICE_NOT_AVAILABLE;
+
+       if (!pCanvas || nWidth <= 0 || nHeight <= 0)
+               return HERE_ERROR_INVALID_PARAMETER;
+
+       if (m_pImpl->w <= 0 || m_pImpl->h <= 0)
+               return HERE_ERROR_INVALID_PARAMETER;
+
+       unsigned char* srcimg_data = (unsigned char*)malloc(m_pImpl->w*m_pImpl->h*4);
+       if (!srcimg_data)
+               return HERE_ERROR_OUT_OF_MEMORY;
+
+       Evas_Object *dstimg = evas_object_image_filled_add(pCanvas);
+       if (!dstimg)
+       {
+               g_free(srcimg_data);
+               return HERE_ERROR_INVALID_OPERATION;
+       }
+
+       unsigned char *dstimg_data = (unsigned char *)evas_object_image_data_get(dstimg, EINA_TRUE);
+       if (!dstimg_data)
+       {
+               g_free(srcimg_data);
+               return HERE_ERROR_INVALID_OPERATION;
+       }
+
+       int w = nWidth;
+       int h = nHeight;
+
+       if (m_pImpl->w < w) w = m_pImpl->w;
+       if (m_pImpl->h < h) h = m_pImpl->h;
+
+       m_pImpl->api->glReadPixels(x, y, w, h, GL_RGBA, GL_UNSIGNED_BYTE, srcimg_data);
+
+       try {
+               for (int i = 0; i < h; i++)
+               {
+                       memcpy(dstimg_data+(i*w), srcimg_data+(i*m_pImpl->w+x), w*4);
+               }
+               free(srcimg_data);
+       }
+       catch (std::exception &e)
+       {
+               MAPS_LOGD("Exception caught: %s", e.what());
+       }
+
+       g_free(srcimg_data);
+       return HERE_ERROR_NONE;
+}
+
+here_error_e HereView::GetCenter(maps_coordinates_h *center)
+{
+       if (!center)
+               return HERE_ERROR_INVALID_PARAMETER;
+
+       GeoCoordinates geoCoord = m_pImpl->map->GetCenter();
+
+       if (*center == NULL)
+       {
+               maps_coordinates_create(geoCoord.GetLatitude(), geoCoord.GetLongitude(), center);
+       }
+       else
+       {
+               maps_coordinates_set_latitude(*center, geoCoord.GetLatitude());
+               maps_coordinates_set_longitude(*center, geoCoord.GetLongitude());
+       }
+
+       return HERE_ERROR_NONE;
+}
+
+here_error_e HereView::ScreenToGeography(const int x, const int y, maps_coordinates_h *mapsCoord)
+{
+       if (!m_pImpl || !m_pImpl->isInitialized || !m_pImpl->map)
+               return HERE_ERROR_SERVICE_NOT_AVAILABLE;
+
+       if (!mapsCoord)
+               return HERE_ERROR_INVALID_PARAMETER;
+
+       Tizen::Maps::Point mapsPoint(x, y);
+       GeoCoordinates hereCoord = m_pImpl->map->ScreenPositionToCoordinate(mapsPoint);
+       double lat = hereCoord.GetLatitude();
+       double lng = hereCoord.GetLongitude();
+
+       maps_coordinates_h __mapsCoord;
+       int error = maps_coordinates_create(lat, lng, &__mapsCoord);
+       if (error != MAPS_ERROR_NONE)
+               return (here_error_e)ConvertToHereError(error);
+
+       if (*mapsCoord) {
+               /* maps_coord is already allocated in heap memory */
+               maps_coordinates_get_latitude(__mapsCoord, &lat);
+               maps_coordinates_get_longitude(__mapsCoord, &lng);
+               maps_coordinates_set_latitude(*mapsCoord, lat);
+               maps_coordinates_set_longitude(*mapsCoord, lng);
+       } else {
+               /* maps_coord is not allocated yet */
+               maps_coordinates_clone(__mapsCoord, mapsCoord);
+       }
+       maps_coordinates_destroy(__mapsCoord);
+
+       return HERE_ERROR_NONE;
+}
+
+here_error_e HereView::GeographyToScreen(const maps_coordinates_h mapsCoord, int *x, int *y)
+{
+       if (!m_pImpl || !m_pImpl->isInitialized || !m_pImpl->map)
+               return HERE_ERROR_SERVICE_NOT_AVAILABLE;
+
+       if (!x || !y)
+               return HERE_ERROR_INVALID_PARAMETER;
+
+       double lat, lng;
+       maps_coordinates_get_latitude(mapsCoord, &lat);
+       maps_coordinates_get_longitude(mapsCoord, &lng);
+       GeoCoordinates hereCoord(lat, lng);
+       Tizen::Maps::Point mapsPoint = m_pImpl->map->CoordinateToScreenPosition(hereCoord);
+
+       *x = mapsPoint.x;
+       *y = mapsPoint.y;
+
+       return HERE_ERROR_NONE;
+}
+
+here_error_e HereView::GetMinZoomLevel(int *nMinZoomLevel)
+{
+       if (!m_pImpl || !m_pImpl->isInitialized || !m_pImpl->map)
+               return HERE_ERROR_SERVICE_NOT_AVAILABLE;
+
+       *nMinZoomLevel = (int)m_pImpl->map->GetMinimumZoomLevel();
+
+       return HERE_ERROR_NONE;
+}
+
+here_error_e HereView::GetMaxZoomLevel(int *nMaxZoomLevel)
+{
+       if (!m_pImpl || !m_pImpl->isInitialized || !m_pImpl->map)
+               return HERE_ERROR_SERVICE_NOT_AVAILABLE;
+
+       *nMaxZoomLevel = (int)m_pImpl->map->GetMaximumZoomLevel();
+       return HERE_ERROR_NONE;
+}
+
+here_error_e HereView::OnViewObject(const map_object_h object,
+                               const map_object_operation_e operation)
+{
+       if (!m_pImpl || !m_pImpl->isInitialized || !m_pImpl->map)
+               return HERE_ERROR_SERVICE_NOT_AVAILABLE;
+
+       if (!object || operation < MAP_OBJECT_ADD || operation > MAP_OBJECT_REMOVE_ALL)
+               return HERE_ERROR_INVALID_PARAMETER;
+
+       if (m_pImpl->map->GetRootPixmap())
+               __processViewObject(object, operation);
+       else
+               m_pImpl->pendingObjects.push_back(std::make_pair(object, operation));
+
+       return HERE_ERROR_NONE;
+}
+
+Eina_Bool HereView::__idlerCb(void *data)
+{
+       GLData *pImpl = (GLData*)data;
+
+       if (!pImpl || !pImpl->map || !pImpl->map->GetRootPixmap()) return true;
+
+       while (pImpl->pendingObjects.size())
+       {
+               PendingObject pending = pImpl->pendingObjects.front();
+               pImpl->pendingObjects.pop_front();
+               map_object_h object = pending.first;
+               map_object_operation_e operation = pending.second;
+
+               __processViewObject(object, operation);
+       }
+
+       return true;
+}
+
+void HereView::__processViewObject(const map_object_h object,
+                               const map_object_operation_e operation)
+{
+       map_object_type_e type = MAP_OBJECT_UNKNOWN;
+       map_object_get_type(object, &type);
+
+       if (type < MAP_OBJECT_GROUP || type > MAP_OBJECT_UNKNOWN) return;
+       if (operation < MAP_OBJECT_ADD || operation > MAP_OBJECT_REMOVE_ALL) return;
+
+       const char *oper_str[20] = { "ADD", "SET_VISIBLE", "MOVE", "CHANGE", "REMOVE", "REMOVEALL"};
+       const char *type_str[20] = { "GROUP", "POLYLINE", "POLYGON", "MARKER", "ROUTE", "UNKNOWN"};
+
+       MAPS_LOGD("type=%s, operation=%s, object=%p",
+               (type >= MAP_OBJECT_GROUP && type <= MAP_OBJECT_UNKNOWN) ? type_str[type] : "?",
+               (operation >= MAP_OBJECT_ADD && operation <= MAP_OBJECT_REMOVE_ALL) ? oper_str[operation] : "?",
+               object);
+
+       switch(operation)
+       {
+       case MAP_OBJECT_ADD:         m_pImpl->visualObjects.add(object); break;
+       case MAP_OBJECT_SET_VISIBLE: m_pImpl->visualObjects.setVisible(object); break;
+       case MAP_OBJECT_MOVE:        m_pImpl->visualObjects.move(object); break;
+       case MAP_OBJECT_CHANGE:      m_pImpl->visualObjects.update(object); break;
+       case MAP_OBJECT_REMOVE:      m_pImpl->visualObjects.remove(object); break;
+       case MAP_OBJECT_REMOVE_ALL:  m_pImpl->visualObjects.removeAll(); break;
+       default:                          break;
+       }
+}
+
+HERE_PLUGIN_END_NAMESPACE
diff --git a/src/here_view_objects.cpp b/src/here_view_objects.cpp
new file mode 100755 (executable)
index 0000000..447e132
--- /dev/null
@@ -0,0 +1,555 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "here_view_objects.h"
+#include "here_utils.h"
+
+#include <graphic/Grp_Util.h>
+#include <maps/GeoMapObjectMarker.h>
+#include <maps/GeoMapObjectPolygon.h>
+#include <maps/GeoMapObjectPolyline.h>
+
+
+using namespace HERE_PLUGIN_NAMESPACE_PREFIX;
+
+HERE_PLUGIN_BEGIN_NAMESPACE
+
+HereViewObjects::HereViewObjects()
+{
+       pthread_mutex_init(&__mutex, NULL);
+}
+
+HereViewObjects::~HereViewObjects()
+{
+       pthread_mutex_destroy(&__mutex);
+}
+
+void HereViewObjects::set(GeoTiledMap *map, Evas *evas)
+{
+       if (!map && !evas) removeAll();
+       __map = map;
+       __evas = evas;
+}
+
+here_error_e HereViewObjects::add(map_object_h hObj)
+{
+       if (!hObj) return HERE_ERROR_INVALID_PARAMETER;
+
+       here_error_e error = HERE_ERROR_INVALID_PARAMETER;
+       if (__currentObjects.find(hObj) == __currentObjects.end())
+               error = __add(hObj);
+
+       return error;
+}
+
+here_error_e HereViewObjects::__add(map_object_h hObj)
+{
+       if (!hObj) return HERE_ERROR_INVALID_PARAMETER;
+       if (!__map) return HERE_ERROR_INVALID_OPERATION;
+
+       here_error_e error = HERE_ERROR_NONE;
+       GeoMapObject *hereObject = NULL;
+       map_object_type_e type = MAP_OBJECT_UNKNOWN;
+       map_object_get_type(hObj, &type);
+
+       switch(type)
+       {
+       case MAP_OBJECT_GROUP:
+       {
+               int err = map_object_group_foreach_object(hObj, __foreachForAddingGroupObjects, this);
+               error = (here_error_e)ConvertToHereError(err);
+               break;
+       }
+       case MAP_OBJECT_MARKER:
+               hereObject = new (std::nothrow) GeoMapObjectMarker;
+               error = __updateMarker(hObj, (GeoMapObjectMarker*)hereObject);
+               break;
+
+       case MAP_OBJECT_POLYGON:
+               hereObject = new (std::nothrow) GeoMapObjectPolygon;
+               error = __updatePolygon(hObj, (GeoMapObjectPolygon*)hereObject);
+               break;
+
+       case MAP_OBJECT_POLYLINE:
+               hereObject = new (std::nothrow) GeoMapObjectPolyline;
+               error = __updatePolyline(hObj, (GeoMapObjectPolyline*)hereObject);
+               break;
+#ifdef TIZEN_3_0_NEXT_MS
+       case MAP_OBJECT_ROUTE:
+               for (int i=0; i < 2; i++)
+               {
+                       hereObject = new (std::nothrow) GeoMapObjectPolyline;
+                       if (hereObject)
+                       {
+                               __map->AddObject(hereObject);
+                               error = __updateRoute(hObj);
+                               if (error != HERE_ERROR_NONE) break;
+                               pthread_mutex_lock(&__mutex);
+                               __currentObjects.insert(std::make_pair(hObj, (GeoMapObjectPolyline*)hereObject));
+                               pthread_mutex_unlock(&__mutex);
+                       }
+
+                       hereObject = new (std::nothrow) GeoMapObjectMarker;
+                       if (hereObject)
+                       {
+                               __map->AddObject(hereObject);
+                               error = __updateRoute(hObj);
+                               if (error != HERE_ERROR_NONE) break;
+                               pthread_mutex_lock(&__mutex);
+                               __currentObjects.insert(std::make_pair(hObj, (GeoMapObjectMarker*)hereObject));
+                               pthread_mutex_unlock(&__mutex);
+                       }
+               }
+               break;
+#endif /* TIZEN_3_0_NEXT_MS */
+       default:
+               error = HERE_ERROR_INVALID_PARAMETER;
+               break;
+       }
+
+       if (error != HERE_ERROR_NONE)
+       {
+               if (hereObject) delete hereObject;
+               hereObject = NULL;
+       }
+
+#ifdef TIZEN_3_0_NEXT_MS
+       if (hereObject && type != MAP_OBJECT_ROUTE)
+#else
+       if (hereObject)
+#endif /* TIZEN_3_0_NEXT_MS */
+       {
+               __map->AddObject(hereObject);
+               pthread_mutex_lock(&__mutex);
+               __currentObjects.insert(std::make_pair(hObj, hereObject));
+               pthread_mutex_unlock(&__mutex);
+       }
+
+       return error;
+}
+
+here_error_e HereViewObjects::remove(map_object_h hObj)
+{
+       if (!hObj) return HERE_ERROR_INVALID_PARAMETER;
+
+       here_error_e error = HERE_ERROR_NOT_FOUND;
+       map_object_type_e type = MAP_OBJECT_UNKNOWN;
+       map_object_get_type(hObj, &type);
+
+       if (type == MAP_OBJECT_GROUP)
+       {
+               int err = map_object_group_foreach_object(hObj, __foreachForRemovingGroupObjects, this);
+               error = (here_error_e)ConvertToHereError(err);
+       }
+       else
+       {
+               error = __remove(hObj);
+       }
+
+       return error;
+}
+
+here_error_e HereViewObjects::__remove(map_object_h hObj)
+{
+       if (!hObj) return HERE_ERROR_INVALID_PARAMETER;
+       if (!__map) return HERE_ERROR_INVALID_OPERATION;
+
+       here_error_e error = HERE_ERROR_NOT_FOUND;
+
+       VisualObjects::iterator it;
+       pthread_mutex_lock(&__mutex);
+       while ((it = __currentObjects.find(hObj)) != __currentObjects.end())
+       {
+               __map->RemoveObject((GeoMapObject*)it->second);
+               it = __currentObjects.erase(it);
+               error = HERE_ERROR_NONE;
+       }
+       pthread_mutex_unlock(&__mutex);
+       return error;
+}
+
+here_error_e HereViewObjects::removeAll()
+{
+       pthread_mutex_lock(&__mutex);
+       __currentObjects.clear();
+       __map->ClearMapObjects();
+       pthread_mutex_unlock(&__mutex);
+       return HERE_ERROR_NONE;
+}
+
+here_error_e HereViewObjects::move(map_object_h hObj)
+{
+       if (!hObj) return HERE_ERROR_INVALID_PARAMETER;
+
+       VisualObjects::iterator it;
+       while ((it = __currentObjects.find(hObj)) != __currentObjects.end())
+       {
+               MAPS_LOGD("TODO: implement moving");
+       }
+
+       return HERE_ERROR_NONE;
+}
+
+here_error_e HereViewObjects::update(map_object_h hObj)
+{
+       if (!hObj) return HERE_ERROR_INVALID_PARAMETER;
+
+       here_error_e error = HERE_ERROR_NOT_FOUND;
+       VisualObjects::iterator it = __currentObjects.find(hObj);
+       if (it != __currentObjects.end())
+               error = __update(hObj, (GeoMapObject*)(it->second));
+
+       return error;
+}
+
+here_error_e HereViewObjects::__update(map_object_h hObj, GeoMapObject *hereObject)
+{
+       if (!hObj) return HERE_ERROR_INVALID_PARAMETER;
+
+       here_error_e error = HERE_ERROR_UNKNOWN;
+
+       do {
+               map_object_type_e type = MAP_OBJECT_UNKNOWN;
+               map_object_get_type(hObj, &type);
+
+               switch(type)
+               {
+               case MAP_OBJECT_GROUP:
+               {
+                       int err = map_object_group_foreach_object(hObj, __foreachForUpdatingGroupObjects, this);
+                       error = (here_error_e)ConvertToHereError(err);
+                       break;
+               }
+               case MAP_OBJECT_MARKER:
+                       error = __updateMarker(hObj, (GeoMapObjectMarker*)hereObject);
+                       break;
+
+               case MAP_OBJECT_POLYGON:
+                       error = __updatePolygon(hObj, (GeoMapObjectPolygon*)hereObject);
+                       break;
+
+               case MAP_OBJECT_POLYLINE:
+                       error = __updatePolyline(hObj, (GeoMapObjectPolyline*)hereObject);
+                       break;
+
+#ifdef TIZEN_3_0_NEXT_MS
+               case MAP_OBJECT_ROUTE:
+                       error = __updateRoute(hObj);
+                       break;
+#endif /* TIZEN_3_0_NEXT_MS */
+
+               default:
+                       break;
+               }
+       } while(0);
+
+       return error;
+}
+
+here_error_e HereViewObjects::__updateMarker(map_object_h hMarker, GeoMapObjectMarker *hereMarker)
+{
+       if (!hMarker || !hereMarker)
+               return HERE_ERROR_INVALID_PARAMETER;
+
+       if (!__evas || !__map)
+               return HERE_ERROR_INVALID_OPERATION;
+
+
+       int error = MAPS_ERROR_NONE;
+       map_marker_type_e type;
+       int nSize = 0, w, h;
+       char *szPath = NULL;
+       double lat, lng;
+       maps_coordinates_h mapsCoord;
+       Evas_Object *img = NULL;
+
+
+       do {
+               /* image */
+               error = map_object_marker_get_type(hMarker, &type);
+               if (error != MAPS_ERROR_NONE || type >= MAP_MARKER_NONE) break;
+
+               error = map_object_marker_get_image_file(hMarker, &szPath);
+               if (error != MAPS_ERROR_NONE || !szPath) break;
+
+               img = evas_object_image_add(__evas);
+               evas_object_image_file_set(img, szPath, NULL);
+               int err = evas_object_image_load_error_get(img);
+
+               if (err != EVAS_LOAD_ERROR_NONE)
+               {
+                       MAPS_LOGE("Failed to load the image file for new marker. '%s'",
+                               (szPath ? szPath : "null"));
+                       g_free(szPath);
+                       break;
+               }
+               g_free(szPath);
+
+               evas_object_image_size_get(img, &w, &h);
+               nSize = w * h * 4;
+
+               unsigned char *src = (unsigned char*)evas_object_image_data_get(img, EINA_FALSE);
+               if (!src || nSize <= 0) {
+                       MAPS_LOGE("Failed to get the image buffer of new marker");
+                       error = MAPS_ERROR_OUT_OF_MEMORY;
+                       break;
+               }
+
+               unsigned char *dst = (unsigned char*)malloc(nSize);
+               if (!dst) {
+                       error = MAPS_ERROR_OUT_OF_MEMORY;
+                       break;
+               }
+               memcpy(dst, src, nSize);
+
+               _Util::ConvertRGBA2BGRA(dst, (unsigned)w, (unsigned)h);
+
+               Bitmap bmp;
+               bmp.Construct((const unsigned char*)dst, nSize, Dimension(w, h));
+               hereMarker->SetBitmap(bmp);
+               g_free(dst);
+
+
+               /* position */
+               map_object_marker_get_coordinates(hMarker, &mapsCoord);
+               maps_coordinates_get_latitude(mapsCoord, &lat);
+               maps_coordinates_get_longitude(mapsCoord, &lng);
+               maps_coordinates_destroy(mapsCoord);
+
+               if (!HereUtils::IsValidCoord(lat, lng))
+               {
+                       error = MAPS_ERROR_INVALID_PARAMETER;
+                       break;
+               }
+
+               hereMarker->SetPosition(GeoCoordinates(lat, lng));
+
+
+               /* origin */
+               Tizen::Maps::FloatPoint fpntOrigin(0.5, 1);
+               hereMarker->SetMarkerOrigin(fpntOrigin);
+       } while(0);
+
+       if (img) evas_object_del(img);
+       return (here_error_e)ConvertToHereError(error);
+}
+
+here_error_e HereViewObjects::__updatePolyline(map_object_h hPolyline, GeoMapObjectPolyline *herePolyline)
+{
+       if (!hPolyline || !herePolyline)
+               return HERE_ERROR_INVALID_PARAMETER;
+
+       int error = MAPS_ERROR_NONE;
+       GeoCoordinateList coordList;
+       unsigned char r, g, b, a;
+       int nThickness;
+
+       do {
+               error = map_object_polyline_foreach_point(hPolyline, __foreachForCoordinates, &coordList);
+               if (error != MAPS_ERROR_NONE) break;
+               herePolyline->SetPath(coordList);
+
+               error = map_object_polyline_get_color(hPolyline, &r, &g, &b, &a);
+               if (error != MAPS_ERROR_NONE) break;
+               herePolyline->SetStrokeColor(Color(r, g, b, a));
+
+               error = map_object_polyline_get_width(hPolyline, &nThickness);
+               if (error != MAPS_ERROR_NONE) break;
+               herePolyline->SetStrokeThickness(nThickness);
+       } while(0);
+
+       return (here_error_e)ConvertToHereError(error);
+}
+
+here_error_e HereViewObjects::__updatePolygon(map_object_h hPolygon, GeoMapObjectPolygon *herePolygon)
+{
+       if (!hPolygon || !herePolygon)
+               return HERE_ERROR_INVALID_PARAMETER;
+
+       int error = MAPS_ERROR_NONE;
+       GeoCoordinateList coordList;
+       unsigned char r, g, b, a;
+
+       do {
+               error = map_object_polygon_foreach_point(hPolygon, __foreachForCoordinates, &coordList);
+               if (error != MAPS_ERROR_NONE) break;
+               herePolygon->SetPath(coordList);
+
+               error = map_object_polygon_get_fill_color(hPolygon, &r, &g, &b, &a);
+               if (error != MAPS_ERROR_NONE) break;
+               herePolygon->SetFillColor(Color(r, g, b, a));
+       } while(0);
+
+       return (here_error_e)ConvertToHereError(error);
+}
+
+here_error_e HereViewObjects::__updateRoute(map_object_h hRoute)
+{
+#ifdef TIZEN_3_0_NEXT_MS
+       if (!hRoute) return HERE_ERROR_INVALID_PARAMETER;
+
+       VisualObjects::iterator it;
+
+       if ((it = __currentObjects.find(hRoute)) != __currentObjects.end())
+       {
+               maps_route_h route = NULL;
+               int ret = map_object_route_get_content(hRoute, &route);
+               if (ret !=  MAPS_ERROR_NONE || !route)
+                       return HERE_ERROR_NONE;
+
+               GeoCoordinateList coordList;
+               GeoMapObjectPolyline *polyline_path = NULL, *polyline_seg = NULL;
+
+               if (it->second->GetType() == GeoMapObject::GMO_Polyline)
+               {
+                       if (!polyline_path)
+                       {
+                               MAPS_LOGD("Route Path");
+                               polyline_path = (GeoMapObjectPolyline*)it->second;
+                               maps_route_foreach_path(route, __foreachForCoordinates, &coordList);
+                               polyline_path->SetPath(coordList);
+                               polyline_path->SetStrokeColor(Tizen::Maps::Color(255, 0, 0, 255));
+                               polyline_path->SetStrokeThickness(3);
+                       }
+                       else if (!polyline_seg)
+                       {
+                               MAPS_LOGD("Route Segments");
+                               polyline_seg = (GeoMapObjectPolyline*)it->second;
+                               maps_route_foreach_path(route, __foreachForCoordinates, &coordList);
+                               polyline_seg->SetPath(coordList);
+                               polyline_seg->SetStrokeColor(Tizen::Maps::Color(0, 255, 0, 255));
+                               polyline_seg->SetStrokeThickness(3);
+                       }
+               }
+               else if (it->second->GetType() == GeoMapObject::GMO_Marker)
+               {
+                       // to implement
+               }
+               maps_route_destroy(route);
+       }
+
+#endif /* TIZEN_3_0_NEXT_MS */
+       return HERE_ERROR_NONE;
+}
+
+here_error_e HereViewObjects::setVisible(map_object_h hObj)
+{
+       if (!hObj) return HERE_ERROR_INVALID_PARAMETER;
+
+       bool visible;
+       map_object_get_visible(hObj, &visible);
+       return __setVisible(hObj, visible);
+}
+
+here_error_e HereViewObjects::__setVisible(map_object_h hObj, bool bVisible)
+{
+       if (!hObj) return HERE_ERROR_INVALID_PARAMETER;
+
+       here_error_e error = HERE_ERROR_NOT_FOUND;
+       map_object_type_e type = MAP_OBJECT_UNKNOWN;
+       map_object_get_type(hObj, &type);
+
+       if (type == MAP_OBJECT_GROUP)
+       {
+               int err = map_object_group_foreach_object(hObj, __foreachForSettingVisibleGroupObjects, this);
+               error = (here_error_e)ConvertToHereError(err);
+       }
+       else
+       {
+               VisualObjects::iterator it;
+               for (it = __currentObjects.begin(); it != __currentObjects.end(); it++)
+               {
+                       if (it->first == hObj)
+                       {
+                               ((GeoMapObject*)it->second)->SetVisible(bVisible);
+                               error = HERE_ERROR_NONE;
+                       }
+               }
+       }
+
+       return error;
+}
+
+bool HereViewObjects::__foreachForCoordinates(int index, maps_coordinates_h point, void *user_data)
+{
+       if (!point || !user_data)
+               return false;
+
+       if (!HereUtils::IsValid(*(maps_coordinates_s*)point))
+       {
+               maps_coordinates_destroy(point);
+               return false;
+       }
+
+
+       int error;
+       double lat = 0.0, lng = 0.0;
+
+       do {
+               error = maps_coordinates_get_latitude(point, &lat);
+               if (error != MAPS_ERROR_NONE) break;
+
+               error = maps_coordinates_get_longitude(point, &lng);
+               if (error != MAPS_ERROR_NONE) break;
+       } while(0);
+
+       maps_coordinates_destroy(point);
+       if (error != MAPS_ERROR_NONE) return false;
+
+       MAPS_LOGD("[%d] %f,%f", index+1, lat, lng);
+
+       GeoCoordinateList *coordList = (GeoCoordinateList*)user_data;
+       coordList->push_back(GeoCoordinates(lat, lng));
+       return true;
+}
+
+bool HereViewObjects::__foreachForAddingGroupObjects(int index, int total, map_object_h object, void *user_data)
+{
+       if (!user_data) return false;
+
+       HereViewObjects *hereViewObjects = (HereViewObjects*)user_data;
+       here_error_e error = hereViewObjects->add(object);
+       return (error == HERE_ERROR_NONE);
+}
+
+bool HereViewObjects::__foreachForRemovingGroupObjects(int index, int total, map_object_h object, void *user_data)
+{
+       if (!user_data) return false;
+
+       HereViewObjects *hereViewObjects = (HereViewObjects*)user_data;
+       here_error_e error = hereViewObjects->remove(object);
+       return (error == HERE_ERROR_NONE);
+}
+
+bool HereViewObjects::__foreachForUpdatingGroupObjects(int index, int total, map_object_h object, void *user_data)
+{
+       if (!user_data) return false;
+
+       HereViewObjects *hereViewObjects = (HereViewObjects*)user_data;
+       here_error_e error = hereViewObjects->update(object);
+       return (error == HERE_ERROR_NONE);
+}
+
+bool HereViewObjects::__foreachForSettingVisibleGroupObjects(int index, int total, map_object_h object, void *user_data)
+{
+       if (!user_data) return false;
+
+       HereViewObjects *hereViewObjects = (HereViewObjects*)user_data;
+       here_error_e error = hereViewObjects->setVisible(object);
+       return (error == HERE_ERROR_NONE);
+}
+
+HERE_PLUGIN_END_NAMESPACE