From e7b08e897712da38c21515977285b731f7546ecf Mon Sep 17 00:00:00 2001 From: chanywa Date: Wed, 3 Aug 2016 18:17:59 +0900 Subject: [PATCH] fixed about path data of routing result Change-Id: If1b3b25d07debbf6e46e2c6af32bff628baf42c9 --- inc/here_api.h | 0 inc/here_multirevgeocode.h | 0 inc/here_route.h | 3 ++ maps-plugin-here.changes | 5 +++ packaging/maps-plugin-here.spec | 4 +- src/here_multirevgeocode.cpp | 0 src/here_route.cpp | 75 ++++++++++++++++++++++----------- src/here_view.cpp | 0 8 files changed, 60 insertions(+), 27 deletions(-) mode change 100755 => 100644 inc/here_api.h mode change 100755 => 100644 inc/here_multirevgeocode.h mode change 100755 => 100644 src/here_multirevgeocode.cpp mode change 100755 => 100644 src/here_view.cpp diff --git a/inc/here_api.h b/inc/here_api.h old mode 100755 new mode 100644 diff --git a/inc/here_multirevgeocode.h b/inc/here_multirevgeocode.h old mode 100755 new mode 100644 diff --git a/inc/here_route.h b/inc/here_route.h index 8c352e1..bea9d71 100644 --- a/inc/here_route.h +++ b/inc/here_route.h @@ -63,10 +63,13 @@ public: private: maps_error_e ProcessSegments(maps_route_h mapsRoute, const RouteSegmentList& hereSegmList); + maps_error_e ProcessSegmentsPath(maps_route_segment_h mapsSegm, const GeoCoordinateList &herePathList); maps_error_e ProcessManeuver(maps_route_segment_h mapsSegm, const ManeuverList& hereManeList); const double __convertDistanceUnit(const double dValue); maps_distance_unit_e m_eDistanceUnit; + maps_coordinates_h m_aOriginCoord; + maps_coordinates_h m_aDestinationCoord; GeoRouteQuery* m_pQuery; }; diff --git a/maps-plugin-here.changes b/maps-plugin-here.changes index 16d4ea6..c60f69a 100644 --- a/maps-plugin-here.changes +++ b/maps-plugin-here.changes @@ -1,3 +1,8 @@ +[Version] maps-plugin-here_0.3.3 +[Date] 03 Aug 2016 +[Title] Fixed some problems related with path data of routing +[Developer] Seechan Kim + [Version] maps-plugin-here_0.3.2 [Date] 07 June 2016 [Title] modified internal APIs for maps-service diff --git a/packaging/maps-plugin-here.spec b/packaging/maps-plugin-here.spec index 442dc7b..12bf472 100644 --- a/packaging/maps-plugin-here.spec +++ b/packaging/maps-plugin-here.spec @@ -1,6 +1,6 @@ Name: maps-plugin-here Summary: Tizen HERE Maps Plug-in Library -Version: 0.3.2 +Version: 0.3.3 Release: 1 Group: Location/Libraries License: Apache-2.0 and HERE @@ -116,7 +116,7 @@ Summary: HereMpas-UC Launcher deamon Requires: %{name} = %{version}-%{release} %description -n heremaps-uc-launcher -This package is for launching the org.tizen.heremaps-uc application. +This package is for launching the org.tizen.heremaps-uc application. %files -n heremaps-uc-launcher %manifest heremaps-uc-launcher/heremaps-uc-launcher.manifest diff --git a/src/here_multirevgeocode.cpp b/src/here_multirevgeocode.cpp old mode 100755 new mode 100644 diff --git a/src/here_route.cpp b/src/here_route.cpp index b3f2228..7b3e2b5 100644 --- a/src/here_route.cpp +++ b/src/here_route.cpp @@ -27,6 +27,8 @@ HereRoute::HereRoute(void *pCbFunc, void *pUserData, int nReqId) m_nReqId = nReqId; m_eDistanceUnit = MAPS_DISTANCE_UNIT_M; + m_aOriginCoord = NULL; + m_aDestinationCoord = NULL; } HereRoute::~HereRoute() @@ -35,6 +37,8 @@ HereRoute::~HereRoute() delete m_pQuery; m_pQuery = NULL; } + maps_coordinates_destroy(m_aOriginCoord); + maps_coordinates_destroy(m_aDestinationCoord); } here_error_e HereRoute::PrepareQuery() @@ -65,6 +69,12 @@ here_error_e HereRoute::PrepareWaypoint(maps_coordinates_h hOrigin, maps_coordin hWaypointList[0] = hOrigin; hWaypointList[1] = hDestination; + maps_coordinates_destroy(m_aOriginCoord); + maps_coordinates_destroy(m_aDestinationCoord); + + maps_coordinates_clone(hOrigin, &m_aOriginCoord); + maps_coordinates_clone(hDestination, &m_aDestinationCoord); + return PrepareWaypoint(hWaypointList, nWaypointNum); } @@ -258,6 +268,9 @@ void HereRoute::OnRouteReply(const GeoRouteReply& Reply) maps_item_list_h mapsPathList; maps_coordinates_h mapsPath; + maps_route_set_origin(mapsRoute, m_aOriginCoord); + maps_route_set_destination(mapsRoute, m_aDestinationCoord); + if (maps_item_list_create(&mapsPathList) == MAPS_ERROR_NONE) { GeoCoordinateList::iterator herePath; for (herePath = herePathList.begin(); herePath != herePathList.end(); herePath++) { @@ -265,13 +278,7 @@ void HereRoute::OnRouteReply(const GeoRouteReply& Reply) double dLng = herePath->GetLongitude(); 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) - maps_route_set_destination(mapsRoute, mapsPath); - else - maps_item_list_append(mapsPathList, mapsPath, maps_coordinates_clone); - + maps_item_list_append(mapsPathList, mapsPath, maps_coordinates_clone); maps_coordinates_destroy(mapsPath); } } @@ -342,24 +349,8 @@ maps_error_e HereRoute::ProcessSegments(maps_route_h mapsRoute, const RouteSegme /* tranvel time */ maps_route_segment_set_duration(mapsSegm, hereSegm->GetTravelTime()); - /* origin, destination */ - GeoCoordinateList herePathList = hereSegm->GetPath(); - int here_path_list_size = herePathList.size(); - - if (here_path_list_size > 0) { - GeoCoordinates hereOrig = herePathList.at(0); - GeoCoordinates hereDest = herePathList.at(here_path_list_size-1); - - maps_coordinates_h mapsOrig, mapsDest; - maps_coordinates_create(hereOrig.GetLatitude(), - hereOrig.GetLongitude(), &mapsOrig); - maps_coordinates_create(hereDest.GetLatitude(), - hereDest.GetLongitude(), &mapsDest); - maps_route_segment_set_origin(mapsSegm, mapsOrig); - maps_route_segment_set_destination(mapsSegm, mapsDest); - maps_coordinates_destroy(mapsOrig); - maps_coordinates_destroy(mapsDest); - } + /* origin, destination and path */ + ProcessSegmentsPath(mapsSegm, hereSegm->GetPath()); /* maneuver */ ProcessManeuver(mapsSegm, hereSegm->GetManeuverList()); @@ -377,6 +368,40 @@ maps_error_e HereRoute::ProcessSegments(maps_route_h mapsRoute, const RouteSegme return MAPS_ERROR_NONE; } +maps_error_e HereRoute::ProcessSegmentsPath(maps_route_segment_h mapsSegm, const GeoCoordinateList &herePathList) +{ + int herePathListSize = herePathList.size(); + GeoCoordinates hereCoord; + maps_coordinates_h mapsCoord; + maps_item_list_h mapsPathList; + maps_error_e error; + + if ((error = (maps_error_e)maps_item_list_create(&mapsPathList)) != MAPS_ERROR_NONE) + return error; + + for (int i = 0; i < herePathListSize; i++) { + hereCoord = herePathList.at(i); + mapsCoord = NULL; + maps_coordinates_create(hereCoord.GetLatitude(), hereCoord.GetLongitude(), &mapsCoord); + if (mapsCoord) { + if (i == 0) + maps_route_segment_set_origin(mapsSegm, mapsCoord); + if (i == herePathListSize - 1) + maps_route_segment_set_destination(mapsSegm, mapsCoord); + maps_item_list_append(mapsPathList, mapsCoord, maps_coordinates_clone); + maps_coordinates_destroy(mapsCoord); + } + } + + if (maps_item_list_items(mapsPathList)) { + maps_route_segment_set_path(mapsSegm, mapsPathList); + maps_item_list_remove_all(mapsPathList, maps_coordinates_destroy); + } + maps_item_list_destroy(mapsPathList); + + return MAPS_ERROR_NONE; +} + maps_error_e HereRoute::ProcessManeuver(maps_route_segment_h mapsSegm, const ManeuverList& hereManeList) { maps_item_list_h mapsManeList; diff --git a/src/here_view.cpp b/src/here_view.cpp old mode 100755 new mode 100644 -- 2.34.1