Blackberry引路蜂地图开发示例:设置地图类型

创建RasterMap实例之后,可以对其进行放大,缩小,平移,设置地图类型等操作。
在第一个地图应用中,在调用RasterMap.setCenter 时可以指定地图类型,另外也可以使用RasterMap.setMapType来更改地图类型,地图开发包中定义了Google 地图,Google 中国地图,Bing 地图,Bing 卫星图等20多种地图类型,也就可设置自已定义地图类型。
在项目RIMGISEngineTutorial创建MapTypeRIM,并添加maptype_menu 菜单。
下面的例子顺序显示Google 中国地图,MapAbc地图,Bing 中国地图。

//--------------------------------- PACKAGE ------------------------------
package com.pstreets.gisengine.demo.rim;
 
//--------------------------------- IMPORTS ------------------------------
import com.mapdigit.gis.geometry.GeoLatLng;
import com.mapdigit.gis.raster.MapType;
import com.pstreets.gisengine.demo.MapDemoRIM;
import net.rim.device.api.ui.component.Menu;
import net.rim.device.api.ui.MenuItem;
 
//[------------------------------ MAIN CLASS ----------------------------]
/**
 *  map type demo for Guidebee Map API on RIM platform.
 * <hr><b>© Copyright 2010 Guidebee, Inc. All Rights Reserved.</b>
 * @version     1.00, 16/09/10
 * @author      Guidebee Pty Ltd.
 */
public class MapTypeRIM extends MapDemoRIM  {
 
    /**
     * 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.
        MapTypeRIM theApp = new MapTypeRIM();      
        theApp.enterEventDispatcher();
    }
    
    private int mapType = 0;
    private static final int[] mapTypes = {MapType.GOOGLECHINA,
        MapType.MAPABCCHINA, MapType.MICROSOFTCHINA};
    private MenuItem mapTypeMenuItem = new MenuItem("MapType",0,1){
        public void run(){
            map.setMapType(mapTypes[mapType]);
            mapType++;
            mapType %= mapTypes.length;
        }
        };
 
    public MapTypeRIM() {
 
        init();
        pushScreen(canvas);
        GeoLatLng center = new GeoLatLng(32.0616667, 118.7777778);
        map.setCenter(center, 13, MapType.GOOGLECHINA);
 
    }
 
     protected void createMenu(Menu menu, int instance){
         menu.add(mapTypeMenuItem);
 
   }
}


Blackberry引路蜂地图开发包Ver2.1下载

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值