Osmdroid entry (2.2) MapController

                                    2.2 MapController 

1. Class Overview

The current class exists in the package "org.osmdroid.views", the name "MapController". Main components as follows:

1-4 wherein the symbol identifying the bloggers commonly used method, is the most common one.

2. Object Acquisition and simple operation

 

   private  void  Test(){

      //通过MapView对象进行获取,然后通过指定方法进行对MapView的操作
      IMapController controller= osmv.getController();
      

       //创建起点,北京天安门广场
      GeoPoint fromPoint=new GeoPoint(116.404351,39.909875);

      //创建目标点(成都天府广场)
      GeoPoint aimPoint=new GeoPoint(104.072384,30.663562);

      //设置地图中心点为起点
      controller.setCenter(fromPoint);

      //从北京飞行到成都,缩放等级为12级,飞行时间为2秒,飞的很快,火箭一样。。
      controller.animateTo(aimPoint,12d,2000l);


      //飞行到屏幕点
      controller.zoomToFixing(1, 2, 2, 5000l);
    }

 

Published 16 original articles · won praise 2 · Views 3496

Guess you like

Origin blog.csdn.net/weixin_41012454/article/details/104325752