文档详情

高德地图实例代码和图片处理.doc

发布:2017-09-05约3.56千字共3页下载文档
文本预览下载声明
高德地图的的一些功能和代码展现 一、地图的放大和缩小: AMap aMap = MapView.getMap(); aMap.moveCamera(CameraUpdateFactory.zoomIn());//放大 aMap.moveCamera(CameraUpdateFactory.zoomOut());//缩小 二、地图的移动 aMap.moveCamera(CameraUpdateFactory.zoomOut());//缩小 aMap.moveCamera(CameraUpdateFactory.scrollBy(100, 0))//右移 aMap.moveCamera(CameraUpdateFactory.scrollBy(0, -100))//上移 aMap.moveCamera(CameraUpdateFactory.scrollBy(-100, 0))//左移 aMap.moveCamera(CameraUpdateFactory.scrollBy(0, 100))//下移 三、地图的模式 aMap.setMapType(AMap.MAP_TYPE_NORMAL);// 矢量地图模式 aMap.setMapType(AMap.MAP_TYPE_SATELLITE);// 卫星地图模式 aMap.setMapType(AMap.MAP_TYPE_NIGHT);//夜景地图模式 四、显示实施交通情况 aMap.setTrafficEnabled(true); 五、在地图上添加覆盖物 1、绘制一个上海、北京、西安三点的虚线三角形 polyline = aMap.addPolyline((new PolylineOptions()) .add(Constants.SHANGHAI, Constants.BEIJING, Constants.CHENGDU) .width(10).setDottedLine(true).geodesic(true) .color(Color.argb(255, 1, 1, 1))); 2、绘制一个乌鲁木齐到哈尔滨的大地曲线 aMap.addPolyline((new PolylineOptions()) .add(new LatLng(43.828, 87.621), new LatLng(45.808, 126.55)) .geodesic(true).color(Color.RED)); 3、在地图上添加一个标记 aMap.addMarker(new MarkerOptions() .position(latlng) .icon(BitmapDescriptorFactory .defaultMarker(BitmapDescriptorFactory.HUE_AZURE)) .perspective(true).draggable(true)); 4、以北京为中心在地图上绘制一个圆形 aMap.addCircle(new CircleOptions().center(Constants.BEIJING) .radius(4000).strokeColor(Color.argb(50, 1, 1, 1)) .fillColor(Color.argb(50, 1, 1, 1)).strokeWidth(25)); 六、地图的定位 aMap.setMyLocationType(AMap.LOCATION_TYPE_LOCATE);定位模式 aMap.setMyLocationType(AMap.LOCATION_TYPE_MAP_FOLLOW);跟随模式 aMap.setMyLocationType(AMap.LOCATION_TYPE_MAP_ROTATE);根据地图面向方向旋转 LocationManagerProxy mAMapLocationManager = LocationManagerProxy.getInstance(this); mAMapLocationManager.requestLocationUpdates( LocationProviderProxy.AMapNetwork, 2000, 10, this); 七、路径规划 AMapNavi mAMapNavi = AMapNavi.getInstance(this); 两点间驾车路线 mAMapNavi.calculateDriveRoute(mStartPoints, mEndPoints, null, AMapNavi.DrivingDefault); 两点间步行路线 mAMapNavi.calculateWalkRoute(mNaviStart, mNaviEnd); webService的功
显示全部
相似文档