import android.content.Context;import android.graphics.Canvas;import android.graphics.Color;import android.graphics.Paint;import android.graphics.Paint.Style;import android.graphics.Path;import android.graphics.Point;import android.os.Bundle;import com.baidu.mapapi.BMapManager;import com.baidu.mapapi.GeoPoint;import com.baidu.mapapi.MapActivity;import com.baidu.mapapi.MapController;import com.baidu.mapapi.MapView;import com.baidu.mapapi.Overlay;import com.baidu.mapapi.Projection;public class BaiduMapActivity extends MapActivity { private Context mContext; private MapView mapView; @Override protected boolean isRouteDisplayed() { // TODO Auto-generated method stub return false; } @Override protected void onCreate(Bundle arg0) { super.onCreate(arg0); setContentView(R.layout.baidumap_layout); BaseApplication baseApp = (BaseApplication) this.getApplication(); if (baseApp.mBMapManage == null) { baseApp.mBMapManage = new BMapManager(mContext); baseApp.mBMapManage.init(baseApp.mStrKey, new BaseApplication.MyGeneralListener()); } baseApp.mBMapManage.start(); super.initMapActivity(baseApp.mBMapManage);// 初始化map sdk mapView = (MapView) findViewById(R.id.bmapView); mapView.setBuiltInZoomControls(true); // 设置在缩放动画过程中也显示overlay,默认为不绘制 mapView.setDrawOverlayWhenZooming(true); // RouteLine routeLine = // (RouteLine)getIntent().getSerializableExtra("routeLine"); //这里画点和连接线 MyOverlay myOverlay = new MyOverlay(); mapView.getOverlays().add(myOverlay); MapController mapController = mapView.getController(); mapController.zoomIn(); mapController.animateTo(new GeoPoint((int) (2259316 * 10), (int) (11396279 * 10)));//设置一个起点 } class MyOverlay extends Overlay { public void draw(Canvas canvas, MapView mapView, boolean shadow) { super.draw(canvas, mapView, shadow); Paint paint = new Paint(); paint.setColor(Color.BLUE); paint.setDither(true); paint.setStyle(Paint.Style.STROKE); paint.setStrokeCap(Paint.Cap.ROUND); paint.setStrokeJoin(Paint.Join.ROUND); paint.setStrokeWidth(5); Projection projection = mapView.getProjection(); Point p1 = new Point(); projection.toPixels(gpoint1 = new GeoPoint((int) (2259316 * 10), (int) (11396279 * 10)), p1); canvas.drawCircle(p1.x, p1.y, projection.metersToEquatorPixels(500), paint); } }}
详细解决方案
android百度舆图半径画圆
热度:84 发布时间:2016-05-01 20:23:17.0
相关解决方案
- android 读取byte[]中的元素解决方案
- android 标题栏兑现方式
- android 中Activity向BroadcastReceiver发送数据,该怎么解决
- Android 4.0 为什么模拟器老是提示小弟我谷歌拼音输入法已停止
- android:getSharedPreferences() 这是哪个类的方法解决思路
- android 怎么判断一个程序是否联网
- android RadioButton如何设置默认选中
- android 怎么重新设置锚点
- android 图片对象获取的有关问题
- android 关于服务连接的疑义
- android 怎么实现对view的放大和缩小
- android ID,该如何处理
- 准备复习2-3个月,看java+android,请问有经验者,怎么看效果最好》
- android UI线程与AsyncTask的有关问题
- android(java) 中文乱码的有关问题
- android 动态设立控件高度
- Android test project 编译方法
- android 4.03启动出错,显示"Encryption Unsuccessful"该如何解决
- Android 下面的listView的动态效果怎么实现的?求源代码,多谢
- Android?Palm?Symbian?Windows Mobile?学哪个有“钱图”?解决方案
- Android 开发语言,该怎么解决
- 单个人去做手机开发选什么平台好?android,iphone?解决办法
- Android 虚拟机崩溃的有关问题
- 想学学移动平台的开发 android 还是windows phone7好啊该怎么处理
- Android 上的如何读写设备文件
- Android 2.2 API 汉语文档系列(3) —— AccessibilityService
- 【先睹为快】ArcGIS Android SDK上一版本新特性
- ArcGIS for Android app v2.0.4公布
- android.hardware.USB种介绍
- android linux开发 在线电子书解决方案