Skip to content

Commit

Permalink
行驶轨迹记录 让中心点为起始点
Browse files Browse the repository at this point in the history
  • Loading branch information
gaolei committed Mar 5, 2017
1 parent 51938b8 commit 249084f
Showing 1 changed file with 20 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@ public void onCreate(Bundle savedInstanceState) {
}.getType());


total_time.setText("骑行时长:" + time + "分钟");
total_distance.setText("骑行距离:" + distance + "米");
total_price.setText("余额支付:" + price + "元");

List<LatLng> points = new ArrayList<LatLng>();

for (int i = 0; i < routePoints.size(); i++) {
Expand All @@ -89,17 +85,28 @@ public void onCreate(Bundle savedInstanceState) {
routeBaiduMap.addOverlay(ooPolyline);
RoutePoint startPoint = routePoints.get(0);
LatLng startPosition = new LatLng(startPoint.getRouteLat(), startPoint.getRouteLng());

MapStatus.Builder builder = new MapStatus.Builder();
builder.target(startPosition).zoom(18.0f);
routeBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));

RoutePoint endPoint = routePoints.get(routePoints.size() - 1);
LatLng endPosition = new LatLng(endPoint.getRouteLat(), endPoint.getRouteLng());
addOverLayout(startPosition, endPosition);
}

total_time.setText("骑行时长:" + time + "分钟");
total_distance.setText("骑行距离:" + distance + "米");
total_price.setText("余额支付:" + price + "元");


}

private void initMap() {

mlocationClient = new LocationClient(this);
mlistener = new MylocationListener();
mlocationClient.registerLocationListener(mlistener);
// mlistener = new MylocationListener();
// mlocationClient.registerLocationListener(mlistener);

LocationClientOption mOption = new LocationClientOption();
//设置坐标类型
Expand Down Expand Up @@ -128,13 +135,14 @@ public void onReceiveLocation(BDLocation bdLocation) {
//判断是否为第一次定位,是的话需要定位到用户当前位置
if (isFirstIn) {
Log.d("gaolei", "onReceiveLocation----------RouteDetail-----" + bdLocation.getAddrStr());
LatLng currentLL = new LatLng(bdLocation.getLatitude(),
bdLocation.getLongitude());
// startNodeStr = PlanNode.withLocation(currentLL);
MapStatus.Builder builder = new MapStatus.Builder();
builder.target(currentLL).zoom(18.0f);
routeBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
// LatLng currentLL = new LatLng(bdLocation.getLatitude(),
// bdLocation.getLongitude());
//// startNodeStr = PlanNode.withLocation(currentLL);
// MapStatus.Builder builder = new MapStatus.Builder();
// builder.target(currentLL).zoom(18.0f);
// routeBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
isFirstIn = false;

}
}
}
Expand Down

0 comments on commit 249084f

Please sign in to comment.