可以通过RasterMap的getDirection()方法来查询路径,和查询地址类似,路径查询的结果也是通过回调函数的方式来通知应用程序的,下面的例子返回南京到北京的路径。返回结果存放在MapDirection中,MapDirection包含了路径的详细信息,包括路径的每个步骤,长度,时间,方向等
//--------------------------------- PACKAGE ------------------------------------
package com.pstreets.gisengine.demo.rim;
//--------------------------------- IMPORTS ------------------------------------
import com.mapdigit.gis.MapDirection;
import com.mapdigit.gis.geometry.GeoLatLng;
import com.mapdigit.gis.raster.MapType;
import com.mapdigit.gis.service.IRoutingListener;
import com.pstreets.gisengine.demo.MapDemoRIM;
import net.rim.device.api.ui.component.Menu;
import net.rim.device.api.ui.MenuItem;
//[------------------------------ MAIN CLASS ----------------------------------]
/**
* Map routing demo for Guidebee Map API on RIM platform.
* <hr><b>© Copyright 2011 Guidebee, Inc. All Rights Reserved.</b>
* @version 1.00, 10/02/11
* @author Guidebee Pty Ltd.
*/
public class MapRoutingRIM extends MapDemoRIM implements IRoutingListener {
/**
* Entry point for application
* @param args Command line arguments (not used)
*/
public static void main(String[] args)
{
// Create a new instance of the application and make the currently
// running thread the application's event dispatch thread.
MapRoutingRIM theApp = new MapRoutingRIM();
theApp.enterEventDispatcher();
}
private MenuItem mapGetDirectionMenuItem = new MenuItem("Get Direction", 0, 0){
public void run(){
String name1 = "南京";
String name2 = "北京";
map.getDirections("from: " + name1 + " to: " + name2);
}
};
public MapRoutingRIM() {
init();
pushScreen(canvas);
map.setRoutingListener(this);
GeoLatLng center = new GeoLatLng(32.0616667, 118.7777778);
map.setCenter(center, 13, MapType.MICROSOFTCHINA);
}
public void done(String arg0, MapDirection result) {
if (result != null) {
map.setMapDirection(result);
map.resize(result.getBound());
map.setZoom(5);
}
}
protected void createMenu(Menu menu, int instance){
menu.add(mapGetDirectionMenuItem);
}
}
地图服务可以选择使用Google 地图服务,CloudMade地图服务,在中国还可能选择MapAbc地图服务,缺省使用Google 地图服务。
getDirections()具有三个重载函数,例子中是采用的文字描述方式。上述示例采用了from: address1 to: address2 的格式, CloudMade地图服务和MapAbc地图服务则必需采用 经度1,纬度1,经度2,纬度2和格式。
为避免混淆,可以使用下述格式。
public void getDirection(GeoLatLng[] waypoints, IRoutingListener listener);
其中 waypoints 为途径点坐标数组经纬值,可以支持多点路径查询。
此外对于MapAbc 地图服务,还可以指定城市编码,如南京编码为25。
public void getDirection(int citycode,String query, IRoutingListener listener);
Blackberry引路蜂地图开发包Ver2.1下载
分享到:
相关推荐
引路蜂地图开发包2.0 包含了 开发库 JavaDoc 示例代码 详细请参见 http://blog.csdn.net/guidebee/archive/2010/09/19/5895245.aspx
1.解压BaiduInput_blackberry_v1.0.0.7.zip文件,用黑莓桌面管理器加载baiduinput.alx,在安装时务必把默认的四个选项都打上勾。 2.安装完毕后会在出现一个百度记事本和一个百度输入法图标。 3.百度记事本是用在第三...
使用于黑莓手机地图黑莓GPRS地图黑莓GPRS地图黑莓GPRS地图
1.BlackBerry MDS Studio技术综述 [文档说明]BlackBerry ...[文档说明]黑莓BlackBerry考试认证指南 文档名:BlackBerry_Certification_Program_Guide.pdf 文档全部为E文版,如果不感冒的,请不要下载了,浪费分数。
The BlackBerry: not as clumsy or as random as a blaster—an elegant device, for a more civilized age. In this book, Carol and Andrew give you the professional techniques you need to use music, 2D ...
java多商户源码BlackBerry:registered: JDE 示例 BlackBerry:registered: JDE Samples 项目是过去在 BlackBerry:registered: Java:registered: Development Environment 或 BlackBerry:registered: Java:registered:...
黑莓(BlackBerry)开发从入门到精通,一线黑莓应用开发人员经验集萃.· 首本全面介绍黑莓开发的中文技术书籍· 一线黑莓应用开发人员经验集萃· RIM中国区总裁鼎力推荐
在进行Widget 开发之前,开发人员需要下载相应的开发工具,BlackBerry Widget SDK, 这个工 具提供了一些命令行工具可以用来打包编译Widget 工程。BlackBerry 也提供了为Eclipse 设 计的Web plug-in,通过这个plug-in,...
黑莓新注566个域名:98系列杂米近500个.docx
黑莓开发的入门教程,提供了黑莓开发的案例教程,英文原版,有想学习黑莓开发的可以看看
以上代码会自动将BlackBerry MDS Services 作为它的默认连接路径。实际开发中, 如果要确保应用程序使用uses BlackBerry MDS Services 作为它的连接路径,需要在 URL 最后加上参数“deviceside=false”,这也是我们...
RIM (Research in Motion) 公司为BlackBerry 开发提供了多种开发平台,不同平台的开发 人员可以选择自己熟悉的开发工具开发BlackBerry 应用程序。本节以BlackBerry JDE Plug-In for Eclipse 为例描述了BlackBerry ...
Advanced BlackBerry Development 350 pages | Apress (December 10, 2009) | ISBN: 1430226560 | PDF | 5.6 MB BlackBerry devices and applications are selling by the millions. As a BlackBerry developer, ...
谷歌地图黑莓版,很好用的,0S5版本。请大家下载。
Google Sync现在支持blackberry,iPhone、Windows Mobile手机,稍后会支持其他类型的手机,使用Google Sync后,系统会自动同步用户的Gmail联系人、Google Calendar时间到你的手机中,Sync使用Push技术,你在通讯录...
黑莓google地图,手有黑莓,万路通,乐图。
因此,目前开发商可以只 编写一次应用程序,然后在7个主要的移动平台和应用程序商店(app store)里进行发布,这些移动平台和应用程序商店包括:iOS、Android、BlackBerry、webOS、bada、Winodws Phone以及Symbian。...
历史信息 •2009年4月1日在美国、加拿大和英国发布 •2009年7月31日扩展至另外10个国家 •法语、意大利语、德语和西班牙语的本地化支持 ...•支持支付服务(应用内购买)和BlackBerry PlayBook应用提交
本人在学习黑莓过程中遇到了许多问题,网上资源又少。所以总结出来一个详细的入门教程,手把手叫你进入黑莓的世界,希望对大家有帮助。模拟器是9500系列.