Commit 3511390615bab0a09eccf43242c0df9a1ba29782
1 parent
05fef780
1 修复轨迹工具无法实时绘制轨迹问题
Showing
3 changed files
with
15 additions
and
14 deletions
config.gradle
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollRunningMapFragmentView.java
| ... | ... | @@ -653,20 +653,18 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener |
| 653 | 653 | fragment.binding.ivGpsState.setBackground(getContext().getResources().getDrawable(R.drawable.rt_training_gps_3)); |
| 654 | 654 | } |
| 655 | 655 | } |
| 656 | - if (followMyLocation == null || followMyLocation.latitude == 0 || followMyLocation.longitude == 0) { | |
| 657 | - return; | |
| 658 | - } | |
| 659 | - MapStatus.Builder builder = new MapStatus.Builder(); | |
| 660 | - mCurrentAccracy = location.getRadius(); | |
| 661 | - followMyLocation = new MyLocationData.Builder() | |
| 662 | - .accuracy(location.getRadius()) | |
| 663 | - // 此处设置开发者获取到的方向信息,顺时针0-360 | |
| 664 | - .direction(mCurrentDirection).latitude(location.getLatitude()) | |
| 665 | - .longitude(location.getLongitude()).build(); | |
| 656 | + | |
| 666 | 657 | //第一次定位 |
| 667 | 658 | if (isFirstLoc) { |
| 668 | 659 | isFirstLoc = false; |
| 660 | + mCurrentAccracy = location.getRadius(); | |
| 661 | + followMyLocation = new MyLocationData.Builder() | |
| 662 | + .accuracy(location.getRadius()) | |
| 663 | + // 此处设置开发者获取到的方向信息,顺时针0-360 | |
| 664 | + .direction(mCurrentDirection).latitude(location.getLatitude()) | |
| 665 | + .longitude(location.getLongitude()).build(); | |
| 669 | 666 | baiduMap.setMyLocationData(followMyLocation); |
| 667 | + MapStatus.Builder builder = new MapStatus.Builder(); | |
| 670 | 668 | builder.target(new LatLng(followMyLocation.latitude, followMyLocation.longitude)).zoom(DEFULT_ZOOM); |
| 671 | 669 | baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build())); |
| 672 | 670 | } else { |
| ... | ... | @@ -675,6 +673,12 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener |
| 675 | 673 | if (location.getRadius() > Constant.LOCA_ACCURACY) { |
| 676 | 674 | return; |
| 677 | 675 | } |
| 676 | + mCurrentAccracy = location.getRadius(); | |
| 677 | + followMyLocation = new MyLocationData.Builder() | |
| 678 | + .accuracy(location.getRadius()) | |
| 679 | + // 此处设置开发者获取到的方向信息,顺时针0-360 | |
| 680 | + .direction(mCurrentDirection).latitude(location.getLatitude()) | |
| 681 | + .longitude(location.getLongitude()).build(); | |
| 678 | 682 | if (null != currentWalkPoints) { |
| 679 | 683 | if (currentWalkPoints.size() > 0) { |
| 680 | 684 | //进行判断 |
| ... | ... | @@ -689,7 +693,6 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener |
| 689 | 693 | currentWalkPoints.add(new LatLng(location.getLatitude(), |
| 690 | 694 | location.getLongitude())); |
| 691 | 695 | } |
| 692 | - | |
| 693 | 696 | //判断当前集合列表是否可以划线(至少两个点) |
| 694 | 697 | if (currentWalkPoints != null && currentWalkPoints.size() > 1) { |
| 695 | 698 | //判断当前是否已经在地图上画点 | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/StartTraceFragmentView.java
| ... | ... | @@ -347,8 +347,6 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { |
| 347 | 347 | option.setCoorType("gcj02"); // 设置坐标类型 |
| 348 | 348 | //可选,默认false,设置是否开启Gps定位 |
| 349 | 349 | option.setOpenGps(true); |
| 350 | - //设置打开自动回调位置模式,该开关打开后,期间只要定位SDK检测到位置变化就会主动回调给开发者,该模式下开发者无需再关心定位间隔是多少,定位SDK本身发现位置变化就会及时回调给开发者 | |
| 351 | - option.setOpenAutoNotifyMode(); | |
| 352 | 350 | //可选,默认高精度,设置定位模式,高精度,低功耗,仅设备 |
| 353 | 351 | option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy); |
| 354 | 352 | //可选,设置是否需要地址信息,默认不需要 | ... | ... |