Navit学习笔记(二)

  上一篇《Navit学习笔记(一)》主要简要阐述了Navit的一些特征,怎样下载源代码、怎样在Unbuntu 10.04下进行安装的准备并进行默认安装。因为Navit是模块化设计的,根据安装平台的不同需求对其进行配置。本文的主要目的是讲述Navit的配置问题。

  Navit的设置是通过编辑navit.xml文件实现的。当登入Navit是,程序会加载navit.xml文件设置程序。如果是SVN获取的源代码navit.xml文件在主目录下,如果是安装程序,配置文件在/usr/shared/navit 或者 /etc/navit文件夹下。

  1、用户图形接口

  Navit通过插件形式提供多种用户图形接口。下面简要的介绍一下两种已经成功地嵌入于Navit的GUI。

  Internal GUI:它是当前最新的GUI主要是用于触摸屏设备的,这个GUI现在还在不同的开发完善中。由于本学习笔记针对Navit的核心模块和功能,对于触摸屏设置这部分还请大家参考《Internal GUI》,那里有这部分的具体实现新式和最新进展。

  GTK GUI:在本文中,我们将简要介绍GTK,更详细的介绍请查阅《Custom GTK Tutorial》 GTK是Navit默认的GUI,其一般设置如下:

*  menubar = " 0 "  will disable the menu bar. Useful on devices with small screens
*  toolbar = " 0 "  will disable the tool bar. Useful on devices with small screens
*  statusbar = " 0 "  will disable the status bar. Useful on devices with small screens 

  2、一些可以更改的设置

  加载起始点(起始经纬值)

  GSP 模块可以为 Navit 提供当地的经纬度值,也就是说可以为Navit提供起始位置。但我们也可以手动设置,特别是没有GPS模块时。当地的经纬度信息可以从http://maps.google.com/上获取,也可以从http://itouchmap.com/latlong.html 获取,在navit.xml 文件中设置如下:

< navit gui = " ... "  graphics = " ... "  center = " 3957 N 11618 E "  zoom = " 128 "   >

  注:设置中的经纬度的值是实际经纬度值 x 100,并取整。

  地图设置

  在使用Navit前,要在navit.xml 添加我们的地图。Navit 能够使用多种地图格式。以下是一些能在Navit上使用的地图格式设置向导链接,大家可以根据自己的关注点查看详细信息,本文将以Open Street Maps 地图格式为例阐述Navit的地图设置。

* For a guide on using Open Street aps please go to the Open Street Maps Guide
* For a guide on using European maps please go to the European Maps Guide
* For a guide on using Garmin aps please go to the Garmin Maps Guide
* For information regarding US / Tiger Data aps please go to Tiger Maps Guide
* For other maps  not  included please refer to the Other Maps Guide 

  我们可以从“Navit Planet Extractor”上获取你想要的OSM地图(这里是北京市区的地图)。然后在navit.xml文件添加

< map type = " binfile "  enabled = " yes "  data = " /path/to/beijing.bin "   />

  车辆导航

  这一节设置Navit的GPS数据源,Navit支持三种数据源获取方式:网络、文件和GPS设备。

* source = " file://mynmea.log "  : here, navit will replay the nmea logfile mynmea.log
*  source = " file:/dev/ttyS0 "   -   / dev / ttyS0  for  serial GPS connected to the first serial port
*  source = " file:/dev/rfcomm0 "   -  BlueTooth GPS,  / dev / rfcomm0 must be configured  in   / etc / bluetooth / rfcomm.conf
*  source = " pipe:/usr/bin/gpspipe -r "   -  any executable that produces NMEA output  -  gpsbabel, gpspipe, ... 

  调试

  当Navit程序崩溃时,它能够自动的启动gdb进行调式。但需要对navit.xml进行设置。

< debug name = " segv "  level = " 0 "   />

  如果想要得到更多的关于系统错误的信息

< debug name = osd_core level = " 1 "   />

< debug name = osd_core:osd_nav_next_turn_draw level = " 1 "   />

  其中level的设置值如下:

     *  level = " 0 "  : just let navit crash
    
*  level = " 1 "  : let navit display a backtrace with gdb. This  is  the default setting.
    
*  level = " 2 "  : let navit enter an interactive gdb session 

3、深入学习配置文件

配置文件构造

配置的文件的构造可以通过主目录下的navit.dtd文件查看。查看配置文件,最先出现的是<plugins>节,这一节的说明我们稍候阐述。接下来,我们可以看到Navit的初始化设置。

*gui 默认设置

< navit [options] >

*一辆或者多辆车辆的跟踪(GPS数据)

< vehicle [options]  />

*地图设置,使用一个或者多个地图数据

< mapset >
< map type = " mg "  enabled = " yes "  data = " /opt/reiseplaner/travel/DE.map "   />
< map type = " mg "  enabled = " yes "  data = " /opt/reiseplaner/travel/DE.map/smp2.smp "   />
</ mapset >

*最后添加显示的层数。

 

转载于:https://www.cnblogs.com/Nimeux/archive/2010/09/05/1818582.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值