上篇:Android使用百度LBS SDK(实现了百度地图的基本使用,记录轨迹,优化轨迹平滑度,轨迹查看与截图分享。)
今天再总结下测距和测速的使用:
代码:
// 直线距离
double linearDistance = DistanceUtil.getDistance(llStart, llEnd);
// 轨迹距离
double routeDistance = 0.0;
for (int i = 0; i < points.size() - 1; i++) {
routeDistance = routeDistance
+ DistanceUtil.getDistance(points.get(i),
points.get(i + 1));
}
效果图:
代码:
mMapView = (MapView) findViewById(R.id.routeMap);
// 去掉缩放控件和百度Logo
int count = mMapView.getChildCount();
for (int i = 0; i < count; i++) {
View child = mMapView.getChildAt(i);
if (child instanceof ImageView || child instanceof ZoomControls) {
child.setVisibility(View.INVISIBLE);
}
}
先写这么多,后续慢慢补充。
原文地址:http://blog.csdn.net/zhoumushui/article/details/45478079