summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorasanoaozora <fifitaneki@hotmail.com>2017-04-25 11:45:07 +0200
committerasanoaozora <fifitaneki@hotmail.com>2017-04-25 11:45:07 +0200
commit70e44b6b5df23d8a8708885f1f4f7ce90cb12fae (patch)
treef6be95ed04545df7fdcea04aa44c146b48bdeade
parentdd7740c3da7400d7e51544a686888441971ba4f0 (diff)
downloadpoi-service-70e44b6b5df23d8a8708885f1f4f7ce90cb12fae.tar.gz
Fix issue in mapviewer and remove obsolete stuff for yocto recipe
-rw-r--r--src/navigation/map-viewer/CMakeLists.txt4
-rw-r--r--src/navigation/map-viewer/mapviewercontrol-plugin/genivi_mapviewer_mapviewercontrol.cxx15
-rw-r--r--src/navigation/navigation-core/CMakeLists.txt4
-rw-r--r--src/navigation/poi-cam/CMakeLists.txt4
-rwxr-xr-xtest/navigation/test-guidance.py21
-rwxr-xr-xtest/navigation/test-map-viewer-control.py20
6 files changed, 35 insertions, 33 deletions
diff --git a/src/navigation/map-viewer/CMakeLists.txt b/src/navigation/map-viewer/CMakeLists.txt
index 1c6611e..1caaf0d 100644
--- a/src/navigation/map-viewer/CMakeLists.txt
+++ b/src/navigation/map-viewer/CMakeLists.txt
@@ -84,10 +84,6 @@ endif()
set(PLUGIN_LDFLAGS ${DBUS_CPP_LDFLAGS} ${DBUS_CPP_GLIB_LDFLAGS} ${GLIB_LDFLAGS})
set(PLUGIN_LIBRARIES ${DBUS_CPP_LIBRARY_DIRS} ${GLIB_LIBRARY_DIRS} ${DBUS_CPP_GLIB_LIBRARY_DIRS})
-if(${YOCTO_CONFIG})
- include_directories(${STAGING_INCDIR}/navit)
-endif()
-
if (WITH_PLUGIN_MIGRATION)
# DBus Path
if(DBUS_LIB_PATH)
diff --git a/src/navigation/map-viewer/mapviewercontrol-plugin/genivi_mapviewer_mapviewercontrol.cxx b/src/navigation/map-viewer/mapviewercontrol-plugin/genivi_mapviewer_mapviewercontrol.cxx
index f85d187..db18c0d 100644
--- a/src/navigation/map-viewer/mapviewercontrol-plugin/genivi_mapviewer_mapviewercontrol.cxx
+++ b/src/navigation/map-viewer/mapviewercontrol-plugin/genivi_mapviewer_mapviewercontrol.cxx
@@ -1065,12 +1065,10 @@ MapViewerControlObj::SetMapViewScale(uint32_t SessionHandle, uint8_t ScaleID)
void
MapViewerControlObj::SetMapViewScaleByDelta(uint32_t SessionHandle, int16_t ScaleDelta)
{
- if (!ScaleDelta)
- throw DBus::ErrorInvalidArgs("ScaleDelta must not be 0");
if (ScaleDelta < 0)
- navit_zoom_out(m_navit.u.navit,1 << (-ScaleDelta),NULL);
+ navit_zoom_in(m_navit.u.navit,1 << (-ScaleDelta),NULL);
else if (ScaleDelta > 0)
- navit_zoom_in(m_navit.u.navit,1 << ScaleDelta,NULL);
+ navit_zoom_out(m_navit.u.navit,1 << ScaleDelta,NULL);
}
void
@@ -1078,10 +1076,13 @@ MapViewerControlObj::GetMapViewScale(uint8_t& ScaleID, DBusCommonAPIEnumeration&
{
struct transformation *trans=navit_get_trans(m_navit.u.navit);
long scale=transform_get_scale(trans);
- if (scale <= 1 || scale >= 2097152)
- IsMinMax=1;
+ if (scale <= 1)
+ IsMinMax=GENIVI_MAPVIEWER_MIN;
else
- IsMinMax=0;
+ if (scale >= 2097152)
+ IsMinMax=GENIVI_MAPVIEWER_MAX;
+ else
+ IsMinMax=GENIVI_MAPVIEWER_MID;
ScaleID=0;
while (scale > 1) {
scale >>=1;
diff --git a/src/navigation/navigation-core/CMakeLists.txt b/src/navigation/navigation-core/CMakeLists.txt
index d842366..35a8fe0 100644
--- a/src/navigation/navigation-core/CMakeLists.txt
+++ b/src/navigation/navigation-core/CMakeLists.txt
@@ -84,10 +84,6 @@ endif()
set(PLUGIN_LDFLAGS ${DBUS_CPP_LDFLAGS} ${DBUS_CPP_GLIB_LDFLAGS} ${GLIB_LDFLAGS})
set(PLUGIN_LIBRARIES ${DBUS_CPP_LIBRARY_DIRS} ${GLIB_LIBRARY_DIRS} ${DBUS_CPP_GLIB_LIBRARY_DIRS})
-if(${YOCTO_CONFIG})
- include_directories(${STAGING_INCDIR}/navit)
-endif()
-
if (WITH_PLUGIN_MIGRATION)
# DBus Path
if(DBUS_LIB_PATH)
diff --git a/src/navigation/poi-cam/CMakeLists.txt b/src/navigation/poi-cam/CMakeLists.txt
index 5a1fd45..3b2b2e5 100644
--- a/src/navigation/poi-cam/CMakeLists.txt
+++ b/src/navigation/poi-cam/CMakeLists.txt
@@ -52,10 +52,6 @@ include_directories(${NAVIGATION_COMMON_DIR})
include_directories(${DBUS_GENERATED_INCLUDE_DIR}/poi-service)
-if(${YOCTO_CONFIG})
- include_directories(${STAGING_INCDIR}/navit)
-endif()
-
set(PLUGIN_LDFLAGS ${DBUS_CPP_LDFLAGS} ${DBUS_CPP_GLIB_LDFLAGS} ${GLIB_LDFLAGS})
set(PLUGIN_LIBRARIES ${DBUS_CPP_LIBRARY_DIRS} ${GLIB_LIBRARY_DIRS} ${DBUS_CPP_GLIB_LIBRARY_DIRS})
diff --git a/test/navigation/test-guidance.py b/test/navigation/test-guidance.py
index 616f36c..be44295 100755
--- a/test/navigation/test-guidance.py
+++ b/test/navigation/test-guidance.py
@@ -39,7 +39,8 @@ import sys
import errno
import time
from dltTrigger import *
-#import pdb;pdb.set_trace()
+#import pdb
+#pdb.set_trace()
from pip import locations
@@ -67,6 +68,7 @@ HORIZONTAL_SIZE = 800
VERTICAL_SIZE = 480
MAIN_MAP = 0x0010
NUMBER_OF_SEGMENTS = 500
+ZOOM_GUIDANCE = 2
#add signal receivers
def routing_routeCalculationProgressUpdate_handler(routeHandle, status, percentage):
@@ -102,7 +104,7 @@ def routing_routeCalculationSuccessful_handler(routeHandle,unfullfilledPreferenc
#ret[1][0][GENIVI_NAVIGATIONCORE_START_LATITUDE] is the start latitude
g_guidance_active = True
# pdb.set_trace()
-# display_route(routeHandle)
+ display_route(routeHandle)
launch_guidance(routeHandle)
def session_sessionDeleted_handler(sessionHandle):
@@ -157,6 +159,8 @@ def exit():
loop.quit()
def display_route(route):
+ ret = g_routing_interface.GetRouteBoundingBox(dbus.UInt32(g_route_handle))
+ g_mapviewercontrol_interface.SetMapViewBoundingBox(dbus.UInt32(g_mapviewer_sessionhandle),dbus.UInt32(g_mapviewer_maphandle),ret)
g_mapviewercontrol_interface.DisplayRoute( \
dbus.UInt32(g_mapviewer_sessionhandle), \
dbus.UInt32(g_mapviewer_maphandle), \
@@ -166,7 +170,16 @@ def display_route(route):
def launch_guidance(route):
g_mapmatchedposition_interface.SetSimulationMode(dbus.UInt32(g_navigationcore_session_handle),dbus.Boolean(True))
g_guidance_interface.StartGuidance(dbus.UInt32(g_navigationcore_session_handle),dbus.UInt32(route))
-# g_mapmatchedposition_interface.StartSimulation(g_navigationcore_session_handle)
+ g_mapviewercontrol_interface.SetFollowCarMode(dbus.UInt32(g_navigationcore_session_handle),dbus.UInt32(g_mapviewer_maphandle),True)
+ g_mapviewercontrol_interface.SetMapViewScale(dbus.UInt32(g_mapviewer_sessionhandle),dbus.UInt32(g_mapviewer_maphandle),ZOOM_GUIDANCE)
+ g_mapviewercontrol_interface.SetTargetPoint(dbus.UInt32(g_mapviewer_sessionhandle),\
+ dbus.UInt32(g_mapviewer_maphandle),\
+ dbus.Struct((\
+ dbus.Double(locations[routes[g_current_route].getElementsByTagName("start")[0].childNodes[0].data][0]),\
+ dbus.Double(locations[routes[g_current_route].getElementsByTagName("start")[0].childNodes[0].data][1]),\
+ dbus.Double(0)\
+ )))
+ g_mapmatchedposition_interface.StartSimulation(g_navigationcore_session_handle)
def launch_route_calculation(route):
global g_current_route
@@ -334,7 +347,7 @@ ret = g_navigationcore_session_handle = g_navigationcore_session_interface.Creat
g_navigationcore_session_handle=ret[1]
print 'Navigation core session handle: ' + str(g_navigationcore_session_handle)
-#createMapView()
+createMapView()
g_current_route = 0
g_guidance_active = False
diff --git a/test/navigation/test-map-viewer-control.py b/test/navigation/test-map-viewer-control.py
index 4029cbd..253b2f4 100755
--- a/test/navigation/test-map-viewer-control.py
+++ b/test/navigation/test-map-viewer-control.py
@@ -45,6 +45,8 @@ test_name = "map viewer"
#constants as defined in the Navigation API
LATITUDE = 0x00a0
LONGITUDE = 0x00a1
+MAPVIEWER_MAX = 0x0041
+MAPVIEWER_MIN = 0x0040
MAIN_MAP = 0x0010
SPLIT_SCREEN = 0x0011
@@ -53,8 +55,6 @@ SPLIT_SCREEN = 0x0011
HORIZONTAL_SIZE = 800
VERTICAL_SIZE = 480
TIME_OUT = 20000
-MIN_SCALE = 0
-MAX_SCALE = 21
# List of coordinates
LATITUDE = list()
@@ -71,21 +71,21 @@ def mapviewer_mapViewScaleChanged_handler(mapViewInstanceHandle,scale,isMinMax):
print("Scale: "+str(new_scale))
print('Is min max: '+str(int(isMinMax)))
time.sleep(0.25)
- if g_scale > new_scale and new_scale !=MIN_SCALE:
+ if g_scale > new_scale and isMinMax !=MAPVIEWER_MIN:
print("Zoom in")
g_scale=new_scale
MapViewerControl_interface.SetMapViewScaleByDelta( \
dbus.UInt32(sessionhandle), \
dbus.UInt32(mapviewerhandle), \
- dbus.Int16(1))
+ dbus.Int16(-1))
else:
- if new_scale < MAX_SCALE:
+ if isMinMax !=MAPVIEWER_MAX:
print("Zoom out")
g_scale=new_scale
MapViewerControl_interface.SetMapViewScaleByDelta( \
dbus.UInt32(sessionhandle), \
dbus.UInt32(mapviewerhandle), \
- dbus.Int16(-1))
+ dbus.Int16(1))
else:
print 'Test PASSED'
MapViewerControl_interface.ReleaseMapViewInstance( \
@@ -209,13 +209,13 @@ alt2 = targetPoint[2]
print 'Get center -> (' + str(lat2) + ',' + str(lon2) + ')'
if round(float(lat1),4) != round(float(lat2),4) :
- print '\nTest Failed:' + str(round(lat1,4)) + '!=' + str(round(lat2,4)) + '\n'
+ print '\nTest Failed:' + str(round(float(lat1),4)) + '!=' + str(round(float(lat2),4)) + '\n'
if round(float(lon1),4) != round(float(lon2),4) :
- print '\nTest Failed:' + str(round(lon1,4)) + '!=' + str(round(lon2,4)) + '\n'
+ print '\nTest Failed:' + str(round(float(lon1),4)) + '!=' + str(round(float(lon2),4)) + '\n'
if round(float(alt1),4) != round(float(alt2),4) :
- print '\nTest Failed:' + str(round(alt1,4)) + '!=' + str(round(alt2,4)) + '\n'
+ print '\nTest Failed:' + str(round(float(alt1),4)) + '!=' + str(round(float(alt2),4)) + '\n'
ret=MapViewerControl_interface.GetMapViewScale(dbus.UInt32(mapviewerhandle))
print('Scale: '+str(int(ret[0])))
@@ -227,7 +227,7 @@ print 'Zoom in'
MapViewerControl_interface.SetMapViewScaleByDelta( \
dbus.UInt32(sessionhandle), \
dbus.UInt32(mapviewerhandle), \
- dbus.Int16(1))
+ dbus.Int16(-1))
#main loop
gobject.timeout_add(TIME_OUT, timeout)