SET(LIBDIR ${LIBDIR})
# Dependencies
-SET(dependents
+SET(dependents
glib-2.0
gmodule-2.0
libxml-2.0
#include <stdbool.h>
#endif
#include <Elementary.h>
-#include <Elementary.h>
#include <libintl.h>
#include <stdio.h>
#include <string.h>
int HerePluginGetScalebar(maps_view_h hView, bool *enabled);
-int HerePluginDrawMap(maps_view_h hView, Evas* pCanvas, int x, int y, int w, int h);
-
int HerePluginGetCenter(maps_view_h hView, maps_coordinates_h *center);
int HerePluginScreenToGeography(maps_view_h hView, int x, int y, maps_coordinates_h *mapsCoord);
/*
* Internal Macros
*/
-#define MAPS_LOGD(fmt,args...) LOGD(fmt, ##args)
-#define MAPS_LOGW(fmt,args...) LOGW(fmt, ##args)
-#define MAPS_LOGI(fmt,args...) LOGI(fmt, ##args)
-#define MAPS_LOGE(fmt,args...) LOGE(fmt, ##args)
-#define MAPS_SECLOG(fmt,args...) SECURE_LOGD(fmt, ##args)
+#define MAPS_LOGD(fmt, args...) LOGD(fmt, ##args)
+#define MAPS_LOGW(fmt, args...) LOGW(fmt, ##args)
+#define MAPS_LOGI(fmt, args...) LOGI(fmt, ##args)
+#define MAPS_LOGE(fmt, args...) LOGE(fmt, ##args)
+#define MAPS_SECLOG(fmt, args...) SECURE_LOGD(fmt, ##args)
#define MAPS_CHECK_CONDITION(condition, error, msg) \
do { \
} while (0)
#define MAPS_NULL_ARG_CHECK(arg) \
- MAPS_CHECK_CONDITION(arg != NULL,MAPS_ERROR_INVALID_PARAMETER,"MAPS_ERROR_INVALID_PARAMETER")
+ MAPS_CHECK_CONDITION(arg != NULL, MAPS_ERROR_INVALID_PARAMETER, "MAPS_ERROR_INVALID_PARAMETER")
#define MAPS_PRINT_ERROR_CODE_RETURN(code) \
do{ \
HereView();
~HereView();
- here_error_e Init(maps_view_h hView, maps_plugin_map_view_ready_cb pCbFunc);
- here_error_e Close(maps_view_h hView);
- here_error_e RenderMap(maps_view_h hView, const maps_coordinates_h mapsCoord, double dZoom, double dAngle);
- here_error_e RenderMapByArea(maps_view_h hView, const maps_area_h hArea, double dZoom, double dAngle);
- here_error_e DrawMap(maps_view_h hView, Evas* pCanvas, int x, int y, int nWidth, int nHeight);
- here_error_e MoveCenter(maps_view_h hView, int delta_x, int delta_y);
- here_error_e GetCenter(maps_view_h hView, maps_coordinates_h *center);
- here_error_e SetScalebar(maps_view_h hView, bool enable);
- here_error_e GetScalebar(maps_view_h hView, bool *enabled);
- here_error_e ScreenToGeolocation(maps_view_h hView, int x, int y, maps_coordinates_h *mapsCoord);
- here_error_e GeolocationToScreen(maps_view_h hView, const maps_coordinates_h mapsCoord, int *x, int *y);
-
- here_error_e GetMinZoomLevel(maps_view_h hView, int *nMinZoomLevel);
- here_error_e GetMaxZoomLevel(maps_view_h hView, int *nMaxZoomLevel);
- here_error_e OnViewObject(maps_view_h hView, const maps_view_object_h object, maps_view_object_operation_e operation);
+ here_error_e init(maps_view_h view, maps_plugin_map_view_ready_cb callback);
+ here_error_e close(maps_view_h view);
+ here_error_e renderMap(maps_view_h view, const maps_coordinates_h coord, double zoom, double angle);
+ here_error_e moveCenter(maps_view_h view, int delta_x, int delta_y);
+ here_error_e getCenter(maps_view_h view, maps_coordinates_h *center);
+ here_error_e setScalebarEnabled(maps_view_h view, bool enable);
+ here_error_e getScalebarEnabled(maps_view_h view, bool *enabled);
+ here_error_e convertScreenToGeolocation(maps_view_h view, int x, int y, maps_coordinates_h *coord);
+ here_error_e convertGeolocationToScreen(maps_view_h view, const maps_coordinates_h coord, int *x, int *y);
+
+ here_error_e getMinZoomLevel(maps_view_h view, int *zoom);
+ here_error_e getMaxZoomLevel(maps_view_h view, int *zoom);
+ here_error_e onViewObject(maps_view_h view, const maps_view_object_h object, maps_view_object_operation_e operation);
private:
- here_error_e __initOpenGL();
- here_error_e __initOpenGLSurface(maps_view_h hView);
- here_error_e __initMap(maps_view_h hView, maps_plugin_map_view_ready_cb pCbFunc);
- static void __readyMapCb(maps_view_h hView);
+ here_error_e initOpenGL();
+ here_error_e initOpenGLSurface(maps_view_h view);
+ here_error_e initMap(maps_view_h view, maps_plugin_map_view_ready_cb callback);
+ void setMapType(maps_view_h view);
+ static void __readyMapCb(maps_view_h view);
static Eina_Bool __idlerCb(void *data);
static void __renderingCb(void *data);
static void __pixelGetCb(void *data, Evas_Object *obj);
- static void __processViewObject(maps_view_h hView, const maps_view_object_h object, maps_view_object_operation_e operation);
- void __setMapType(maps_view_h hView);
+ static void __processViewObject(maps_view_h view, const maps_view_object_h object, maps_view_object_operation_e operation);
private:
Here::Maps::GeoTiledMap *__map;
if (error != HERE_ERROR_NONE) break;
error = pGeocode->StartGeocode(szAddr);
- } while(0);
+ } while (0);
/* finishing task */
if(error != HERE_ERROR_NONE)
if (error != HERE_ERROR_NONE) break;
error = pGeocode->StartGeocodeByStructuredAddress(hAddr);
- } while(0);
+ } while (0);
/* finishing task */
if(error != HERE_ERROR_NONE)
if (error != HERE_ERROR_NONE) break;
error = pGeocode->StartGeocodeInsideArea(szAddr, hArea);
- } while(0);
+ } while (0);
/* finishing task */
if(error != HERE_ERROR_NONE)
if (error != HERE_ERROR_NONE) break;
error = pRevGeocode->StartRevGeocode(hPref);
- } while(0);
+ } while (0);
/* finishing task */
if(error != HERE_ERROR_NONE)
if (error != HERE_ERROR_NONE) break;
error = pMultiRevGeocode->StartMultiReverse(hPref);
- } while(0);
+ } while (0);
/* finishing task */
if(error != HERE_ERROR_NONE)
if (error != HERE_ERROR_NONE) break;
error = pPlace->StartDiscoveryPlace(hPos, nDistance);
- } while(0);
+ } while (0);
/* finishing task */
if(error != HERE_ERROR_NONE)
if (error != HERE_ERROR_NONE) break;
error = pPlace->StartDiscoveryPlace(hArea);
- } while(0);
+ } while (0);
/* finishing task */
if(error != HERE_ERROR_NONE)
if (error != HERE_ERROR_NONE) break;
error = pPlace->StartDiscoveryPlace(hArea, szAddr);
- } while(0);
+ } while (0);
/* finishing task */
if(error != HERE_ERROR_NONE)
if (error != HERE_ERROR_NONE) break;
error = pPlace->StartDiscoveryPlaceList(hArea);
- } while(0);
+ } while (0);
/* finishing task */
if(error != HERE_ERROR_NONE)
if (error != HERE_ERROR_NONE) break;
error = pPlace->StartPlaceDetails(szUrl);
- } while(0);
+ } while (0);
/* finishing task */
if(error != HERE_ERROR_NONE)
if (error != HERE_ERROR_NONE) break;
error = pRoute->StartRoute();
- } while(0);
+ } while (0);
/* finishing task */
if(error != HERE_ERROR_NONE)
if (!hWaypointList || nWaypointNum < 2 || !pCbFunc || !nReqId)
return HERE_ERROR_INVALID_PARAMETER;
- for (int i=0; i<nWaypointNum; i++)
+ for (int i = 0; i < nWaypointNum; i++)
{
if (!HereUtils::IsValid(*(maps_coordinates_s*)hWaypointList[i]))
return HERE_ERROR_INVALID_PARAMETER;
if (error != HERE_ERROR_NONE) break;
error = pRoute->StartRoute();
- } while(0);
+ } while (0);
/* finishing task */
if(error != HERE_ERROR_NONE)
return (HereManager::GetHandler()->CancelInstance(nReqId));
}
+
+
/*****************************************************************************/
/* */
/* Maps Widget */
maps_view_set_maps_plugin_view_handle(hView, vh);
if (ovh)
delete ovh;
- return vh->Init(hView, pCbFunc);
+ return vh->init(hView, pCbFunc);
}
int HerePluginDestroyMapView(maps_view_h hView)
here_error_e error = (here_error_e)ConvertToHereError(maps_error);
if (error == HERE_ERROR_NONE && vh) {
maps_view_set_maps_plugin_view_handle(hView, NULL);
- error = vh->Close(hView);
+ error = vh->close(hView);
delete vh;
}
return error;
}
-int HerePluginRenderMap(maps_view_h hView, const maps_coordinates_h mapsCoord, double dZoom, double dAngle)
+int HerePluginRenderMap(maps_view_h hView, const maps_coordinates_h mapsCoord,
+ double dZoom, double dAngle)
{
HereView *vh = NULL;
int maps_error = maps_view_get_maps_plugin_view_handle(hView, (void**)&vh);
here_error_e error = (here_error_e)ConvertToHereError(maps_error);
if (error == HERE_ERROR_NONE && vh)
- error = vh->RenderMap(hView, mapsCoord, dZoom, dAngle);
+ error = vh->renderMap(hView, mapsCoord, dZoom, dAngle);
return error;
}
int maps_error = maps_view_get_maps_plugin_view_handle(hView, (void**)&vh);
here_error_e error = (here_error_e)ConvertToHereError(maps_error);
if (error == HERE_ERROR_NONE && vh)
- error = vh->MoveCenter(hView, delta_x, delta_y);
+ error = vh->moveCenter(hView, delta_x, delta_y);
return error;
}
int maps_error = maps_view_get_maps_plugin_view_handle(hView, (void**)&vh);
here_error_e error = (here_error_e)ConvertToHereError(maps_error);
if (error == HERE_ERROR_NONE && vh)
- error = vh->SetScalebar(hView, enable);
+ error = vh->setScalebarEnabled(hView, enable);
return error;
}
int maps_error = maps_view_get_maps_plugin_view_handle(hView, (void**)&vh);
here_error_e error = (here_error_e)ConvertToHereError(maps_error);
if (error == HERE_ERROR_NONE && vh)
- error = vh->GetScalebar(hView, enabled);
+ error = vh->getScalebarEnabled(hView, enabled);
return error;
}
-int HerePluginDrawMap(maps_view_h hView, Evas* pCanvas, int x, int y, int w, int h)
-{
- return HERE_ERROR_NONE;
-}
-
int HerePluginGetCenter(maps_view_h hView, maps_coordinates_h *center)
{
HereView *vh = NULL;
int maps_error = maps_view_get_maps_plugin_view_handle(hView, (void**)&vh);
here_error_e error = (here_error_e)ConvertToHereError(maps_error);
if (error == HERE_ERROR_NONE && vh)
- error = vh->GetCenter(hView, center);
+ error = vh->getCenter(hView, center);
return error;
}
int maps_error = maps_view_get_maps_plugin_view_handle(hView, (void**)&vh);
here_error_e error = (here_error_e)ConvertToHereError(maps_error);
if (error == HERE_ERROR_NONE && vh)
- error = vh->ScreenToGeolocation(hView, x, y, mapsCoord);
+ error = vh->convertScreenToGeolocation(hView, x, y, mapsCoord);
return error;
}
int maps_error = maps_view_get_maps_plugin_view_handle(hView, (void**)&vh);
here_error_e error = (here_error_e)ConvertToHereError(maps_error);
if (error == HERE_ERROR_NONE && vh)
- error = vh->GeolocationToScreen(hView, mapsCoord, x, y);
+ error = vh->convertGeolocationToScreen(hView, mapsCoord, x, y);
return error;
}
int maps_error = maps_view_get_maps_plugin_view_handle(hView, (void**)&vh);
here_error_e error = (here_error_e)ConvertToHereError(maps_error);
if (error == HERE_ERROR_NONE && vh)
- error = vh->GetMinZoomLevel(hView, nMinZoomLevel);
+ error = vh->getMinZoomLevel(hView, nMinZoomLevel);
return error;
}
int maps_error = maps_view_get_maps_plugin_view_handle(hView, (void**)&vh);
here_error_e error = (here_error_e)ConvertToHereError(maps_error);
if (error == HERE_ERROR_NONE && vh)
- error = vh->GetMaxZoomLevel(hView, nMaxZoomLevel);
+ error = vh->getMaxZoomLevel(hView, nMaxZoomLevel);
return error;
}
-int HerePluginOnViewObject(maps_view_h hView, const maps_view_object_h object, maps_view_object_operation_e operation)
+int HerePluginOnViewObject(maps_view_h hView, const maps_view_object_h object,
+ maps_view_object_operation_e operation)
{
HereView *vh = NULL;
int maps_error = maps_view_get_maps_plugin_view_handle(hView, (void**)&vh);
here_error_e error = (here_error_e)ConvertToHereError(maps_error);
if (error == HERE_ERROR_NONE && vh)
- error = vh->OnViewObject(hView, object, operation);
+ error = vh->onViewObject(hView, object, operation);
return error;
}
m_pQuery->SetSearchtext(sSearch);
maps_area_s *pArea = (maps_area_s *)hArea;
- if (pArea->type == MAPS_AREA_RECTANGLE)
- {
+ if (pArea->type == MAPS_AREA_RECTANGLE) {
double dLatTL = pArea->rect.top_left.latitude;
double dLngTL = pArea->rect.top_left.longitude;
GeoCoordinates geoCoordTL(dLatTL, dLngTL);
GeoBoundingBox BoundingBox(geoCoordTL, geoCoordBR);
m_pQuery->SetBoundingBox(BoundingBox);
- }
- else if (pArea->type == MAPS_AREA_CIRCLE)
- {
+ } else if (pArea->type == MAPS_AREA_CIRCLE) {
MAPS_LOGD("HERE Maps is not supported circle type in GeocoderQuery");
return HERE_ERROR_NOT_SUPPORTED;
- }
- else {
+ } else {
return HERE_ERROR_INVALID_PARAMETER;
}
GeoCoordinates hereCoord;
maps_coordinates_h mapsCoord;
- if (nResults == 0)
- {
+ if (nResults == 0) {
((maps_service_geocode_cb)m_pCbFunc)(MAPS_ERROR_NOT_FOUND, m_nReqId,
0, 0, NULL, m_pUserData);
delete this;
{
pResult = (Result*)Reply.GetResult(i);
- if (pResult)
- {
+ if (pResult) {
hereCoord = (pResult->GetLocation()).GetDisplayPosition();
- }
- else
- {
+ } else {
hereCoord.SetLatitude(0.0);
hereCoord.SetLongitude(0.0);
}
maps_error_e error = (maps_error_e)maps_coordinates_create(
hereCoord.GetLatitude(), hereCoord.GetLongitude(), &mapsCoord);
- if (m_bCanceled || !m_pCbFunc)
- {
+ if (m_bCanceled || !m_pCbFunc) {
if (mapsCoord) maps_coordinates_destroy(mapsCoord);
break;
- }
- else
- {
+ } else {
if (((maps_service_geocode_cb)m_pCbFunc)(error, m_nReqId, i,
- nResults, mapsCoord, m_pUserData) == FALSE)
- {
+ nResults, mapsCoord, m_pUserData) == FALSE) {
delete this;
return;
}
m_pHereManager = new (std::nothrow) HereManager();
pthread_mutex_lock(&g_mtxRef);
- if (m_pHereManager)
- {
+ if (m_pHereManager) {
m_nRefCnt++;
result = true;
MAPS_LOGD("Created a HereManager instance (%d).", m_nRefCnt);
bool terminate = (--m_nRefCnt == 0 && m_pHereManager);
pthread_mutex_unlock(&g_mtxRef);
- if (terminate)
- {
+ if (terminate) {
m_pHereManager->TerminateAllServices();
HereConfig::Shutdown();
HereSvcList::iterator it;
pthread_mutex_lock(&m_mtxHereList);
- for (it = m_HereList.begin(); it != m_HereList.end(); it++)
- {
- if ((*it)->GetReqId() == nReqId)
- {
+ for (it = m_HereList.begin(); it != m_HereList.end(); it++) {
+ if ((*it)->GetReqId() == nReqId) {
m_HereList.erase(it);
break;
}
HereSvcList::iterator it;
pthread_mutex_lock(&m_mtxHereList);
- for (it = m_HereList.begin(); it != m_HereList.end(); it++)
- {
- if ((*it)->GetReqId() == nReqId)
- {
+ for (it = m_HereList.begin(); it != m_HereList.end(); it++) {
+ if ((*it)->GetReqId() == nReqId) {
m_HereList.erase(it);
RestItemHandle::Cancel((*it)->GetRestReqId());
(*it)->TerminateService();
if (!metadata_key || !metadata_value)
return false;
- if (!strncmp(metadata_key, "http://tizen.org/metadata/here_key", 35) && strlen(metadata_value) > 0 )
- {
+ if (!strncmp(metadata_key, "http://tizen.org/metadata/here_key", 35) && strlen(metadata_value) > 0) {
if (m_pHereManager->SetCredentials(metadata_value) == HERE_ERROR_NONE)
- {
MAPS_LOGD("Succeeded getting credential from metadata");
- }
return false;
}
nProcessId = getpid();
nRet = app_manager_get_app_id(nProcessId, &strAppId);
- if (nRet != APP_MANAGER_ERROR_NONE)
- {
+ if (nRet != APP_MANAGER_ERROR_NONE) {
MAPS_LOGI("Get app_id [%ld]. nRet[%d]", nProcessId, nRet);
return HERE_ERROR_NONE;
}
nRet = app_info_create(strAppId, &hAppInfo);
- if (nRet != APP_MANAGER_ERROR_NONE)
- {
+ if (nRet != APP_MANAGER_ERROR_NONE) {
MAPS_LOGI("Get appinfo of [%s]. nRet[%d]", strAppId, nRet);
if (strAppId) free(strAppId);
return HERE_ERROR_NONE;
nRet = app_info_foreach_metadata(hAppInfo, AppInfoMetadataCb, NULL);
if (nRet != APP_MANAGER_ERROR_NONE)
- {
MAPS_LOGI("Get metadata. nRet[%d]", nRet);
- }
nRet = app_info_destroy(hAppInfo);
if (nRet != APP_MANAGER_ERROR_NONE)
- {
MAPS_LOGI("Destroy app_info. nRet[%d]", nRet);
- }
return HERE_ERROR_NONE;
}
nCodeStart = strKey.find("/");
- if(nCodeStart == 0 || nCodeStart >= (strKey.length()-1))
- {
+ if(nCodeStart == 0 || nCodeStart >= (strKey.length()-1)) {
MAPS_LOGE("[error] Key type fault : Key type should be as like XXXXX/YYYYY");
return HERE_ERROR_INVALID_PARAMETER;
}
strRequestAppId.append(strAppId);
g_free(strAppId);
}
- } else
+ } else {
strRequestAppId = ApplicationContext::GetInstance().GetRequestAppId();
+ }
if(!ApplicationContext::GetInstance().Initialize(strAppCode, strAppId, strRequestAppId))
return HERE_ERROR_INVALID_OPERATION;
if (!hPref)
return HERE_ERROR_INVALID_PARAMETER;
- if (m_hPref)
- {
+ if (m_hPref) {
if (maps_preference_destroy(m_hPref) != MAPS_ERROR_NONE)
return HERE_ERROR_INVALID_OPERATION;
}
error = maps_preference_get_language(hPref, &szLanguage);
if (error == MAPS_ERROR_NONE && szLanguage && strlen(szLanguage) > 0)
ApplicationContext::GetInstance().SetPreferredLanguage(String(szLanguage));
- } while(0);
+ } while (0);
return (here_error_e)ConvertToHereError(error);
}
{
HereSvcList::iterator it;
- while (1)
- {
+ while (1) {
pthread_mutex_lock(&m_mtxHereList);
- if (m_HereList.empty())
- {
+ if (m_HereList.empty()) {
pthread_mutex_unlock(&m_mtxHereList);
break;
}
try {
if (*it) (*it)->TerminateService();
m_HereList.erase(it);
- }
- catch (std::exception &e) {
+ } catch (std::exception &e) {
MAPS_LOGD("Exception caught: %s", e.what());
}
};
- if (m_hPref)
- {
+ if (m_hPref) {
maps_preference_destroy(m_hPref);
m_hPref = NULL;
}
{
here_error_e err = HERE_ERROR_NONE;
- switch (nErrorCode)
- {
+ switch (nErrorCode) {
case CONNECTION_ERROR_NONE:
//MAPS_LOGD("No error");
err = HERE_ERROR_NONE;
char *proxy_address = NULL;
- if (!m_hConnection)
- {
+ if (!m_hConnection) {
errorCode = connection_create(&m_hConnection);
if (errorCode == CONNECTION_ERROR_NONE)
- {
errorCode = connection_set_type_changed_cb(m_hConnection, NetworkStateChangedIndCb, this);
-
- }
}
if (errorCode != CONNECTION_ERROR_NONE)
return ConvertNetworkErrorCode(errorCode);
errorCode = connection_get_proxy(m_hConnection, CONNECTION_ADDRESS_FAMILY_IPV4, &proxy_address);
- if (errorCode == CONNECTION_ERROR_NONE)
- {
+ if (errorCode == CONNECTION_ERROR_NONE) {
MAPS_LOGD("Proxy = %s", (proxy_address ? proxy_address : "(null)"));
Tizen::Maps::HereConfig::SetProxyAddress(proxy_address);
}
HERE_PLUGIN_BEGIN_NAMESPACE
HereMultiRevGeocode::HereMultiRevGeocode(void* pCbFunc, void* pUserData, int nReqId)
-: m_geoCoord(0,0,0)
+ : m_geoCoord(0, 0, 0)
{
m_pQuery = NULL;
m_pCbFunc = pCbFunc;
HereMultiRevGeocode::~HereMultiRevGeocode()
{
- if (m_pQuery)
- {
+ if (m_pQuery) {
delete m_pQuery;
m_pQuery = NULL;
}
{
maps_error_e error = (maps_error_e)maps_address_create(&pAddr);
- if(error == MAPS_ERROR_NONE)
- {
+ if(error == MAPS_ERROR_NONE) {
pResult = (Result*)Reply.GetResult(i);
- if (pResult)
- {
+ if (pResult) {
Address tmpAddr = (pResult->GetLocation()).GetAddress();
if(!tmpAddr.GetHouseNumber().empty())
maps_address_list_append(address_list, pAddr);
}
- if (m_bCanceled || !m_pCbFunc)
- {
+ if (m_bCanceled || !m_pCbFunc) {
maps_address_list_destroy(address_list);
- }
- else if (nResults <= 0)
- {
+ } else if (nResults <= 0) {
((maps_service_multi_reverse_geocode_cb)m_pCbFunc)(MAPS_ERROR_NOT_FOUND, m_nReqId, 0, NULL, m_pUserData);
- }
- else
- {
+ } else {
((maps_service_multi_reverse_geocode_cb)m_pCbFunc)(MAPS_ERROR_NONE, m_nReqId, nResults, address_list, m_pUserData);
}
HerePlace::~HerePlace()
{
- if (m_pDiscoveryQuery)
- {
+ if (m_pDiscoveryQuery) {
delete m_pDiscoveryQuery;
m_pDiscoveryQuery = NULL;
}
- if (m_pPlaceDetailsQuery)
- {
+ if (m_pPlaceDetailsQuery) {
delete m_pPlaceDetailsQuery;
m_pPlaceDetailsQuery = NULL;
}
- while(!m_PlaceList.empty())
- {
+ while (!m_PlaceList.empty()) {
maps_place_destroy(m_PlaceList.front());
m_PlaceList.pop_front();
}
int ret;
maps_place_category_h mapsCate = NULL;
- if (maps_place_filter_get_category(hFilter, &mapsCate) == MAPS_ERROR_NONE)
- {
+ if (maps_place_filter_get_category(hFilter, &mapsCate) == MAPS_ERROR_NONE) {
CategoryList hereCateList;
Category hereCate;
char *szId = NULL, *szName = NULL, *szUrl = NULL;
g_free(szUrl);
ret = maps_place_category_get_id(mapsCate, &szId);
- if (ret == MAPS_ERROR_NONE && szId && *szId)
+ if (ret == MAPS_ERROR_NONE && szId && *szId) {
hereCate.SetCategoryId(CategoryId(szId));
- else if (hereCate.GetTitle().size() > 0)
- {
+ } else if (hereCate.GetTitle().size() > 0) {
hereCate.SetCategoryId(CategoryId(hereCate.GetTitle()));
hereCate.SetTitle("");
}
char *szKeyword = NULL;
ret = maps_place_filter_get_keyword(hFilter, &szKeyword);
- if (ret == MAPS_ERROR_NONE && szKeyword && *szKeyword)
- {
+ if (ret == MAPS_ERROR_NONE && szKeyword && *szKeyword) {
String szSearchText = m_pDiscoveryQuery->GetSearchText();
if (szSearchText.size() > 0) szSearchText += " ";
szSearchText += szKeyword;
char *szAddress = NULL;
ret = maps_place_filter_get_place_address(hFilter, &szAddress);
- if (ret == MAPS_ERROR_NONE && szAddress && *szAddress)
- {
+ if (ret == MAPS_ERROR_NONE && szAddress && *szAddress) {
String szSearchText = szAddress;
if (m_pDiscoveryQuery->GetSearchText().size() > 0)
- {
szSearchText += " " + m_pDiscoveryQuery->GetSearchText();
- }
m_pDiscoveryQuery->SetSearchText(szSearchText);
}
g_free(szAddress);
/* Merge search text with other search text being in preference */
String szSearchText = (szAddr ? szAddr : "");
- if (m_pDiscoveryQuery->GetSearchText().size() > 0)
- {
+ if (m_pDiscoveryQuery->GetSearchText().size() > 0) {
if (szSearchText.size() > 0) szSearchText += " ";
szSearchText += m_pDiscoveryQuery->GetSearchText();
}
m_pDiscoveryQuery->SetSearchText(szSearchText);
/* Decide command type */
- if (!szSearchText.empty())
- {
+ if (!szSearchText.empty()) {
cmdType = PLACE_CMD_TEXT;
- }
- else if (pArea->type == MAPS_AREA_CIRCLE && pArea->circle.radius == 0)
- {
+ } else if (pArea->type == MAPS_AREA_CIRCLE && pArea->circle.radius == 0) {
cmdType = PLACE_CMD_CENTER;
- }
- else
- {
+ } else {
cmdType = PLACE_CMD_AREA;
}
/* Get proximity with area */
- if (cmdType == PLACE_CMD_TEXT || cmdType == PLACE_CMD_CENTER)
- {
- if (pArea->type == MAPS_AREA_RECTANGLE)
- {
+ if (cmdType == PLACE_CMD_TEXT || cmdType == PLACE_CMD_CENTER) {
+ if (pArea->type == MAPS_AREA_RECTANGLE) {
double dLat1 = pArea->rect.top_left.latitude;
double dLng1 = pArea->rect.top_left.longitude;
double dLat2 = pArea->rect.bottom_right.latitude;
geoCoord.SetLatitude(dLat);
geoCoord.SetLongitude(dLng);
- }
- else if(pArea->type == MAPS_AREA_CIRCLE)
- {
+ } else if (pArea->type == MAPS_AREA_CIRCLE) {
double dLat = pArea->circle.center.latitude;
double dLng = pArea->circle.center.longitude;
geoCoord.SetLatitude(dLat);
geoCoord.SetLongitude(dLng);
- }
- else
+ } else {
return HERE_ERROR_INVALID_PARAMETER;
- }
- else if (cmdType == PLACE_CMD_AREA)
- {
- if (pArea->type == MAPS_AREA_RECTANGLE)
- {
+ }
+ } else if (cmdType == PLACE_CMD_AREA) {
+ if (pArea->type == MAPS_AREA_RECTANGLE) {
HereUtils::Convert(hArea, geoBox);
geoArea = &geoBox;
- }
- else if (pArea->type == MAPS_AREA_CIRCLE)
- {
+ } else if (pArea->type == MAPS_AREA_CIRCLE) {
HereUtils::Convert(hArea, geoCircle);
geoArea = &geoCircle;
- }
- else
+ } else {
return HERE_ERROR_INVALID_PARAMETER;
+ }
}
/* Set properties */
- if (cmdType == PLACE_CMD_TEXT)
- {
+ if (cmdType == PLACE_CMD_TEXT) {
m_pDiscoveryQuery->SetType(DiscoveryQuery::QT_SEARCH);
m_pDiscoveryQuery->SetProximity(geoCoord);
- }
- else if (cmdType == PLACE_CMD_CENTER)
- {
+ } else if (cmdType == PLACE_CMD_CENTER) {
m_pDiscoveryQuery->SetType(DiscoveryQuery::QT_EXPLORE);
m_pDiscoveryQuery->SetProximity(geoCoord);
- }
- else
- {
+ } else {
m_pDiscoveryQuery->SetType(DiscoveryQuery::QT_EXPLORE);
if (geoArea)
m_pDiscoveryQuery->SetArea(*geoArea);
return (bExcuted ? HERE_ERROR_NONE : HERE_ERROR_INVALID_OPERATION);
}
-void HerePlace::OnDiscoverReply (const DiscoveryReply &Reply)
+void HerePlace::OnDiscoverReply(const DiscoveryReply &Reply)
{
maps_place_h mapsPlace;
PlaceItemList herePlaceList = Reply.GetPlaceItems();
int error = MAPS_ERROR_UNKNOWN, sub_error;
bool is_valid, isPending;
- if (m_bCanceled || !m_pCbFunc)
- {
+ if (m_bCanceled || !m_pCbFunc) {
delete this;
return;
}
for (herePlaceIt = herePlaceList.begin();
herePlaceIt != herePlaceList.end();
- herePlaceIt++)
- {
- if ((error = maps_place_create(&mapsPlace)) == MAPS_ERROR_NONE)
- {
+ herePlaceIt++) {
+ if ((error = maps_place_create(&mapsPlace)) == MAPS_ERROR_NONE) {
isPending = false;
/* title, uri, id */
/* position */
hereCoord = herePlaceIt->GetPosition();
if (maps_coordinates_create(hereCoord.GetLatitude(), hereCoord.GetLongitude(),
- &mapsCoord) == MAPS_ERROR_NONE)
- {
+ &mapsCoord) == MAPS_ERROR_NONE) {
maps_place_set_location(mapsPlace, mapsCoord);
maps_coordinates_destroy(mapsCoord);
}
/* rating (optional) */
- if (maps_place_rating_create(&mapsRating) == MAPS_ERROR_NONE)
- {
+ if (maps_place_rating_create(&mapsRating) == MAPS_ERROR_NONE) {
maps_place_rating_set_average(mapsRating, herePlaceIt->GetAverageRating());
maps_place_set_rating(mapsPlace, mapsRating);
maps_place_rating_destroy(mapsRating);
hereCate = herePlaceIt->GetCategory();
maps_item_list_h mapsCateList;
- if (maps_item_list_create(&mapsCateList) == MAPS_ERROR_NONE)
- {
- if (maps_place_category_create(&mapsCate) == MAPS_ERROR_NONE)
- {
+ if (maps_item_list_create(&mapsCateList) == MAPS_ERROR_NONE) {
+ if (maps_place_category_create(&mapsCate) == MAPS_ERROR_NONE) {
is_valid = false;
- if (!hereCate.GetCategoryId().ToString().empty())
- {
+ if (!hereCate.GetCategoryId().ToString().empty()) {
sub_error = maps_place_category_set_id(mapsCate,
(char*)hereCate.GetCategoryId().ToString().c_str());
is_valid |= (sub_error == MAPS_ERROR_NONE);
}
- if (!hereCate.GetTitle().empty())
- {
+ if (!hereCate.GetTitle().empty()) {
sub_error = maps_place_category_set_name(mapsCate,
(char*)hereCate.GetTitle().c_str());
is_valid |= (sub_error == MAPS_ERROR_NONE);
}
- if (!hereCate.GetHref().empty())
- {
+ if (!hereCate.GetHref().empty()) {
sub_error = maps_place_category_set_url(mapsCate,
(char*)hereCate.GetHref().c_str());
is_valid |= (sub_error == MAPS_ERROR_NONE);
}
- if (is_valid)
- {
+ if (is_valid) {
maps_item_list_append(mapsCateList, mapsCate, maps_place_category_clone);
maps_place_set_categories(mapsPlace, mapsCateList);
maps_item_list_remove_all(mapsCateList, maps_place_category_destroy);
/* vicinity */
/* If needed PlaceDetails information, postpone to send a reply */
- if(__sending_place_details_query_automatically && !m_bReplyWithList)
- {
+ if(__sending_place_details_query_automatically && !m_bReplyWithList) {
hereLinkObj = herePlaceIt->GetLinkObject();
- if (!hereLinkObj.GetHref().empty() && !hereLinkObj.GetId().empty())
- {
- if (StartPlaceDetailsInternal(hereLinkObj.GetHref().c_str()) == HERE_ERROR_NONE)
- {
+ if (!hereLinkObj.GetHref().empty() && !hereLinkObj.GetId().empty()) {
+ if (StartPlaceDetailsInternal(hereLinkObj.GetHref().c_str()) == HERE_ERROR_NONE) {
m_PlaceList.push_back(mapsPlace);
isPending = true;
MAPS_LOGD("Add maps_place_h to the pending list. id=%s", hereLinkObj.GetId().data());
m_nReplyIdx++;
m_PlaceList.push_back(mapsPlace);
}
- }
- else
- {
+ } else {
m_nReplyCnt--;
}
}
for (hereSearchIt = hereSearchList.begin();
hereSearchIt != hereSearchList.end();
- hereSearchIt++)
- {
+ hereSearchIt++) {
error = maps_place_create(&mapsPlace);
- if(error == MAPS_ERROR_NONE)
- {
+ if(error == MAPS_ERROR_NONE) {
is_valid = false;
// title, uri, szId
hereLinkObj = hereSearchIt->GetLinkObject();
- if (!hereLinkObj.GetTitle().empty())
- {
+ if (!hereLinkObj.GetTitle().empty()) {
sub_error = maps_place_set_name(mapsPlace,
(char*)hereLinkObj.GetTitle().c_str());
is_valid |= (sub_error == MAPS_ERROR_NONE);
}
- if (!hereLinkObj.GetHref().empty())
- {
+ if (!hereLinkObj.GetHref().empty()) {
sub_error = maps_place_set_uri(mapsPlace,
(char*)hereLinkObj.GetHref().c_str());
is_valid |= (sub_error == MAPS_ERROR_NONE);
}
- if (!hereLinkObj.GetId().empty())
- {
+ if (!hereLinkObj.GetId().empty()) {
sub_error = maps_place_set_id(mapsPlace,
(char*)hereLinkObj.GetId().c_str());
is_valid |= (sub_error == MAPS_ERROR_NONE);
/* icon */
/* type */
- if (!is_valid)
- {
+ if (!is_valid) {
m_nReplyCnt--;
error = MAPS_ERROR_NOT_FOUND;
maps_place_destroy(mapsPlace);
mapsPlace = NULL;
- }
- else
- {
+ } else {
m_PlaceList.push_back(mapsPlace);
m_nReplyIdx++;
}
- }
- else
- {
+ } else {
m_nReplyCnt--;
}
}
- if (!m_bReplyFlushed && (m_nReplyCnt == 0 || m_nReplyIdx == m_nReplyCnt))
- {
+ if (!m_bReplyFlushed && (m_nReplyCnt == 0 || m_nReplyIdx == m_nReplyCnt)) {
if (m_nReplyCnt == 0)
error = MAPS_ERROR_NOT_FOUND;
void HerePlace::OnDiscoverFailure(const DiscoveryReply& Reply)
{
- if (!m_bReplyFlushed)
- {
+ if (!m_bReplyFlushed) {
m_nReplyIdx = 0;
m_nReplyCnt = 0;
__flushReplies((maps_error_e)GetErrorCode(Reply));
}
}
-void HerePlace::OnPlaceDetailsReply (const PlaceDetailsReply &Reply)
+void HerePlace::OnPlaceDetailsReply(const PlaceDetailsReply &Reply)
{
- if (m_nReplyCnt == 0)
- {
- if (m_bCanceled || !m_pCbFunc)
- {
+ if (m_nReplyCnt == 0) {
+ if (m_bCanceled || !m_pCbFunc) {
delete this;
return;
}
/* Finding maps_place_h which is already pending since DiscoverReply */
PlaceList::iterator it;
- for (it = m_PlaceList.begin(); it != m_PlaceList.end(); it++)
- {
- if (maps_place_get_id(*it, &placeId) == MAPS_ERROR_NONE)
- {
+ for (it = m_PlaceList.begin(); it != m_PlaceList.end(); it++) {
+ if (maps_place_get_id(*it, &placeId) == MAPS_ERROR_NONE) {
placeIdLen = strlen(placeId);
- if(!herePlace.GetPlaceId().compare(0, placeIdLen, placeId))
- {
+ if(!herePlace.GetPlaceId().compare(0, placeIdLen, placeId)) {
mapsPlace = *it;
isPending = true;
MAPS_LOGD("Found maps_place_h in the pending list. id=%s", placeId);
if (!mapsPlace)
error = maps_place_create(&mapsPlace);
- if (error == MAPS_ERROR_NONE)
- {
+ if (error == MAPS_ERROR_NONE) {
is_valid = false;
/* name */
- if (!herePlace.GetName().empty())
- {
+ if (!herePlace.GetName().empty()) {
sub_error = maps_place_set_name(mapsPlace, (char*)herePlace.GetName().c_str());
is_valid |= (sub_error == MAPS_ERROR_NONE);
}
/* id */
- if (!herePlace.GetPlaceId().empty())
- {
+ if (!herePlace.GetPlaceId().empty()) {
sub_error = maps_place_set_id(mapsPlace, (char*)herePlace.GetPlaceId().c_str());
is_valid |= (sub_error == MAPS_ERROR_NONE);
}
/* view */
- if (!herePlace.GetView().empty())
- {
+ if (!herePlace.GetView().empty()) {
sub_error = maps_place_set_uri(mapsPlace, (char*)herePlace.GetView().c_str());
is_valid |= (sub_error == MAPS_ERROR_NONE);
}
- if (is_valid)
- {
+ if (is_valid) {
/* icon */
/* maps not supported // herePlace.GetIconPath(); */
m_PlaceList.push_back(mapsPlace);
m_nReplyIdx++;
- }
- else
- {
+ } else {
m_nReplyCnt--;
error = MAPS_ERROR_NOT_FOUND;
maps_place_destroy(mapsPlace);
mapsPlace = NULL;
}
- }
- else
- {
+ } else {
m_nReplyCnt--;
}
- if (!m_bReplyFlushed && (m_nReplyCnt == 0 || m_nReplyIdx == m_nReplyCnt))
- {
+ if (!m_bReplyFlushed && (m_nReplyCnt == 0 || m_nReplyIdx == m_nReplyCnt)) {
if (m_nReplyCnt == 0)
error = MAPS_ERROR_NOT_FOUND;
void HerePlace::OnPlaceDetailsFailure(const PlaceDetailsReply& Reply)
{
- if (!m_bPlaceDetailsInternal)
- {
- if (!m_bReplyFlushed)
- {
+ if (!m_bPlaceDetailsInternal) {
+ if (!m_bReplyFlushed) {
m_nReplyIdx = 0;
m_nReplyCnt = 0;
__flushReplies(GetErrorCode(Reply));
delete this;
}
- }
- else
- {
+ } else {
m_nReplyIdx++;
MAPS_LOGD("Internal error during updating detailed information for the place. (%d/%d)", m_nReplyIdx, m_nReplyCnt);
if (!m_bReplyFlushed && (m_nReplyIdx == m_nReplyCnt))
maps_coordinates_h mapsCoord;
if (maps_coordinates_create(hereCoord.GetLatitude(),
- hereCoord.GetLongitude(), &mapsCoord) == MAPS_ERROR_NONE)
- {
+ hereCoord.GetLongitude(), &mapsCoord) == MAPS_ERROR_NONE) {
maps_place_set_location(mapsPlace, mapsCoord);
maps_coordinates_destroy(mapsCoord);
}
int error;
bool is_valid;
- if (maps_address_create(&mapsAddr) == MAPS_ERROR_NONE)
- {
+ if (maps_address_create(&mapsAddr) == MAPS_ERROR_NONE) {
is_valid = false;
- if (!hereAddr.GetHouseNumber().empty())
- {
+ if (!hereAddr.GetHouseNumber().empty()) {
error = maps_address_set_building_number(mapsAddr,
hereAddr.GetHouseNumber().c_str());
is_valid |= (error == MAPS_ERROR_NONE);
}
- if (!hereAddr.GetStreet().empty())
- {
+ if (!hereAddr.GetStreet().empty()) {
error = maps_address_set_street(mapsAddr, hereAddr.GetStreet().c_str());
is_valid |= (error == MAPS_ERROR_NONE);
}
- if (!hereAddr.GetDistrict().empty())
- {
+ if (!hereAddr.GetDistrict().empty()) {
error = maps_address_set_district(mapsAddr, hereAddr.GetDistrict().c_str());
is_valid |= (error == MAPS_ERROR_NONE);
}
- if (!hereAddr.GetCity().empty())
- {
+ if (!hereAddr.GetCity().empty()) {
error = maps_address_set_city(mapsAddr, hereAddr.GetCity().c_str());
is_valid |= (error == MAPS_ERROR_NONE);
}
- if (!hereAddr.GetState().empty())
- {
+ if (!hereAddr.GetState().empty()) {
error = maps_address_set_state(mapsAddr, hereAddr.GetState().c_str());
is_valid |= (error == MAPS_ERROR_NONE);
}
- if (!hereAddr.GetCountry().empty())
- {
+ if (!hereAddr.GetCountry().empty()) {
error = maps_address_set_country(mapsAddr, hereAddr.GetCountry().c_str());
is_valid |= (error == MAPS_ERROR_NONE);
}
- if (!hereAddr.GetCountryCode().empty())
- {
+ if (!hereAddr.GetCountryCode().empty()) {
error = maps_address_set_country_code(mapsAddr, hereAddr.GetCountryCode().c_str());
is_valid |= (error == MAPS_ERROR_NONE);
}
- if (!hereAddr.GetCounty().empty())
- {
+ if (!hereAddr.GetCounty().empty()) {
error = maps_address_set_county(mapsAddr, hereAddr.GetCounty().c_str());
is_valid |= (error == MAPS_ERROR_NONE);
}
- if (!hereAddr.GetPostalCode().empty())
- {
+ if (!hereAddr.GetPostalCode().empty()) {
error = maps_address_set_postal_code(mapsAddr, hereAddr.GetPostalCode().c_str());
is_valid |= (error == MAPS_ERROR_NONE);
}
- if (!hereAddr.GetLabel().empty())
- {
+ if (!hereAddr.GetLabel().empty()) {
error = maps_address_set_freetext(mapsAddr, hereAddr.GetLabel().c_str());
is_valid |= (error == MAPS_ERROR_NONE);
}
if (is_valid)
- {
maps_place_set_address(mapsPlace, mapsAddr);
- }
+
maps_address_destroy(mapsAddr);
}
}
if (maps_item_list_create(&mapsContList) != MAPS_ERROR_NONE) return;
- for (hereCont = hereContList.begin(); hereCont != hereContList.end(); hereCont++)
- {
+ for (hereCont = hereContList.begin(); hereCont != hereContList.end(); hereCont++) {
if (maps_place_contact_create(&mapsCont) != MAPS_ERROR_NONE) continue;
is_valid = false;
- if (!hereCont->GetLabel().empty())
- {
+ if (!hereCont->GetLabel().empty()) {
error = maps_place_contact_set_label(mapsCont,
(char*)hereCont->GetLabel().c_str());
is_valid |= (error == MAPS_ERROR_NONE);
}
- if (!hereCont->GetValue().empty())
- {
+ if (!hereCont->GetValue().empty()) {
error = maps_place_contact_set_value(mapsCont,
(char*)hereCont->GetValue().c_str());
is_valid |= (error == MAPS_ERROR_NONE);
}
- if (!hereCont->GetContactType().empty())
- {
+ if (!hereCont->GetContactType().empty()) {
error = maps_place_contact_set_type(mapsCont,
(char*)hereCont->GetContactType().c_str());
is_valid |= (error == MAPS_ERROR_NONE);
}
if (is_valid)
- {
maps_item_list_append(mapsContList, mapsCont,
maps_place_contact_clone);
- }
+
maps_place_contact_destroy(mapsCont);
}
- if (maps_item_list_items(mapsContList))
- {
+ if (maps_item_list_items(mapsContList)) {
maps_place_set_contacts(mapsPlace, mapsContList);
maps_item_list_remove_all(mapsContList, maps_place_contact_destroy);
}
hereCate = hereCateList.begin();
if (maps_place_category_create(&mapsCate) == MAPS_ERROR_NONE)
{
- if (!hereCate->GetCategoryId().ToString().empty())
- {
+ if (!hereCate->GetCategoryId().ToString().empty()) {
error = maps_place_category_set_id(mapsCate,
hereCate->GetCategoryId().ToString().c_str());
is_valid |= (error == MAPS_ERROR_NONE);
}
- if (!hereCate->GetTitle().empty())
- {
+ if (!hereCate->GetTitle().empty()) {
error = maps_place_category_set_name(mapsCate,
hereCate->GetTitle().c_str());
is_valid |= (error == MAPS_ERROR_NONE);
}
- if (!hereCate->GetHref().empty())
- {
+ if (!hereCate->GetHref().empty()) {
error = maps_place_category_set_url(mapsCate,
hereCate->GetHref().c_str());
is_valid |= (error == MAPS_ERROR_NONE);
}
- if (is_valid)
- {
+ if (is_valid) {
maps_item_list_append(mapsCateList, mapsCate, maps_place_category_clone);
}
maps_place_category_destroy(mapsCate);
}
- if (maps_item_list_items(mapsCateList))
- {
+ if (maps_item_list_items(mapsCateList)) {
maps_place_set_categories(mapsPlace, mapsCateList);
maps_item_list_remove_all(mapsCateList, maps_place_category_destroy);
}
if (maps_item_list_create(&mapsImageList) != MAPS_ERROR_NONE) return;
- for (hereImage = hereImageList.begin(); hereImage != hereImageList.end(); hereImage++)
- {
+ for (hereImage = hereImageList.begin(); hereImage != hereImageList.end(); hereImage++) {
if (maps_place_image_create(&mapsImage) != MAPS_ERROR_NONE) continue;
is_valid = false;
/* here not supported
// maps_place_image_set_media(maps_place_image_h mapsPlace, maps_place_media_h media); */
- if (!hereImage->GetSource().empty())
- {
+ if (!hereImage->GetSource().empty()) {
error = maps_place_image_set_url(mapsImage, (char*)hereImage->GetSource().c_str());
is_valid |= (error == MAPS_ERROR_NONE);
}
- if (!hereImage->GetImageId().empty())
- {
+ if (!hereImage->GetImageId().empty()) {
error = maps_place_image_set_id(mapsImage, (char*)hereImage->GetImageId().c_str());
is_valid |= (error == MAPS_ERROR_NONE);
}
hereImageUser = hereImage->GetUser();
- if (maps_place_link_object_create(&mapsImageUser) == MAPS_ERROR_NONE)
- {
+ if (maps_place_link_object_create(&mapsImageUser) == MAPS_ERROR_NONE) {
is_valid2 = false;
- if (!hereImageUser.GetId().empty())
- {
+ if (!hereImageUser.GetId().empty()) {
error = maps_place_link_object_set_id(mapsImageUser,
(char*)hereImageUser.GetId().c_str());
is_valid2 |= (error == MAPS_ERROR_NONE);
}
- if (!hereImageUser.GetTitle().empty())
- {
+ if (!hereImageUser.GetTitle().empty()) {
error = maps_place_link_object_set_name(mapsImageUser,
(char*)hereImageUser.GetTitle().c_str());
is_valid2 |= (error == MAPS_ERROR_NONE);
}
- if (!hereImageUser.GetHref().empty())
- {
+ if (!hereImageUser.GetHref().empty()) {
error = maps_place_link_object_set_string(mapsImageUser,
(char*)hereImageUser.GetHref().c_str());
is_valid2 |= (error == MAPS_ERROR_NONE);
}
- if (!hereImageUser.GetType().empty())
- {
+ if (!hereImageUser.GetType().empty()) {
error = maps_place_link_object_set_type(mapsImageUser,
(char*)hereImageUser.GetType().c_str());
is_valid2 |= (error == MAPS_ERROR_NONE);
}
- if (is_valid2)
- {
+ if (is_valid2) {
maps_place_image_set_user_link(mapsImage, mapsImageUser);
is_valid |= is_valid2;
}
}
if (is_valid)
- {
maps_item_list_append(mapsImageList, mapsImage, maps_place_image_clone);
- }
+
maps_place_image_destroy(mapsImage);
}
- if (maps_item_list_items(mapsImageList))
- {
+ if (maps_item_list_items(mapsImageList)) {
maps_place_set_images(mapsPlace, mapsImageList);
maps_item_list_remove_all(mapsImageList, maps_place_image_destroy);
}
if (maps_item_list_create(&mapsEditList) != MAPS_ERROR_NONE) return;
- for (hereEdit = hereEditList.begin(); hereEdit != hereEditList.end(); hereEdit++)
- {
+ for (hereEdit = hereEditList.begin(); hereEdit != hereEditList.end(); hereEdit++) {
if (maps_place_editorial_create(&mapsEdit) != MAPS_ERROR_NONE) continue;
is_valid = false;
- if (!hereEdit->GetDescription().empty())
- {
+ if (!hereEdit->GetDescription().empty()) {
error = maps_place_editorial_set_description(mapsEdit,
(char*)hereEdit->GetDescription().c_str());
is_valid |= (error == MAPS_ERROR_NONE);
}
- if (!hereEdit->GetLanguage().empty())
- {
+ if (!hereEdit->GetLanguage().empty()) {
error = maps_place_editorial_set_language(mapsEdit,
(char*)hereEdit->GetLanguage().c_str());
is_valid |= (error == MAPS_ERROR_NONE);
/* maps_place_editorial_set_media(mapsEdit, maps_place_media_h media); */
if (is_valid)
- {
maps_item_list_append(mapsEditList, mapsEdit, maps_place_editorial_clone);
- }
+
maps_place_editorial_destroy(mapsEdit);
}
- if (maps_item_list_items(mapsEditList))
- {
+ if (maps_item_list_items(mapsEditList)) {
maps_place_set_editorials(mapsPlace, mapsEditList);
maps_item_list_remove_all(mapsEditList, maps_place_editorial_destroy);
}
if (maps_item_list_create(&mapsReviewList) != MAPS_ERROR_NONE) return;
- for (hereReview = hereReviewList.begin(); hereReview != hereReviewList.end(); hereReview++)
- {
+ for (hereReview = hereReviewList.begin(); hereReview != hereReviewList.end(); hereReview++) {
if (maps_place_review_create(&mapsReview) != MAPS_ERROR_NONE) continue;
is_valid = false;
- if (!hereReview->GetDateTime().empty())
- {
+ if (!hereReview->GetDateTime().empty()) {
error = maps_place_review_set_date(mapsReview,
(char*)hereReview->GetDateTime().c_str());
is_valid |= (error == MAPS_ERROR_NONE);
}
- if (!hereReview->GetDescription().empty())
- {
+ if (!hereReview->GetDescription().empty()) {
error = maps_place_review_set_description(mapsReview,
(char*)hereReview->GetDescription().c_str());
is_valid |= (error == MAPS_ERROR_NONE);
}
- if (!hereReview->GetLanguage().empty())
- {
+ if (!hereReview->GetLanguage().empty()) {
error = maps_place_review_set_language(mapsReview,
(char*)hereReview->GetLanguage().c_str());
is_valid |= (error == MAPS_ERROR_NONE);
maps_place_review_set_rating(mapsReview, hereReview->GetRating());
- if (!hereReview->GetTitle().empty())
- {
+ if (!hereReview->GetTitle().empty()) {
error = maps_place_review_set_title(mapsReview,
(char*)hereReview->GetTitle().c_str());
is_valid |= (error == MAPS_ERROR_NONE);
}
hereReviewUser = hereReview->GetUser();
- if (maps_place_link_object_create(&mapsReviewUser) == MAPS_ERROR_NONE)
- {
+ if (maps_place_link_object_create(&mapsReviewUser) == MAPS_ERROR_NONE) {
is_valid2 = false;
- if (!hereReviewUser.GetId().empty())
- {
+ if (!hereReviewUser.GetId().empty()) {
error = maps_place_link_object_set_id(mapsReviewUser,
(char*)hereReviewUser.GetId().c_str());
is_valid2 |= (error == MAPS_ERROR_NONE);
}
- if (!hereReviewUser.GetTitle().empty())
- {
+ if (!hereReviewUser.GetTitle().empty()) {
error = maps_place_link_object_set_name(mapsReviewUser,
(char*)hereReviewUser.GetTitle().c_str());
is_valid2 |= (error == MAPS_ERROR_NONE);
}
- if (!hereReviewUser.GetHref().empty())
- {
+ if (!hereReviewUser.GetHref().empty()) {
error = maps_place_link_object_set_string(mapsReviewUser,
(char*)hereReviewUser.GetHref().c_str());
is_valid2 |= (error == MAPS_ERROR_NONE);
}
- if (!hereReviewUser.GetType().empty())
- {
+ if (!hereReviewUser.GetType().empty()) {
error = maps_place_link_object_set_type(mapsReviewUser,
(char*)hereReviewUser.GetType().c_str());
is_valid2 |= (error == MAPS_ERROR_NONE);
}
- if (is_valid2)
- {
+ if (is_valid2) {
maps_place_review_set_user_link(mapsReview, mapsReviewUser);
is_valid |= is_valid2;
}
+
maps_place_link_object_destroy(mapsReviewUser);
}
if (is_valid)
- {
maps_item_list_append(mapsReviewList, mapsReview, maps_place_review_clone);
- }
+
maps_place_review_destroy(mapsReview);
}
- if (maps_item_list_items(mapsReviewList))
- {
+ if (maps_item_list_items(mapsReviewList)) {
maps_place_set_reviews(mapsPlace, mapsReviewList);
maps_item_list_remove_all(mapsReviewList, maps_place_review_destroy);
}
//need to check if GetId() exist
//maps_place_link_object_set_id(mapsRelated, hereRelated.GetId());
- if (!hereRelated.GetTitle().empty())
- {
+ if (!hereRelated.GetTitle().empty()) {
error = maps_place_link_object_set_name(mapsRelated,
(char*)hereRelated.GetTitle().c_str());
is_valid |= (error == MAPS_ERROR_NONE);
}
- if (!hereRelated.GetHref().empty())
- {
+ if (!hereRelated.GetHref().empty()) {
error = maps_place_link_object_set_string(mapsRelated,
(char*)hereRelated.GetHref().c_str());
is_valid |= (error == MAPS_ERROR_NONE);
}
- if (!hereRelated.GetType().empty())
- {
+ if (!hereRelated.GetType().empty()) {
error = maps_place_link_object_set_type(mapsRelated,
(char*)hereRelated.GetType().c_str());
is_valid |= (error == MAPS_ERROR_NONE);
}
if (is_valid)
- {
maps_place_set_related_link(mapsPlace, mapsRelated);
- }
+
maps_place_link_object_destroy(mapsRelated);
}
m_nReplyIdx = 0;
__sortList(m_PlaceList);
- if (m_bPlaceDetails)
- {
- if (error != MAPS_ERROR_NONE)
- {
+ if (m_bPlaceDetails) {
+ if (error != MAPS_ERROR_NONE) {
((maps_service_get_place_details_cb)m_pCbFunc)((maps_error_e)error, m_nReqId, NULL, m_pUserData);
return;
}
m_PlaceList.pop_front();
((maps_service_get_place_details_cb)m_pCbFunc)((maps_error_e)error, m_nReqId, mapsPlace, m_pUserData);
- }
- else if (m_bReplyWithList)
- {
+ } else if (m_bReplyWithList) {
if (error == MAPS_ERROR_NONE)
error = maps_place_list_create(&placeList);
- if (error != MAPS_ERROR_NONE)
- {
+ if (error != MAPS_ERROR_NONE) {
if (placeList)
maps_place_list_destroy(placeList);
((maps_service_search_place_list_cb)m_pCbFunc)((maps_error_e)error, m_nReqId, 0, NULL, m_pUserData);
return;
}
- while (m_nReplyIdx < m_nReplyCnt && !m_bCanceled && !m_PlaceList.empty())
- {
+ while (m_nReplyIdx < m_nReplyCnt && !m_bCanceled && !m_PlaceList.empty()) {
mapsPlace = m_PlaceList.front();
m_PlaceList.pop_front();
((maps_service_search_place_list_cb)m_pCbFunc)((maps_error_e)error, m_nReqId, maps_item_list_items(placeList), placeList, m_pUserData);
else
maps_place_list_destroy(placeList);
- }
- else
- {
- if (error != MAPS_ERROR_NONE)
- {
+ } else {
+ if (error != MAPS_ERROR_NONE) {
((maps_service_search_place_cb)m_pCbFunc)((maps_error_e)error, m_nReqId, 0, 0, NULL, m_pUserData);
return;
}
- while (m_nReplyIdx < m_nReplyCnt && !m_bCanceled && !m_PlaceList.empty())
- {
+ while (m_nReplyIdx < m_nReplyCnt && !m_bCanceled && !m_PlaceList.empty()) {
mapsPlace = m_PlaceList.front();
m_PlaceList.pop_front();
/* callback function */
if (((maps_service_search_place_cb)m_pCbFunc)((maps_error_e)error, m_nReqId,
m_nReplyIdx++, m_nReplyCnt, mapsPlace, m_pUserData) == FALSE)
- {
break;
- }
}
}
m_bReplyFlushed = true;
if (maps_place_get_name(item1, &str1) == MAPS_ERROR_NONE &&
maps_place_get_name(item2, &str2) == MAPS_ERROR_NONE)
- {
result = (strcmp(str1, str2) < 0);
- }
+
g_free(str1);
g_free(str2);
return result;
if (maps_place_get_id(item1, &str1) == MAPS_ERROR_NONE &&
maps_place_get_id(item2, &str2) == MAPS_ERROR_NONE)
- {
result = (strcmp(str1, str2) < 0);
- }
+
g_free(str1);
g_free(str2);
return result;
if (maps_place_get_distance(item1, &num1) == MAPS_ERROR_NONE &&
maps_place_get_distance(item2, &num2) == MAPS_ERROR_NONE)
- {
result = (num1 < num2);
- }
+
return result;
}
{
bool result = false;
maps_place_rating_h rat1 = NULL, rat2 = NULL;
- double num1 = 0, num2 = 0;
+ double num1 = 0, num2 = 0;
if (maps_place_get_rating(item1, &rat1) == MAPS_ERROR_NONE &&
- maps_place_get_rating(item2, &rat2) == MAPS_ERROR_NONE)
- {
+ maps_place_get_rating(item2, &rat2) == MAPS_ERROR_NONE) {
if (maps_place_rating_get_average(rat1, &num1) == MAPS_ERROR_NONE &&
maps_place_rating_get_average(rat2, &num2) == MAPS_ERROR_NONE)
- {
result = (num1 > num2);
- }
}
maps_place_rating_destroy(rat1);
maps_place_rating_destroy(rat2);
if (maps_place_category_get_id(item1, &str1) == MAPS_ERROR_NONE &&
maps_place_category_get_id(item2, &str2) == MAPS_ERROR_NONE)
- {
result = (strcmp(str1, str2) < 0);
- }
+
maps_place_category_destroy(item1);
maps_place_category_destroy(item2);
g_free(str1);
{
if (!m_szSortBy) return;
- if (!strcmp(m_szSortBy, "name") || !strcmp(m_szSortBy, "title"))
- {
+ if (!strcmp(m_szSortBy, "name") || !strcmp(m_szSortBy, "title")) {
std::sort(list.begin(), list.end(), __compareWithTitle);
- }
- else if (!strcmp(m_szSortBy, "id"))
- {
+ } else if (!strcmp(m_szSortBy, "id")) {
std::sort(list.begin(), list.end(), __compareWithId);
- }
- else if (!strcmp(m_szSortBy, "distance"))
- {
+ } else if (!strcmp(m_szSortBy, "distance")) {
std::sort(list.begin(), list.end(), __compareWithDistance);
- }
- else if (!strcmp(m_szSortBy, "rate") || !strcmp(m_szSortBy, "rating"))
- {
+ } else if (!strcmp(m_szSortBy, "rate") || !strcmp(m_szSortBy, "rating")) {
std::sort(list.begin(), list.end(), __compareWithRating);
- }
- else if (!strcmp(m_szSortBy, "category"))
- {
+ } else if (!strcmp(m_szSortBy, "category")) {
std::sort(list.begin(), list.end(), __compareWithCategory);
}
}
extern "C"
{
-
EXPORT_API int maps_plugin_init(maps_plugin_h *plugin)
{
int ret = HerePluginInit(plugin);
HERE_PLUGIN_BEGIN_NAMESPACE
HereRevGeocode::HereRevGeocode(void* pCbFunc, void* pUserData, int nReqId)
-: m_geoCoord(0,0,0)
+ : m_geoCoord(0, 0, 0)
{
m_pQuery = NULL;
m_pCbFunc = pCbFunc;
HereRevGeocode::~HereRevGeocode()
{
- if (m_pQuery)
- {
+ if (m_pQuery) {
delete m_pQuery;
m_pQuery = NULL;
}
void HereRevGeocode::OnGeoCoderReply(const GeoCoderReply& Reply)
{
- if (m_bCanceled || !m_pCbFunc) // ignore call back
- {
+ if (m_bCanceled || !m_pCbFunc) { // ignore call back
delete this;
return;
}
float fDistance, fShortestDistance = 0;
int nShortestIdx = -1;
- for (size_t i = 0; i < (size_t)nResults; i++)
- {
+ for (size_t i = 0; i < (size_t)nResults; i++) {
pResult = (Result*)Reply.GetResult(i);
- if(pResult)
- {
+ if(pResult) {
fDistance = pResult->GetDistance();
- if (nShortestIdx < 0 || fDistance < fShortestDistance)
- {
+ if (nShortestIdx < 0 || fDistance < fShortestDistance) {
fShortestDistance = fDistance;
nShortestIdx = i;
}
}
- if (nShortestIdx < 0)
- {
+ if (nShortestIdx < 0) {
((maps_service_reverse_geocode_cb)m_pCbFunc)(MAPS_ERROR_NOT_FOUND,
m_nReqId, 0, 0, NULL, m_pUserData);
delete this;
maps_error_e error = (maps_error_e)maps_address_create(&hAddr);
String *additionalDataValue = NULL;
- if(error == MAPS_ERROR_NONE)
- {
+ if(error == MAPS_ERROR_NONE) {
pResult = (Result*)Reply.GetResult(nShortestIdx);
- if (pResult)
- {
+ if (pResult) {
Address tmpAddr = (pResult->GetLocation()).GetAddress();
if (!tmpAddr.GetHouseNumber().empty())
}
}
- if (m_bCanceled)
- {
+ if (m_bCanceled) {
maps_address_destroy(hAddr);
- }
- else
- {
+ } else {
int nResult = (error == MAPS_ERROR_NONE ? 1 : 0);
((maps_service_reverse_geocode_cb)m_pCbFunc)(error, m_nReqId, 0, nResult, hAddr, m_pUserData);
}
}
HERE_PLUGIN_END_NAMESPACE
-
HereRoute::~HereRoute()
{
- if (m_pQuery)
- {
+ if (m_pQuery) {
delete m_pQuery;
m_pQuery = NULL;
}
GeoCoordinates hereCoord;
double dLatitude, dLongitude;
- for (int index = 0; index < nWaypointNum; index++)
- {
+ for (int index = 0; index < nWaypointNum; index++) {
if (hWaypointList[index] != NULL) {
maps_coordinates_get_latitude(hWaypointList[index], &dLatitude);
maps_coordinates_get_longitude(hWaypointList[index], &dLongitude);
/* transport mode */
maps_route_transport_mode_e eTransMode;
- if (maps_preference_get_route_transport_mode(hPref, &eTransMode) == MAPS_ERROR_NONE)
- {
+ if (maps_preference_get_route_transport_mode(hPref, &eTransMode) == MAPS_ERROR_NONE) {
m_pQuery->SetTravelModes(HereUtils::Convert(eTransMode));
}
maps_route_feature_e eFeature;
maps_route_feature_weight_e eFeatureWeight;
if (maps_preference_get_route_feature(hPref, &eFeature) == MAPS_ERROR_NONE &&
- maps_preference_get_route_feature_weight(hPref, &eFeatureWeight) == MAPS_ERROR_NONE)
- {
+ maps_preference_get_route_feature_weight(hPref, &eFeatureWeight) == MAPS_ERROR_NONE) {
m_pQuery->SetFeatureWeight(HereUtils::Convert(eFeature),
HereUtils::Convert(eFeatureWeight));
}
/* exclude areas */
char *szAreaToAvoid;
- if (maps_preference_get(hPref, MAPS_ROUTE_RECT_AREA_TO_AVOID, &szAreaToAvoid) == MAPS_ERROR_NONE)
- {
+ if (maps_preference_get(hPref, MAPS_ROUTE_RECT_AREA_TO_AVOID, &szAreaToAvoid) == MAPS_ERROR_NONE) {
GeoBoundingBox gbBox;
GeoBoundingBoxList gbBoxList;
gbBoxList.push_back(HereUtils::Convert(szAreaToAvoid, gbBox));
/* optimization */
GeoRouteQuery::RouteOptimization hereOpt;
maps_route_optimization_e mapsOpt;
- if (maps_preference_get_route_optimization(hPref, &mapsOpt) == MAPS_ERROR_NONE)
- {
- switch (mapsOpt)
- {
+ if (maps_preference_get_route_optimization(hPref, &mapsOpt) == MAPS_ERROR_NONE) {
+ switch (mapsOpt) {
case MAPS_ROUTE_TYPE_FASTEST: hereOpt = GeoRouteQuery::RO_FastestRoute; break;
case MAPS_ROUTE_TYPE_SHORTEST: hereOpt = GeoRouteQuery::RO_ShortestRoute; break;
default: hereOpt = GeoRouteQuery::RO_FastestRoute; break;
/* Metric System */
GeoRouteQuery::MetricSystem eMetric;
maps_distance_unit_e eUnit;
- if (maps_preference_get_distance_unit(hPref, &eUnit) == MAPS_ERROR_NONE)
- {
- switch (eUnit)
- {
+ if (maps_preference_get_distance_unit(hPref, &eUnit) == MAPS_ERROR_NONE) {
+ switch (eUnit) {
case MAPS_DISTANCE_UNIT_M: eMetric = GeoRouteQuery::DIST_metric; break;
case MAPS_DISTANCE_UNIT_KM: eMetric = GeoRouteQuery::DIST_metric; break;
default: eMetric = GeoRouteQuery::DIST_imperial; break;
}
char *szViewBounds;
- if (maps_preference_get(hPref, MAPS_ROUTE_GEOMETRY_BOUNDING_BOX, &szViewBounds) == MAPS_ERROR_NONE)
- {
+ if (maps_preference_get(hPref, MAPS_ROUTE_GEOMETRY_BOUNDING_BOX, &szViewBounds) == MAPS_ERROR_NONE) {
GeoBoundingBox gbBox;
HereUtils::Convert(szViewBounds, gbBox);
m_pQuery->SetViewBounds(gbBox);
}
bool is_alternatives_enabled = false;
- if (maps_preference_get_route_alternatives_enabled(hPref, &is_alternatives_enabled) == MAPS_ERROR_NONE)
- {
+ if (maps_preference_get_route_alternatives_enabled(hPref, &is_alternatives_enabled) == MAPS_ERROR_NONE) {
if (is_alternatives_enabled)
- {
m_pQuery->SetAlternatives(2);
- }
}
char *szRealtimeTraffic;
if (maps_preference_get(hPref, MAPS_ROUTE_REALTIME_TRAFFIC, &szRealtimeTraffic) == MAPS_ERROR_NONE)
{
- if (!strcmp(szRealtimeTraffic, "true") || !strcmp(szRealtimeTraffic, "enabled"))
- {
+ if (!strcmp(szRealtimeTraffic, "true") || !strcmp(szRealtimeTraffic, "enabled")) {
m_pQuery->SetRealtimeTraffic(1);
- }
- else if (!strcmp(szRealtimeTraffic, "false") || !strcmp(szRealtimeTraffic, "disabled"))
- {
+ } else if (!strcmp(szRealtimeTraffic, "false") || !strcmp(szRealtimeTraffic, "disabled")) {
m_pQuery->SetRealtimeTraffic(2);
- }
- else
- {
+ } else {
m_pQuery->SetRealtimeTraffic(0);
}
g_free(szRealtimeTraffic);
void HereRoute::OnRouteReply(const GeoRouteReply& Reply)
{
- if (m_bCanceled || !m_pCbFunc || !m_pQuery) // ignore call back if it was cancelled.
- {
+ if (m_bCanceled || !m_pCbFunc || !m_pQuery) { // ignore call back if it was cancelled.
delete this;
return;
}
int nReplyIdx = 0, nReplyNum = hereRouteList.size();
GeoRouteList::iterator hereRoute;
- if (nReplyNum == 0)
- {
+ if (nReplyNum == 0) {
((maps_service_search_route_cb)m_pCbFunc)(MAPS_ERROR_NOT_FOUND, m_nReqId,
0, 0, NULL, m_pUserData);
delete this;
return;
}
- for (hereRoute = hereRouteList.begin() ; hereRoute != hereRouteList.end() ; hereRoute++)
- {
+ for (hereRoute = hereRouteList.begin() ; hereRoute != hereRouteList.end() ; hereRoute++) {
error = (maps_error_e)maps_route_create(&mapsRoute);
- if (error == MAPS_ERROR_NONE)
- {
+ if (error == MAPS_ERROR_NONE) {
/* route id */
if (!hereRoute->GetRouteId().empty())
maps_route_set_route_id(mapsRoute, (char*)hereRoute->GetRouteId().c_str());
maps_item_list_h mapsPathList;
maps_coordinates_h mapsPath;
- if (maps_item_list_create(&mapsPathList) == MAPS_ERROR_NONE)
- {
+ if (maps_item_list_create(&mapsPathList) == MAPS_ERROR_NONE) {
GeoCoordinateList::iterator herePath;
- for (herePath = herePathList.begin(); herePath != herePathList.end(); herePath++)
- {
+ for (herePath = herePathList.begin(); herePath != herePathList.end(); herePath++) {
double dLat = herePath->GetLatitude();
double dLng = herePath->GetLongitude();
- if(maps_coordinates_create(dLat, dLng, &mapsPath) == MAPS_ERROR_NONE)
- {
+ if(maps_coordinates_create(dLat, dLng, &mapsPath) == MAPS_ERROR_NONE) {
if (herePath == herePathList.begin())
maps_route_set_origin(mapsRoute, mapsPath);
else if (herePath == herePathList.end()-1)
}
}
- if (maps_item_list_items(mapsPathList))
- {
+ if (maps_item_list_items(mapsPathList)) {
maps_route_set_path(mapsRoute, mapsPathList);
maps_item_list_remove_all(mapsPathList, maps_coordinates_destroy);
}
/* bounding box */
maps_area_h hMapsArea = NULL;
HereUtils::Convert(hereRoute->GetBounds(), hMapsArea);
- if (hMapsArea)
- {
+ if (hMapsArea) {
maps_route_set_bounding_box(mapsRoute, hMapsArea);
maps_area_destroy(hMapsArea);
}
ProcessSegments(mapsRoute, hereRoute->GetRouteSegmentList());
}
- if (m_bCanceled)
- {
+ if (m_bCanceled) {
maps_route_destroy(mapsRoute);
break;
- }
- else
- {
+ } else {
if (((maps_service_search_route_cb)m_pCbFunc)(error, m_nReqId,
- nReplyIdx++, nReplyNum, mapsRoute, m_pUserData) == FALSE)
- {
+ nReplyIdx++, nReplyNum, mapsRoute, m_pUserData) == FALSE) {
delete this;
return;
}
GeoCoordinateList herePathList = hereSegm->GetPath();
int here_path_list_size = herePathList.size();
- if (here_path_list_size > 0)
- {
+ if (here_path_list_size > 0) {
GeoCoordinates hereOrig = herePathList.at(0);
GeoCoordinates hereDest = herePathList.at(here_path_list_size-1);
maps_route_segment_destroy(mapsSegm);
}
- if (maps_item_list_items(mapsSegmList))
- {
+ if (maps_item_list_items(mapsSegmList)) {
maps_route_set_segments(mapsRoute, mapsSegmList);
maps_item_list_remove_all(mapsSegmList, maps_route_segment_destroy);
}
return error;
ManeuverList::const_iterator hereMane;
- for (hereMane = hereManeList.begin() ; hereMane != hereManeList.end() ; hereMane++)
- {
+ for (hereMane = hereManeList.begin() ; hereMane != hereManeList.end() ; hereMane++) {
if (maps_route_maneuver_create(&mapsManeuver) != MAPS_ERROR_NONE) continue;
/* position */
if (maps_coordinates_create(hereMane->GetPosition().GetLatitude(),
- hereMane->GetPosition().GetLongitude(), &mapsCoord) == MAPS_ERROR_NONE)
- {
+ hereMane->GetPosition().GetLongitude(), &mapsCoord) == MAPS_ERROR_NONE) {
maps_route_maneuver_set_position(mapsManeuver, mapsCoord);
maps_coordinates_destroy(mapsCoord);
}
maps_route_maneuver_destroy(mapsManeuver);
}
- if (maps_item_list_items(mapsManeList))
- {
+ if (maps_item_list_items(mapsManeList)) {
maps_route_segment_set_maneuvers(mapsSegm, mapsManeList);
maps_item_list_remove_all(mapsManeList, maps_route_maneuver_destroy);
}
{
int ConvertToMapsError(int nErr)
{
- switch (nErr)
- {
- case HERE_ERROR_NONE: return MAPS_ERROR_NONE;
- case HERE_ERROR_PERMISSION_DENIED: return MAPS_ERROR_PERMISSION_DENIED;
- case HERE_ERROR_OUT_OF_MEMORY: return MAPS_ERROR_OUT_OF_MEMORY;
- case HERE_ERROR_INVALID_PARAMETER: return MAPS_ERROR_INVALID_PARAMETER;
- case HERE_ERROR_NOT_SUPPORTED: return MAPS_ERROR_NOT_SUPPORTED;
- case HERE_ERROR_CONNECTION_TIME_OUT: return MAPS_ERROR_CONNECTION_TIME_OUT;
- case HERE_ERROR_NETWORK_UNREACHABLE: return MAPS_ERROR_NETWORK_UNREACHABLE;
- case HERE_ERROR_INVALID_OPERATION: return MAPS_ERROR_INVALID_OPERATION;
- case HERE_ERROR_KEY_NOT_AVAILABLE: return MAPS_ERROR_KEY_NOT_AVAILABLE;
- case HERE_ERROR_RESOURCE_BUSY: return MAPS_ERROR_RESOURCE_BUSY;
- case HERE_ERROR_CANCELED: return MAPS_ERROR_CANCELED;
- case HERE_ERROR_UNKNOWN: return MAPS_ERROR_UNKNOWN;
- case HERE_ERROR_SERVICE_NOT_AVAILABLE: return MAPS_ERROR_SERVICE_NOT_AVAILABLE;
- case HERE_ERROR_NOT_FOUND: return MAPS_ERROR_NOT_FOUND;
+ switch (nErr) {
+ case HERE_ERROR_NONE: return MAPS_ERROR_NONE;
+ case HERE_ERROR_PERMISSION_DENIED: return MAPS_ERROR_PERMISSION_DENIED;
+ case HERE_ERROR_OUT_OF_MEMORY: return MAPS_ERROR_OUT_OF_MEMORY;
+ case HERE_ERROR_INVALID_PARAMETER: return MAPS_ERROR_INVALID_PARAMETER;
+ case HERE_ERROR_NOT_SUPPORTED: return MAPS_ERROR_NOT_SUPPORTED;
+ case HERE_ERROR_CONNECTION_TIME_OUT: return MAPS_ERROR_CONNECTION_TIME_OUT;
+ case HERE_ERROR_NETWORK_UNREACHABLE: return MAPS_ERROR_NETWORK_UNREACHABLE;
+ case HERE_ERROR_INVALID_OPERATION: return MAPS_ERROR_INVALID_OPERATION;
+ case HERE_ERROR_KEY_NOT_AVAILABLE: return MAPS_ERROR_KEY_NOT_AVAILABLE;
+ case HERE_ERROR_RESOURCE_BUSY: return MAPS_ERROR_RESOURCE_BUSY;
+ case HERE_ERROR_CANCELED: return MAPS_ERROR_CANCELED;
+ case HERE_ERROR_UNKNOWN: return MAPS_ERROR_UNKNOWN;
+ case HERE_ERROR_SERVICE_NOT_AVAILABLE: return MAPS_ERROR_SERVICE_NOT_AVAILABLE;
+ case HERE_ERROR_NOT_FOUND: return MAPS_ERROR_NOT_FOUND;
}
return MAPS_ERROR_UNKNOWN;
}
int ConvertToHereError(int nErr)
{
- switch (nErr)
- {
- case MAPS_ERROR_NONE: return HERE_ERROR_NONE;
- case MAPS_ERROR_PERMISSION_DENIED: return HERE_ERROR_PERMISSION_DENIED;
- case MAPS_ERROR_OUT_OF_MEMORY: return HERE_ERROR_OUT_OF_MEMORY;
- case MAPS_ERROR_INVALID_PARAMETER: return HERE_ERROR_INVALID_PARAMETER;
- case MAPS_ERROR_NOT_SUPPORTED: return HERE_ERROR_NOT_SUPPORTED;
- case MAPS_ERROR_CONNECTION_TIME_OUT: return HERE_ERROR_CONNECTION_TIME_OUT;
- case MAPS_ERROR_NETWORK_UNREACHABLE: return HERE_ERROR_NETWORK_UNREACHABLE;
- case MAPS_ERROR_INVALID_OPERATION: return HERE_ERROR_INVALID_OPERATION;
- case MAPS_ERROR_KEY_NOT_AVAILABLE: return HERE_ERROR_KEY_NOT_AVAILABLE;
- case MAPS_ERROR_RESOURCE_BUSY: return HERE_ERROR_RESOURCE_BUSY;
- case MAPS_ERROR_CANCELED: return HERE_ERROR_CANCELED;
- case MAPS_ERROR_UNKNOWN: return HERE_ERROR_UNKNOWN;
- case MAPS_ERROR_SERVICE_NOT_AVAILABLE: return HERE_ERROR_SERVICE_NOT_AVAILABLE;
- case MAPS_ERROR_NOT_FOUND: return HERE_ERROR_NOT_FOUND;
+ switch (nErr) {
+ case MAPS_ERROR_NONE: return HERE_ERROR_NONE;
+ case MAPS_ERROR_PERMISSION_DENIED: return HERE_ERROR_PERMISSION_DENIED;
+ case MAPS_ERROR_OUT_OF_MEMORY: return HERE_ERROR_OUT_OF_MEMORY;
+ case MAPS_ERROR_INVALID_PARAMETER: return HERE_ERROR_INVALID_PARAMETER;
+ case MAPS_ERROR_NOT_SUPPORTED: return HERE_ERROR_NOT_SUPPORTED;
+ case MAPS_ERROR_CONNECTION_TIME_OUT: return HERE_ERROR_CONNECTION_TIME_OUT;
+ case MAPS_ERROR_NETWORK_UNREACHABLE: return HERE_ERROR_NETWORK_UNREACHABLE;
+ case MAPS_ERROR_INVALID_OPERATION: return HERE_ERROR_INVALID_OPERATION;
+ case MAPS_ERROR_KEY_NOT_AVAILABLE: return HERE_ERROR_KEY_NOT_AVAILABLE;
+ case MAPS_ERROR_RESOURCE_BUSY: return HERE_ERROR_RESOURCE_BUSY;
+ case MAPS_ERROR_CANCELED: return HERE_ERROR_CANCELED;
+ case MAPS_ERROR_UNKNOWN: return HERE_ERROR_UNKNOWN;
+ case MAPS_ERROR_SERVICE_NOT_AVAILABLE: return HERE_ERROR_SERVICE_NOT_AVAILABLE;
+ case MAPS_ERROR_NOT_FOUND: return HERE_ERROR_NOT_FOUND;
}
return HERE_ERROR_UNKNOWN;
}
const char* ConverHereErrorToString(int nErr)
{
- switch (nErr)
- {
- case HERE_ERROR_NONE: return "No errors";
- case HERE_ERROR_PERMISSION_DENIED: return "Permission denied";
- case HERE_ERROR_OUT_OF_MEMORY: return "Out of memory";
- case HERE_ERROR_INVALID_PARAMETER: return "Invalid Parameter";
- case HERE_ERROR_NOT_SUPPORTED: return "Not suppoerted";
- case HERE_ERROR_CONNECTION_TIME_OUT: return "Connection time out";
- case HERE_ERROR_NETWORK_UNREACHABLE: return "Network unreachable";
- case HERE_ERROR_INVALID_OPERATION: return "Invalid operation";
- case HERE_ERROR_KEY_NOT_AVAILABLE: return "Key not available";
- case HERE_ERROR_RESOURCE_BUSY: return "Resource busy";
- case HERE_ERROR_CANCELED: return "Canceled";
- case HERE_ERROR_UNKNOWN: return "Unknown";
- case HERE_ERROR_SERVICE_NOT_AVAILABLE: return "Service not available";
- case HERE_ERROR_NOT_FOUND: return "Not found";
+ switch (nErr) {
+ case HERE_ERROR_NONE: return "No errors";
+ case HERE_ERROR_PERMISSION_DENIED: return "Permission denied";
+ case HERE_ERROR_OUT_OF_MEMORY: return "Out of memory";
+ case HERE_ERROR_INVALID_PARAMETER: return "Invalid Parameter";
+ case HERE_ERROR_NOT_SUPPORTED: return "Not suppoerted";
+ case HERE_ERROR_CONNECTION_TIME_OUT: return "Connection time out";
+ case HERE_ERROR_NETWORK_UNREACHABLE: return "Network unreachable";
+ case HERE_ERROR_INVALID_OPERATION: return "Invalid operation";
+ case HERE_ERROR_KEY_NOT_AVAILABLE: return "Key not available";
+ case HERE_ERROR_RESOURCE_BUSY: return "Resource busy";
+ case HERE_ERROR_CANCELED: return "Canceled";
+ case HERE_ERROR_UNKNOWN: return "Unknown";
+ case HERE_ERROR_SERVICE_NOT_AVAILABLE: return "Service not available";
+ case HERE_ERROR_NOT_FOUND: return "Not found";
}
return "Unknown";
}
const char* ConvertMapsErrorToChar(int nErr)
{
- switch (nErr)
- {
- case MAPS_ERROR_NONE: return "MAPS_ERROR_NONE";
- case MAPS_ERROR_PERMISSION_DENIED: return "MAPS_ERROR_PERMISSION_DENIED";
- case MAPS_ERROR_OUT_OF_MEMORY: return "MAPS_ERROR_OUT_OF_MEMORY";
- case MAPS_ERROR_INVALID_PARAMETER: return "MAPS_ERROR_INVALID_PARAMETER";
- case MAPS_ERROR_NOT_SUPPORTED: return "MAPS_ERROR_NOT_SUPPORTED";
- case MAPS_ERROR_CONNECTION_TIME_OUT: return "MAPS_ERROR_CONNECTION_TIME_OUT";
- case MAPS_ERROR_NETWORK_UNREACHABLE: return "MAPS_ERROR_NETWORK_UNREACHABLE";
- case MAPS_ERROR_INVALID_OPERATION: return "MAPS_ERROR_INVALID_OPERATION";
- case MAPS_ERROR_KEY_NOT_AVAILABLE: return "MAPS_ERROR_KEY_NOT_AVAILABLE";
- case MAPS_ERROR_RESOURCE_BUSY: return "MAPS_ERROR_RESOURCE_BUSY";
- case MAPS_ERROR_CANCELED: return "MAPS_ERROR_CANCELED";
- case MAPS_ERROR_UNKNOWN: return "MAPS_ERROR_UNKNOWN";
- case MAPS_ERROR_SERVICE_NOT_AVAILABLE: return "MAPS_ERROR_SERVICE_NOT_AVAILABLE";
- case MAPS_ERROR_NOT_FOUND: return "MAPS_ERROR_NOT_FOUND";
+ switch (nErr) {
+ case MAPS_ERROR_NONE: return "MAPS_ERROR_NONE";
+ case MAPS_ERROR_PERMISSION_DENIED: return "MAPS_ERROR_PERMISSION_DENIED";
+ case MAPS_ERROR_OUT_OF_MEMORY: return "MAPS_ERROR_OUT_OF_MEMORY";
+ case MAPS_ERROR_INVALID_PARAMETER: return "MAPS_ERROR_INVALID_PARAMETER";
+ case MAPS_ERROR_NOT_SUPPORTED: return "MAPS_ERROR_NOT_SUPPORTED";
+ case MAPS_ERROR_CONNECTION_TIME_OUT: return "MAPS_ERROR_CONNECTION_TIME_OUT";
+ case MAPS_ERROR_NETWORK_UNREACHABLE: return "MAPS_ERROR_NETWORK_UNREACHABLE";
+ case MAPS_ERROR_INVALID_OPERATION: return "MAPS_ERROR_INVALID_OPERATION";
+ case MAPS_ERROR_KEY_NOT_AVAILABLE: return "MAPS_ERROR_KEY_NOT_AVAILABLE";
+ case MAPS_ERROR_RESOURCE_BUSY: return "MAPS_ERROR_RESOURCE_BUSY";
+ case MAPS_ERROR_CANCELED: return "MAPS_ERROR_CANCELED";
+ case MAPS_ERROR_UNKNOWN: return "MAPS_ERROR_UNKNOWN";
+ case MAPS_ERROR_SERVICE_NOT_AVAILABLE: return "MAPS_ERROR_SERVICE_NOT_AVAILABLE";
+ case MAPS_ERROR_NOT_FOUND: return "MAPS_ERROR_NOT_FOUND";
}
return "MAPS_ERROR_UNKNOWN";
}
GeoRouteQuery::TravelMode HereUtils::Convert(maps_route_transport_mode_e nVal)
{
- switch (nVal)
- {
- case MAPS_ROUTE_TRANSPORT_MODE_CAR: return GeoRouteQuery::TM_CarTravel;
- case MAPS_ROUTE_TRANSPORT_MODE_PEDESTRIAN: return GeoRouteQuery::TM_PedestrianTravel;
- case MAPS_ROUTE_TRANSPORT_MODE_PUBLICTRANSIT: return GeoRouteQuery::TM_PublicTransitTravel;
- default: break;
+ switch (nVal) {
+ case MAPS_ROUTE_TRANSPORT_MODE_CAR: return GeoRouteQuery::TM_CarTravel;
+ case MAPS_ROUTE_TRANSPORT_MODE_PEDESTRIAN: return GeoRouteQuery::TM_PedestrianTravel;
+ case MAPS_ROUTE_TRANSPORT_MODE_PUBLICTRANSIT: return GeoRouteQuery::TM_PublicTransitTravel;
+ default: break;
}
return GeoRouteQuery::TM_CarTravel;
}
maps_route_transport_mode_e HereUtils::Convert(GeoRouteQuery::TravelMode nVal)
{
- switch (nVal)
- {
- case GeoRouteQuery::TM_CarTravel: return MAPS_ROUTE_TRANSPORT_MODE_CAR;
- case GeoRouteQuery::TM_PedestrianTravel: return MAPS_ROUTE_TRANSPORT_MODE_PEDESTRIAN;
- case GeoRouteQuery::TM_PublicTransitTravel: return MAPS_ROUTE_TRANSPORT_MODE_PUBLICTRANSIT;
- default: break;
+ switch (nVal) {
+ case GeoRouteQuery::TM_CarTravel: return MAPS_ROUTE_TRANSPORT_MODE_CAR;
+ case GeoRouteQuery::TM_PedestrianTravel: return MAPS_ROUTE_TRANSPORT_MODE_PEDESTRIAN;
+ case GeoRouteQuery::TM_PublicTransitTravel: return MAPS_ROUTE_TRANSPORT_MODE_PUBLICTRANSIT;
+ default: break;
}
return MAPS_ROUTE_TRANSPORT_MODE_CAR;
}
GeoRouteQuery::FeatureType HereUtils::Convert(maps_route_feature_e nVal)
{
- switch (nVal)
- {
- case MAPS_ROUTE_FEATURE_NO: return GeoRouteQuery::FT_NoFeature;
- case MAPS_ROUTE_FEATURE_TOLL: return GeoRouteQuery::FT_TollFeature;
- case MAPS_ROUTE_FEATURE_MOTORWAY: return GeoRouteQuery::FT_MotorwayFeature;
- case MAPS_ROUTE_FEATURE_BOATFERRY: return GeoRouteQuery::FT_BoatFerryFeature;
- case MAPS_ROUTE_FEATURE_RAILFERRY: return GeoRouteQuery::FT_RailFerryFeature;
- case MAPS_ROUTE_FEATURE_PUBLICTTRANSIT: return GeoRouteQuery::FT_PublicTransitFeature;
- case MAPS_ROUTE_FEATURE_TUNNEL: return GeoRouteQuery::FT_TunnelFeature;
- case MAPS_ROUTE_FEATURE_DIRTROAD: return GeoRouteQuery::FT_DirtRoadFeature;
- case MAPS_ROUTE_FEATURE_PARKS: return GeoRouteQuery::FT_ParksFeature;
- case MAPS_ROUTE_FEATURE_HOVLANE: return GeoRouteQuery::FT_HOVLane;
- case MAPS_ROUTE_FEATURE_STAIRS: return GeoRouteQuery::FT_Stairs;
- default: break;
+ switch (nVal) {
+ case MAPS_ROUTE_FEATURE_NO: return GeoRouteQuery::FT_NoFeature;
+ case MAPS_ROUTE_FEATURE_TOLL: return GeoRouteQuery::FT_TollFeature;
+ case MAPS_ROUTE_FEATURE_MOTORWAY: return GeoRouteQuery::FT_MotorwayFeature;
+ case MAPS_ROUTE_FEATURE_BOATFERRY: return GeoRouteQuery::FT_BoatFerryFeature;
+ case MAPS_ROUTE_FEATURE_RAILFERRY: return GeoRouteQuery::FT_RailFerryFeature;
+ case MAPS_ROUTE_FEATURE_PUBLICTTRANSIT: return GeoRouteQuery::FT_PublicTransitFeature;
+ case MAPS_ROUTE_FEATURE_TUNNEL: return GeoRouteQuery::FT_TunnelFeature;
+ case MAPS_ROUTE_FEATURE_DIRTROAD: return GeoRouteQuery::FT_DirtRoadFeature;
+ case MAPS_ROUTE_FEATURE_PARKS: return GeoRouteQuery::FT_ParksFeature;
+ case MAPS_ROUTE_FEATURE_HOVLANE: return GeoRouteQuery::FT_HOVLane;
+ case MAPS_ROUTE_FEATURE_STAIRS: return GeoRouteQuery::FT_Stairs;
+ default: break;
}
return GeoRouteQuery::FT_NoFeature;
}
GeoRouteQuery::FeatureWeight HereUtils::Convert(maps_route_feature_weight_e nVal)
{
- switch (nVal)
- {
- case MAPS_ROUTE_FEATURE_WEIGHT_NORMAL: return GeoRouteQuery::FW_NormalFeatureWeight;
- case MAPS_ROUTE_FEATURE_WEIGHT_PREFER: return GeoRouteQuery::FW_PreferFeatureWeight;
- case MAPS_ROUTE_FEATURE_WEIGHT_AVOID: return GeoRouteQuery::FW_AvoidFeatureWeight;
- case MAPS_ROUTE_FEATURE_WEIGHT_SOFTEXCLUDE: return GeoRouteQuery::FW_SoftExcludeFeatureWeight;
- case MAPS_ROUTE_FEATURE_WEIGHT_STRICTEXCLUDE: return GeoRouteQuery::FW_StrictExcludeFeatureWeight;
- default: break;
+ switch (nVal) {
+ case MAPS_ROUTE_FEATURE_WEIGHT_NORMAL: return GeoRouteQuery::FW_NormalFeatureWeight;
+ case MAPS_ROUTE_FEATURE_WEIGHT_PREFER: return GeoRouteQuery::FW_PreferFeatureWeight;
+ case MAPS_ROUTE_FEATURE_WEIGHT_AVOID: return GeoRouteQuery::FW_AvoidFeatureWeight;
+ case MAPS_ROUTE_FEATURE_WEIGHT_SOFTEXCLUDE: return GeoRouteQuery::FW_SoftExcludeFeatureWeight;
+ case MAPS_ROUTE_FEATURE_WEIGHT_STRICTEXCLUDE: return GeoRouteQuery::FW_StrictExcludeFeatureWeight;
+ default: break;
}
return GeoRouteQuery::FW_NormalFeatureWeight;
}
maps_route_turn_type_e HereUtils::Convert(Maneuver::InstructionDirection nVal)
{
- switch (nVal)
- {
- case Maneuver::ID_NoDirection: return MAPS_ROUTE_TURN_TYPE_NONE;
- case Maneuver::ID_DirectionForward: return MAPS_ROUTE_TURN_TYPE_STRAIGHT;
- case Maneuver::ID_DirectionBearRight: return MAPS_ROUTE_TURN_TYPE_BEAR_RIGHT;
- case Maneuver::ID_DirectionLightRight: return MAPS_ROUTE_TURN_TYPE_LIGHT_RIGHT;
- case Maneuver::ID_DirectionRight: return MAPS_ROUTE_TURN_TYPE_RIGHT;
- case Maneuver::ID_DirectionHardRight: return MAPS_ROUTE_TURN_TYPE_HARD_RIGHT;
- case Maneuver::ID_DirectionUTurnRight: return MAPS_ROUTE_TURN_TYPE_UTURN_RIGHT;
- case Maneuver::ID_DirectionUTurnLeft: return MAPS_ROUTE_TURN_TYPE_UTURN_LEFT;
- case Maneuver::ID_DirectionHardLeft: return MAPS_ROUTE_TURN_TYPE_HARD_LEFT;
- case Maneuver::ID_DirectionLeft: return MAPS_ROUTE_TURN_TYPE_LEFT;
- case Maneuver::ID_DirectionLightLeft: return MAPS_ROUTE_TURN_TYPE_LIGHT_LEFT;
- case Maneuver::ID_DirectionBearLeft: return MAPS_ROUTE_TURN_TYPE_BEAR_LEFT;
- default: break;
+ switch (nVal) {
+ case Maneuver::ID_NoDirection: return MAPS_ROUTE_TURN_TYPE_NONE;
+ case Maneuver::ID_DirectionForward: return MAPS_ROUTE_TURN_TYPE_STRAIGHT;
+ case Maneuver::ID_DirectionBearRight: return MAPS_ROUTE_TURN_TYPE_BEAR_RIGHT;
+ case Maneuver::ID_DirectionLightRight: return MAPS_ROUTE_TURN_TYPE_LIGHT_RIGHT;
+ case Maneuver::ID_DirectionRight: return MAPS_ROUTE_TURN_TYPE_RIGHT;
+ case Maneuver::ID_DirectionHardRight: return MAPS_ROUTE_TURN_TYPE_HARD_RIGHT;
+ case Maneuver::ID_DirectionUTurnRight: return MAPS_ROUTE_TURN_TYPE_UTURN_RIGHT;
+ case Maneuver::ID_DirectionUTurnLeft: return MAPS_ROUTE_TURN_TYPE_UTURN_LEFT;
+ case Maneuver::ID_DirectionHardLeft: return MAPS_ROUTE_TURN_TYPE_HARD_LEFT;
+ case Maneuver::ID_DirectionLeft: return MAPS_ROUTE_TURN_TYPE_LEFT;
+ case Maneuver::ID_DirectionLightLeft: return MAPS_ROUTE_TURN_TYPE_LIGHT_LEFT;
+ case Maneuver::ID_DirectionBearLeft: return MAPS_ROUTE_TURN_TYPE_BEAR_LEFT;
+ default: break;
}
return MAPS_ROUTE_TURN_TYPE_NONE;
}
Maneuver::InstructionDirection HereUtils::Convert(maps_route_turn_type_e nVal)
{
- switch (nVal)
- {
- case MAPS_ROUTE_TURN_TYPE_NONE: return Maneuver::ID_NoDirection;
- case MAPS_ROUTE_TURN_TYPE_STRAIGHT: return Maneuver::ID_DirectionForward;
- case MAPS_ROUTE_TURN_TYPE_BEAR_RIGHT: return Maneuver::ID_DirectionBearRight;
- case MAPS_ROUTE_TURN_TYPE_LIGHT_RIGHT: return Maneuver::ID_DirectionLightRight;
- case MAPS_ROUTE_TURN_TYPE_RIGHT: return Maneuver::ID_DirectionRight;
- case MAPS_ROUTE_TURN_TYPE_HARD_RIGHT: return Maneuver::ID_DirectionHardRight;
- case MAPS_ROUTE_TURN_TYPE_UTURN_RIGHT: return Maneuver::ID_DirectionUTurnRight;
- case MAPS_ROUTE_TURN_TYPE_UTURN_LEFT: return Maneuver::ID_DirectionUTurnLeft;
- case MAPS_ROUTE_TURN_TYPE_HARD_LEFT: return Maneuver::ID_DirectionHardLeft;
- case MAPS_ROUTE_TURN_TYPE_LEFT: return Maneuver::ID_DirectionLeft;
- case MAPS_ROUTE_TURN_TYPE_LIGHT_LEFT: return Maneuver::ID_DirectionLightLeft;
- case MAPS_ROUTE_TURN_TYPE_BEAR_LEFT: return Maneuver::ID_DirectionBearLeft;
- default: break;
+ switch (nVal) {
+ case MAPS_ROUTE_TURN_TYPE_NONE: return Maneuver::ID_NoDirection;
+ case MAPS_ROUTE_TURN_TYPE_STRAIGHT: return Maneuver::ID_DirectionForward;
+ case MAPS_ROUTE_TURN_TYPE_BEAR_RIGHT: return Maneuver::ID_DirectionBearRight;
+ case MAPS_ROUTE_TURN_TYPE_LIGHT_RIGHT: return Maneuver::ID_DirectionLightRight;
+ case MAPS_ROUTE_TURN_TYPE_RIGHT: return Maneuver::ID_DirectionRight;
+ case MAPS_ROUTE_TURN_TYPE_HARD_RIGHT: return Maneuver::ID_DirectionHardRight;
+ case MAPS_ROUTE_TURN_TYPE_UTURN_RIGHT: return Maneuver::ID_DirectionUTurnRight;
+ case MAPS_ROUTE_TURN_TYPE_UTURN_LEFT: return Maneuver::ID_DirectionUTurnLeft;
+ case MAPS_ROUTE_TURN_TYPE_HARD_LEFT: return Maneuver::ID_DirectionHardLeft;
+ case MAPS_ROUTE_TURN_TYPE_LEFT: return Maneuver::ID_DirectionLeft;
+ case MAPS_ROUTE_TURN_TYPE_LIGHT_LEFT: return Maneuver::ID_DirectionLightLeft;
+ case MAPS_ROUTE_TURN_TYPE_BEAR_LEFT: return Maneuver::ID_DirectionBearLeft;
+ default: break;
}
return Maneuver::ID_NoDirection;
}
GeoTiledMap::MapType HereUtils::Convert(maps_view_type_e nMapType, bool bBuildings, bool bTraffic, bool bPublicTransit)
{
- switch (nMapType)
- {
- case MAPS_VIEW_TYPE_NORMAL:
- if (bPublicTransit) return GeoTiledMap::MT_Normal_Day_Transit;
- if (bTraffic) return GeoTiledMap::MT_Normal_Traffic_Day;
- return GeoTiledMap::MT_Normal_Day;
- case MAPS_VIEW_TYPE_SATELLITE:
- return GeoTiledMap::MT_Satellite_Day;
- case MAPS_VIEW_TYPE_TERRAIN:
- return GeoTiledMap::MT_Terrain_Day;
- case MAPS_VIEW_TYPE_HYBRID:
- if (bPublicTransit) return GeoTiledMap::MT_Hybrid_Day_Transit;
- if (bTraffic) return GeoTiledMap::MT_Hybrid_Traffic_Day;
- return GeoTiledMap::MT_Hybrid_Day;
- default: break;
+ switch (nMapType) {
+ case MAPS_VIEW_TYPE_NORMAL:
+ if (bPublicTransit) return GeoTiledMap::MT_Normal_Day_Transit;
+ if (bTraffic) return GeoTiledMap::MT_Normal_Traffic_Day;
+ return GeoTiledMap::MT_Normal_Day;
+ case MAPS_VIEW_TYPE_SATELLITE:
+ return GeoTiledMap::MT_Satellite_Day;
+ case MAPS_VIEW_TYPE_TERRAIN:
+ return GeoTiledMap::MT_Terrain_Day;
+ case MAPS_VIEW_TYPE_HYBRID:
+ if (bPublicTransit) return GeoTiledMap::MT_Hybrid_Day_Transit;
+ if (bTraffic) return GeoTiledMap::MT_Hybrid_Traffic_Day;
+ return GeoTiledMap::MT_Hybrid_Day;
+ default: break;
}
return GeoTiledMap::MT_Normal_Day;
}
maps_error_e HereUtils::ConvertHttpCodeToMapsError(int nVal)
{
- switch (nVal)
- {
- case 200:/*Ok*/ return MAPS_ERROR_NONE;
- case 408:/*Request timeout*/
- case 504:/*Gateway timeout*/
- case 598:/*Network reading timeout*/
- case 599:/*Network connection timeout*/ return MAPS_ERROR_CONNECTION_TIME_OUT;
-
- case 404:/*Not found*/
- case 407:/*Proxy auth. required*/
- case 502:/*Bad gateway*/ return MAPS_ERROR_NETWORK_UNREACHABLE;
-
- case 401:/*Unauthorized*/
- case 402:/*Payment required*/ return MAPS_ERROR_KEY_NOT_AVAILABLE;
-
- case 405:/*Method not allowed*/
- case 413:/*Request entity too larget*/
- case 414:/*Request uri too large*/ return MAPS_ERROR_INVALID_OPERATION;
-
- case 403:/*Forbidden*/
- case 500:/*Server internal error*/
- case 501:/*Not implemented*/
- case 503:/*Service unavailable*/ return MAPS_ERROR_SERVICE_NOT_AVAILABLE;
+ switch (nVal) {
+ case 200:/*Ok*/ return MAPS_ERROR_NONE;
+ case 408:/*Request timeout*/
+ case 504:/*Gateway timeout*/
+ case 598:/*Network reading timeout*/
+ case 599:/*Network connection timeout*/ return MAPS_ERROR_CONNECTION_TIME_OUT;
+
+ case 404:/*Not found*/
+ case 407:/*Proxy auth. required*/
+ case 502:/*Bad gateway*/ return MAPS_ERROR_NETWORK_UNREACHABLE;
+
+ case 401:/*Unauthorized*/
+ case 402:/*Payment required*/ return MAPS_ERROR_KEY_NOT_AVAILABLE;
+
+ case 405:/*Method not allowed*/
+ case 413:/*Request entity too larget*/
+ case 414:/*Request uri too large*/ return MAPS_ERROR_INVALID_OPERATION;
+
+ case 403:/*Forbidden*/
+ case 500:/*Server internal error*/
+ case 501:/*Not implemented*/
+ case 503:/*Service unavailable*/ return MAPS_ERROR_SERVICE_NOT_AVAILABLE;
}
if (nVal > 0 && nVal < 100) // curl error code
double coord[4] = { 0.0, };
token = strtok_r((char*)src, ",;", &next);
- while (token && i < 4)
- {
+ while (token && i < 4) {
coord[i++] = atof(token);
token = strtok_r(NULL, ",;", &next);
}
bool HereUtils::IsValid(maps_area_s hArea)
{
- if (hArea.type == MAPS_AREA_RECTANGLE)
- {
+ if (hArea.type == MAPS_AREA_RECTANGLE) {
return (HereUtils::IsValid(hArea.rect.top_left) &&
HereUtils::IsValid(hArea.rect.bottom_right));
- }
- else if(hArea.type == MAPS_AREA_CIRCLE)
- {
+ } else if (hArea.type == MAPS_AREA_CIRCLE) {
return HereUtils::IsValid(hArea.circle.center);
- }
- else
+ } else {
return false;
+ }
}
const double HereUtils::ConvertDistance(const double originValue, maps_distance_unit_e destUnit)
{
}
-here_error_e HereView::Init(maps_view_h hView, maps_plugin_map_view_ready_cb pCbFunc)
+here_error_e HereView::init(maps_view_h view, maps_plugin_map_view_ready_cb callback)
{
- if (!hView)
+ if (!view)
return HERE_ERROR_INVALID_PARAMETER;
- __idler = ecore_idler_add(__idlerCb, (void*)hView);
+ __idler = ecore_idler_add(__idlerCb, (void*)view);
here_error_e error = HERE_ERROR_NONE;
int error2 = MAPS_ERROR_NONE;
do {
- error2 = maps_view_get_viewport(hView, &__img);
+ error2 = maps_view_get_viewport(view, &__img);
if (error2 != MAPS_ERROR_NONE) break;
- error2 = maps_view_get_screen_location(hView, &__x, &__y, &__w, &__h);
+ error2 = maps_view_get_screen_location(view, &__x, &__y, &__w, &__h);
if (error2 != MAPS_ERROR_NONE) break;
- error = __initOpenGL();
+ error = initOpenGL();
if (error != HERE_ERROR_NONE) break;
- error = __initOpenGLSurface(hView);
+ error = initOpenGLSurface(view);
if (error != HERE_ERROR_NONE) break;
- error = __initMap(hView, pCbFunc);
- } while(0);
+ error = initMap(view, callback);
+ } while (0);
if (error == HERE_ERROR_NONE && error2 != MAPS_ERROR_NONE)
error = (here_error_e)ConvertToHereError(error2);
return error;
}
-here_error_e HereView::__initOpenGL()
+here_error_e HereView::initOpenGL()
{
__cfg = evas_gl_config_new();
if (!__cfg) {
return HERE_ERROR_NONE;
}
-here_error_e HereView::__initOpenGLSurface(maps_view_h hView)
+here_error_e HereView::initOpenGLSurface(maps_view_h view)
{
- if (!hView || !__gl || !__cfg || !__img || !__ctx)
+ if (!view || !__gl || !__cfg || !__img || !__ctx)
return HERE_ERROR_INVALID_PARAMETER;
evas_object_image_pixels_get_callback_set(__img, NULL, NULL);
}
evas_object_image_native_surface_set(__img, &ns);
- evas_object_image_pixels_get_callback_set(__img, __pixelGetCb, hView);
+ evas_object_image_pixels_get_callback_set(__img, __pixelGetCb, view);
__isInitialized = true;
return HERE_ERROR_NONE;
}
-here_error_e HereView::__initMap(maps_view_h hView, maps_plugin_map_view_ready_cb pCbFunc)
+here_error_e HereView::initMap(maps_view_h view, maps_plugin_map_view_ready_cb callback)
{
- if (!hView)
+ if (!view)
return HERE_ERROR_INVALID_PARAMETER;
__map = new (std::nothrow) GeoTiledMap();
if (!__map)
return HERE_ERROR_OUT_OF_MEMORY;
- __readyCb = pCbFunc;
+ __readyCb = callback;
- __map->SetReadyMapSignal((GeoTiledMap::ReadyMapSignalFunctor)__readyMapCb, (void *)hView);
+ __map->SetReadyMapSignal((GeoTiledMap::ReadyMapSignalFunctor)__readyMapCb, (void *)view);
__map->SetEvasGlApi(__api);
- __map->SetMapSize(Dimension(__w,__h));
+ __map->SetMapSize(Dimension(__w, __h));
__visualObjects.set(__map, evas_object_evas_get(__img));
return HERE_ERROR_NONE;
}
-here_error_e HereView::Close(maps_view_h hView)
+here_error_e HereView::close(maps_view_h view)
{
- if (!hView)
+ if (!view)
return HERE_ERROR_INVALID_PARAMETER;
__isInitialized = false;
evas_object_image_pixels_dirty_set((Evas_Object*)data, EINA_TRUE);
}
-void HereView::__setMapType(maps_view_h hView)
+void HereView::setMapType(maps_view_h view)
{
- if (!hView)
+ if (!view)
return;
/* When the theme is changed, clear cache */
maps_view_type_e map_type;
- maps_view_get_type(hView, &map_type);
+ maps_view_get_type(view, &map_type);
bool buildings_enabled = false;
- maps_view_get_buildings_enabled(hView, &buildings_enabled);
+ maps_view_get_buildings_enabled(view, &buildings_enabled);
bool traffic_enabled = false;
- maps_view_get_traffic_enabled(hView, &traffic_enabled);
+ maps_view_get_traffic_enabled(view, &traffic_enabled);
bool public_transit_enabled = false;
- maps_view_get_public_transit_enabled(hView, &public_transit_enabled);
+ maps_view_get_public_transit_enabled(view, &public_transit_enabled);
GeoTiledMap::MapType hereMapType = HereUtils::Convert(map_type, buildings_enabled,
traffic_enabled, public_transit_enabled);
}
}
-here_error_e HereView::RenderMap(maps_view_h hView, const maps_coordinates_h mapsCoord, double dZoom, double dAngle)
+here_error_e HereView::renderMap(maps_view_h view, const maps_coordinates_h coord, double zoom, double angle)
{
- if (!hView || !mapsCoord)
+ if (!view || !coord)
return HERE_ERROR_INVALID_PARAMETER;
if (!__isInitialized || !__map || !__api)
return HERE_ERROR_SERVICE_NOT_AVAILABLE;
/* set map type */
- __setMapType(hView);
+ setMapType(view);
/* resize window */
int x, y, w, h;
- maps_view_get_screen_location(hView, &x, &y, &w, &h);
+ maps_view_get_screen_location(view, &x, &y, &w, &h);
__w = MAX(__w, 1);
__h = MAX(__h, 1);
- if (x != __x || y != __y || w != __w || h != __h)
- {
+ if (x != __x || y != __y || w != __w || h != __h) {
__x = x;
__y = y;
__w = w;
__h = h;
__api->glViewport(0, 0, __w, __h);
- __map->SetMapSize(Dimension(__w,__h));
- __initOpenGLSurface(hView);
+ __map->SetMapSize(Dimension(__w, __h));
+ initOpenGLSurface(view);
}
/* callback */
__map->SetUpdateMapSignal(callback);
/* zoom level */
- if (__map->GetZoomLevel() != dZoom)
- {
- __zoom = dZoom;
- __map->SetZoomLevel(dZoom, false);
+ if (__map->GetZoomLevel() != zoom) {
+ __zoom = zoom;
+ __map->SetZoomLevel(zoom, false);
}
/* angle */
- if (__angle != dAngle) {
- __angle = dAngle;
- __map->SetAngle(dAngle);
+ if (__angle != angle) {
+ __angle = angle;
+ __map->SetAngle(angle);
}
/* center */
double lat, lng;
- maps_coordinates_get_latitude(mapsCoord, &lat);
- maps_coordinates_get_longitude(mapsCoord, &lng);
+ maps_coordinates_get_latitude(coord, &lat);
+ maps_coordinates_get_longitude(coord, &lng);
GeoCoordinates geoCoord(lat, lng);
__lat = lat;
return HERE_ERROR_NONE;
}
-here_error_e HereView::RenderMapByArea(maps_view_h hView, const maps_area_h hArea, double dZoom, double dAngle)
-{
- if (!hView || !hArea)
- return HERE_ERROR_INVALID_PARAMETER;
-
- if (!__isInitialized || !__map)
- return HERE_ERROR_SERVICE_NOT_AVAILABLE;
-
- return HERE_ERROR_NONE;
-}
-
-here_error_e HereView::MoveCenter(maps_view_h hView, int delta_x, int delta_y)
+here_error_e HereView::moveCenter(maps_view_h view, int delta_x, int delta_y)
{
- if (!hView)
+ if (!view)
return HERE_ERROR_INVALID_PARAMETER;
if (!__isInitialized || !__map)
return HERE_ERROR_NONE;
}
-here_error_e HereView::GetCenter(maps_view_h hView, maps_coordinates_h *center)
+here_error_e HereView::getCenter(maps_view_h view, maps_coordinates_h *center)
{
- if (!hView || !center)
+ if (!view || !center)
return HERE_ERROR_INVALID_PARAMETER;
if (!__isInitialized || !__map)
return HERE_ERROR_NONE;
}
-here_error_e HereView::SetScalebar(maps_view_h hView, bool enable)
+here_error_e HereView::setScalebarEnabled(maps_view_h view, bool enable)
{
- if (!hView)
+ if (!view)
return HERE_ERROR_INVALID_PARAMETER;
if (!__isInitialized || !__map)
return HERE_ERROR_NONE;
}
-here_error_e HereView::GetScalebar(maps_view_h hView, bool *enabled)
+here_error_e HereView::getScalebarEnabled(maps_view_h view, bool *enabled)
{
- if (!hView || !enabled)
+ if (!view || !enabled)
return HERE_ERROR_INVALID_PARAMETER;
if (!__isInitialized || !__map)
return HERE_ERROR_NONE;
}
-here_error_e HereView::DrawMap(maps_view_h hView, Evas* pCanvas, int x, int y, int nWidth, int nHeight)
-{
- if (!hView || !pCanvas || nWidth <= 0 || nHeight <= 0)
- return HERE_ERROR_INVALID_PARAMETER;
-
- if (!__isInitialized || !__map || !__map->GetRootPixmap() || !__api || __w <= 0 || __h <= 0)
- return HERE_ERROR_SERVICE_NOT_AVAILABLE;
-
- unsigned char* srcimg_data = (unsigned char*)malloc(__w * __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 (__w < w) w = __w;
- if (__h < h) h = __h;
-
- __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 * w + x), w * 4);
- }
- catch(std::exception &e) {
- MAPS_LOGD("Exception caught: %s", e.what());
- }
- g_free(srcimg_data);
-
- return HERE_ERROR_NONE;
-}
-
-here_error_e HereView::ScreenToGeolocation(maps_view_h hView, int x, int y, maps_coordinates_h *mapsCoord)
+here_error_e HereView::convertScreenToGeolocation(maps_view_h view, int x, int y, maps_coordinates_h *coord)
{
- if (!hView || !mapsCoord)
+ if (!view || !coord)
return HERE_ERROR_INVALID_PARAMETER;
if (!__isInitialized || !__map)
return HERE_ERROR_SERVICE_NOT_AVAILABLE;
- Tizen::Maps::Point mapsPoint(x, y);
- GeoCoordinates hereCoord = __map->ScreenPositionToCoordinate(mapsPoint);
- double lat = hereCoord.GetLatitude();
- double lng = hereCoord.GetLongitude();
+ Tizen::Maps::Point point(x, y);
+ GeoCoordinates geoCoord = __map->ScreenPositionToCoordinate(point);
+ double lat = geoCoord.GetLatitude();
+ double lng = geoCoord.GetLongitude();
- int error = maps_coordinates_create(lat, lng, mapsCoord);
+ int error = maps_coordinates_create(lat, lng, coord);
if (error != MAPS_ERROR_NONE)
return (here_error_e)ConvertToHereError(error);
return HERE_ERROR_NONE;
}
-here_error_e HereView::GeolocationToScreen(maps_view_h hView, const maps_coordinates_h mapsCoord, int *x, int *y)
+here_error_e HereView::convertGeolocationToScreen(maps_view_h view, const maps_coordinates_h coord, int *x, int *y)
{
- if (!hView || !x || !y)
+ if (!view || !x || !y)
return HERE_ERROR_INVALID_PARAMETER;
if (!__isInitialized || !__map)
return HERE_ERROR_SERVICE_NOT_AVAILABLE;
double lat, lng;
- maps_coordinates_get_latitude(mapsCoord, &lat);
- maps_coordinates_get_longitude(mapsCoord, &lng);
- GeoCoordinates hereCoord(lat, lng);
- Tizen::Maps::Point mapsPoint = __map->CoordinateToScreenPosition(hereCoord);
+ maps_coordinates_get_latitude(coord, &lat);
+ maps_coordinates_get_longitude(coord, &lng);
+ GeoCoordinates geoCoord(lat, lng);
+ Tizen::Maps::Point point = __map->CoordinateToScreenPosition(geoCoord);
- *x = mapsPoint.x;
- *y = mapsPoint.y;
+ *x = point.x;
+ *y = point.y;
return HERE_ERROR_NONE;
}
-here_error_e HereView::GetMinZoomLevel(maps_view_h hView, int *nMinZoomLevel)
+here_error_e HereView::getMinZoomLevel(maps_view_h view, int *zoom)
{
- if (!hView || !nMinZoomLevel)
+ if (!view || !zoom)
return HERE_ERROR_INVALID_PARAMETER;
if (!__isInitialized || !__map)
return HERE_ERROR_SERVICE_NOT_AVAILABLE;
- *nMinZoomLevel = (int)__map->GetMinimumZoomLevel();
+ *zoom = (int)__map->GetMinimumZoomLevel();
return HERE_ERROR_NONE;
}
-here_error_e HereView::GetMaxZoomLevel(maps_view_h hView, int *nMaxZoomLevel)
+here_error_e HereView::getMaxZoomLevel(maps_view_h view, int *zoom)
{
- if (!hView || !nMaxZoomLevel)
+ if (!view || !zoom)
return HERE_ERROR_INVALID_PARAMETER;
if (!__isInitialized || !__map)
return HERE_ERROR_SERVICE_NOT_AVAILABLE;
- *nMaxZoomLevel = (int)__map->GetMaximumZoomLevel();
+ *zoom = (int)__map->GetMaximumZoomLevel();
return HERE_ERROR_NONE;
}
-here_error_e HereView::OnViewObject(maps_view_h hView, const maps_view_object_h object, maps_view_object_operation_e operation)
+here_error_e HereView::onViewObject(maps_view_h view, const maps_view_object_h object, maps_view_object_operation_e operation)
{
- if (!hView || !object ||
+ if (!view || !object ||
operation < MAPS_VIEW_OBJECT_ADD || operation > MAPS_VIEW_OBJECT_REMOVE)
return HERE_ERROR_INVALID_PARAMETER;
return HERE_ERROR_SERVICE_NOT_AVAILABLE;
if (__map->GetRootPixmap())
- __processViewObject(hView, object, operation);
+ __processViewObject(view, object, operation);
else
__pendingObjects.push_back(std::make_pair(object, operation));
return true;
}
-void HereView::__processViewObject(maps_view_h hView, const maps_view_object_h object, maps_view_object_operation_e operation)
+void HereView::__processViewObject(maps_view_h view, const maps_view_object_h object, maps_view_object_operation_e operation)
{
HereView *hv = NULL;
- int maps_error = maps_view_get_maps_plugin_view_handle(hView, (void**)&hv);
+ int maps_error = maps_view_get_maps_plugin_view_handle(view, (void**)&hv);
if (maps_error != MAPS_ERROR_NONE || !hv) return;
maps_view_object_type_e type;
maps_view_object_type_e type;
maps_view_object_get_type(hObj, &type);
- switch(type)
- {
+ switch(type) {
case MAPS_VIEW_OBJECT_MARKER:
hereObject = new (std::nothrow) GeoMapObjectMarker;
error = __updateMarker(hObj, (GeoMapObjectMarker*)hereObject);
break;
#ifdef TIZEN_3_0_NEXT_MS
case MAPS_VIEW_OBJECT_ROUTE:
- for (int i=0; i < 2; i++)
- {
+ for (int i=0; i < 2; i++) {
hereObject = new (std::nothrow) GeoMapObjectPolyline;
- if (hereObject)
- {
+ if (hereObject) {
__map->AddObject(hereObject);
error = __updateRoute(hObj);
if (error != HERE_ERROR_NONE) break;
}
hereObject = new (std::nothrow) GeoMapObjectMarker;
- if (hereObject)
- {
+ if (hereObject) {
__map->AddObject(hereObject);
error = __updateRoute(hObj);
if (error != HERE_ERROR_NONE) break;
break;
}
- if (error != HERE_ERROR_NONE)
- {
+ if (error != HERE_ERROR_NONE) {
if (hereObject) delete hereObject;
hereObject = NULL;
}
+ if (hereObject
#ifdef TIZEN_3_0_NEXT_MS
- if (hereObject && type != MAPS_VIEW_OBJECT_ROUTE)
-#else
- if (hereObject)
+ && type != MAPS_VIEW_OBJECT_ROUTE
#endif /* TIZEN_3_0_NEXT_MS */
- {
+ ) {
__map->AddObject(hereObject);
pthread_mutex_lock(&__mutex);
__currentObjects.insert(std::make_pair(hObj, hereObject));
VisualObjects::iterator it;
pthread_mutex_lock(&__mutex);
- while ((it = __currentObjects.find(hObj)) != __currentObjects.end())
- {
+ while ((it = __currentObjects.find(hObj)) != __currentObjects.end()) {
__map->RemoveObject((GeoMapObject*)it->second);
it = __currentObjects.erase(it);
error = HERE_ERROR_NONE;
VisualObjects::iterator it;
while ((it = __currentObjects.find(hObj)) != __currentObjects.end())
- {
MAPS_LOGD("TODO: implement moving");
- }
return HERE_ERROR_NONE;
}
maps_view_object_type_e type;
maps_view_object_get_type(hObj, &type);
- switch(type)
- {
+ switch(type) {
case MAPS_VIEW_OBJECT_MARKER:
error = __updateMarker(hObj, (GeoMapObjectMarker*)hereObject);
break;
default:
break;
}
- } while(0);
+ } while (0);
return error;
}
evas_object_image_file_set(img, szPath, NULL);
int err = evas_object_image_load_error_get(img);
- if (err != EVAS_LOAD_ERROR_NONE)
- {
+ if (err != EVAS_LOAD_ERROR_NONE) {
MAPS_LOGE("Failed to load the image file for new marker. '%s'",
(szPath ? szPath : "null"));
g_free(szPath);
/* resize the marker image */
int nw = 0, nh = 0;
- if (__resizeMarker(hMarker, w, h, &nw, &nh, &dst))
- {
+ if (__resizeMarker(hMarker, w, h, &nw, &nh, &dst)) {
w = nw;
h = nh;
nSize = w * h * 4;
maps_coordinates_get_longitude(mapsCoord, &lng);
maps_coordinates_destroy(mapsCoord);
- if (!HereUtils::IsValidCoord(lat, lng))
- {
+ if (!HereUtils::IsValidCoord(lat, lng)) {
error = MAPS_ERROR_INVALID_PARAMETER;
break;
}
int z_order = 0;
maps_view_object_marker_get_z_order(hMarker, &z_order);
hereMarker->SetZorder(z_order);
- } while(0);
+ } while (0);
if (img) evas_object_del(img);
return (here_error_e)ConvertToHereError(error);
error = maps_view_object_polyline_get_width(hPolyline, &nThickness);
if (error != MAPS_ERROR_NONE) break;
herePolyline->SetStrokeThickness(nThickness);
- } while(0);
+ } while (0);
return (here_error_e)ConvertToHereError(error);
}
error = maps_view_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);
+ } while (0);
return (here_error_e)ConvertToHereError(error);
}
VisualObjects::iterator it;
- if ((it = __currentObjects.find(hRoute)) != __currentObjects.end())
- {
+ if ((it = __currentObjects.find(hRoute)) != __currentObjects.end()) {
maps_route_h route = NULL;
int ret = maps_view_object_route_get_content(hRoute, &route);
if (ret != MAPS_ERROR_NONE || !route)
GeoCoordinateList coordList;
GeoMapObjectPolyline *polyline_path = NULL, *polyline_seg = NULL;
- if (it->second->GetType() == GeoMapObject::GMO_Polyline)
- {
- if (!polyline_path)
- {
+ 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)
- {
+ } else if (!polyline_seg) {
MAPS_LOGD("Route Segments");
polyline_seg = (GeoMapObjectPolyline*)it->second;
maps_route_foreach_path(route, __foreachForCoordinates, &coordList);
polyline_seg->SetStrokeColor(Tizen::Maps::Color(0, 255, 0, 255));
polyline_seg->SetStrokeThickness(3);
}
- }
- else if (it->second->GetType() == GeoMapObject::GMO_Marker)
- {
+ } else if (it->second->GetType() == GeoMapObject::GMO_Marker) {
// to implement
}
maps_route_destroy(route);
here_error_e error = HERE_ERROR_NOT_FOUND;
VisualObjects::iterator it;
- for (it = __currentObjects.begin(); it != __currentObjects.end(); it++)
- {
- if (it->first == hObj)
- {
+ for (it = __currentObjects.begin(); it != __currentObjects.end(); it++) {
+ if (it->first == hObj) {
((GeoMapObject*)it->second)->SetVisible(bVisible);
error = HERE_ERROR_NONE;
}
return false;
if (!HereUtils::IsValid(*(maps_coordinates_s*)point))
- {
return false;
- }
int error;
double lat = 0.0, lng = 0.0;
error = maps_coordinates_get_longitude(point, &lng);
if (error != MAPS_ERROR_NONE) break;
- } while(0);
+ } while (0);
MAPS_LOGD("[%d] %f,%f", index+1, lat, lng);
int resizedWidth = 0, resizedHeight = 0;
maps_view_object_marker_get_size(hMarker, &resizedWidth, &resizedHeight);
- if (__resizeBitmap(bitmap, originWidth, originHeight, resizedWidth, resizedHeight))
- {
+ if (__resizeBitmap(bitmap, originWidth, originHeight, resizedWidth, resizedHeight)) {
*newWidth = resizedWidth;
*newHeight = resizedHeight;
return true;
int newPixel, curPixel;
- for(int y = 0; y < newHeight; y++)
- {
- for(int x = 0; x < newWidth; x++)
- {
+ for (int y = 0; y < newHeight; y++) {
+ for (int x = 0; x < newWidth; x++) {
newPixel = (y * (newWidth *4)) + (x * 4);
curPixel = (((int)(y / scaleHeight) * (curWidth * 4)) + ((int)(x / scaleWidth) * 4));