feat: 修改自动采集时路径规划,修改文件分割的bug
This commit is contained in:
parent
6cf1c3511f
commit
98829d9e9e
@ -88,11 +88,17 @@ import com.otaliastudios.cameraview.size.AspectRatio;
|
||||
import com.otaliastudios.cameraview.size.SizeSelector;
|
||||
import com.otaliastudios.cameraview.size.SizeSelectors;
|
||||
import com.tencent.map.geolocation.TencentLocation;
|
||||
import com.tencent.map.geolocation.TencentMotion;
|
||||
import com.tencent.map.geolocation.TencentPoi;
|
||||
import com.tencent.map.navi.TencentNaviCallback;
|
||||
import com.tencent.map.navi.TencentNaviManager;
|
||||
import com.tencent.map.navi.TencentRouteSearchCallback;
|
||||
import com.tencent.map.navi.car.TencentCarNaviManager;
|
||||
import com.tencent.map.navi.data.AttachedLocation;
|
||||
import com.tencent.map.navi.data.CalcRouteResult;
|
||||
import com.tencent.map.navi.data.NaviPoi;
|
||||
import com.tencent.map.navi.data.NaviTts;
|
||||
import com.tencent.map.navi.data.ParallelRoadStatus;
|
||||
import com.tencent.map.navi.data.RouteData;
|
||||
import com.tencent.tencentmap.mapsdk.maps.CameraUpdate;
|
||||
import com.tencent.tencentmap.mapsdk.maps.CameraUpdateFactory;
|
||||
@ -213,6 +219,7 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
|
||||
private TencentLocation oldCurrentLocation = null;
|
||||
private MediaPlayer mediaPlayer;
|
||||
private ImageView imgNaviDistance; // 自动规划到距离最近的数据开关
|
||||
private Polyline currentNaviLine; // 当前界面上正显示的导航路径线,重绘路径时需要清除此前已绘制的路径
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
@ -426,6 +433,16 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
imgNaviDistance.setSelected(!imgNaviDistance.isSelected());
|
||||
if (view.isSelected()) {
|
||||
// 开始自动匹配
|
||||
if (roadMatchEntityList.isEmpty()) {
|
||||
navi2NearestPoiEntity();
|
||||
}
|
||||
} else {
|
||||
if (currentNaviLine!=null) {
|
||||
currentNaviLine.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -455,14 +472,14 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
|
||||
}
|
||||
});
|
||||
|
||||
// tencentMap.setOnMapClickListener(new TencentMap.OnMapClickListener() {
|
||||
// @Override
|
||||
// public void onMapClick(LatLng latLng) {
|
||||
// Message msg = handler.obtainMessage(0x105);
|
||||
// msg.obj = obtainTecentLocation(latLng);
|
||||
// handler.sendMessage(msg);
|
||||
// }
|
||||
// });
|
||||
tencentMap.setOnMapClickListener(new TencentMap.OnMapClickListener() {
|
||||
@Override
|
||||
public void onMapClick(LatLng latLng) {
|
||||
Message msg = handler.obtainMessage(0x105);
|
||||
msg.obj = obtainTecentLocation(latLng);
|
||||
handler.sendMessage(msg);
|
||||
}
|
||||
});
|
||||
|
||||
tencentMap.addTencentMapGestureListener(new TencentMapGestureListener() {
|
||||
@Override
|
||||
@ -627,6 +644,10 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
|
||||
roadLinkEntityList.add(roadMatchEntity);
|
||||
}
|
||||
);
|
||||
// 如果当前自动规划打开且没有正在匹配的任务,自动规划下一条最近的任务
|
||||
if (imgNaviDistance.isSelected()&&roadMatchEntityList.isEmpty()) {
|
||||
navi2NearestPoiEntity();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -792,8 +813,6 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
|
||||
// 语音提示用户
|
||||
mediaPlayer.start();
|
||||
systemTTS.playText("拍摄完成");
|
||||
// 此时自动规划距离最近的任务路径
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -829,66 +848,81 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
|
||||
}
|
||||
|
||||
/**
|
||||
* 导航到最近的POIEntity
|
||||
* 导航到最近的道路任务
|
||||
* */
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
private void navi2NearestPoiEntity() {
|
||||
if (removables == null || removables.isEmpty()) {
|
||||
if (roadLinkEntityList == null || roadLinkEntityList.isEmpty()) {
|
||||
SystemTTS.getInstance(this).playText("附近当前没有可匹配的任务");
|
||||
return;
|
||||
}
|
||||
// RxJava处理,子线程中做后台计算路径规划
|
||||
Geometry currentGeometry = GeometryTools.createGeometry(new double[]{Constant.currentLocation.getLongitude(), Constant.currentLocation.getLatitude()});
|
||||
Removable minRemoveable = removables.stream().filter(new Predicate<Removable>() {
|
||||
@Override
|
||||
public boolean test(Removable removable) {
|
||||
if (removable instanceof Marker) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}).min((removable, t1) -> {
|
||||
Marker marker1 = (Marker) removable;
|
||||
Marker marker2 = (Marker) t1;
|
||||
// 判断距离用户当前位置的距离
|
||||
JobSearchBean.BodyBean.ListBean bean1 = (JobSearchBean.BodyBean.ListBean) marker1.getTag();
|
||||
JobSearchBean.BodyBean.ListBean bean2 = (JobSearchBean.BodyBean.ListBean) marker2.getTag();
|
||||
// 转换geo
|
||||
Geometry geometry1 = GeometryTools.createGeometry(Geohash.getInstance().decode(bean1.getGeo()));
|
||||
Geometry geometry2 = GeometryTools.createGeometry(Geohash.getInstance().decode(bean2.getGeo()));
|
||||
if (currentGeometry.distance(geometry1)<currentGeometry.distance(geometry2)) {
|
||||
return 1;
|
||||
} else if (currentGeometry.distance(geometry1)<currentGeometry.distance(geometry2)) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}).get();
|
||||
JobSearchBean.BodyBean.ListBean bean = (JobSearchBean.BodyBean.ListBean)((Marker)minRemoveable).getTag();
|
||||
Coordinate endPoint = GeometryTools.createGeometry(Geohash.getInstance().decode(bean.getGeo())).getCoordinates()[0];
|
||||
ToastUtils.Message(this, "自动导航到"+bean.getName());
|
||||
// 跳转到对应的导航界面
|
||||
try {
|
||||
if (Constant.currentNaviType == null) {
|
||||
NaviUtils.getInstance().selectNaviType(this, new NaviUtils.SelectNaviTypeListener() {
|
||||
Observable.create(
|
||||
new ObservableOnSubscribe<RoadMatchEntity>() {
|
||||
@Override
|
||||
public void subscribe(ObservableEmitter<RoadMatchEntity> emitter) throws Exception {
|
||||
RoadMatchEntity minRoadLink = roadLinkEntityList.stream()
|
||||
// 过滤已经匹配到的数据
|
||||
.filter(roadMatchEntity -> {
|
||||
if (roadMatchEntityList.contains(roadMatchEntity)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.min((t1, t2) -> {
|
||||
// 判断距离用户当前位置的距离
|
||||
JobSearchBean.BodyBean.ListBean bean1 = t1.getDataDetail();
|
||||
JobSearchBean.BodyBean.ListBean bean2 = t2.getDataDetail();
|
||||
// 转换geo
|
||||
Geometry geometry1 = GeometryTools.createGeometry(Geohash.getInstance().decode(bean1.getGeo()));
|
||||
Geometry geometry2 = GeometryTools.createGeometry(Geohash.getInstance().decode(bean2.getGeo()));
|
||||
if (currentGeometry.distance(geometry1)<currentGeometry.distance(geometry2)) {
|
||||
return 1;
|
||||
} else if (currentGeometry.distance(geometry1)<currentGeometry.distance(geometry2)) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}).get();
|
||||
emitter.onNext(minRoadLink);
|
||||
emitter.onComplete();
|
||||
}
|
||||
}
|
||||
)
|
||||
.subscribeOn(Schedulers.computation())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<RoadMatchEntity>() {
|
||||
@Override
|
||||
public void selectNaviType(Constant.NAV_TYPE nav_type) {
|
||||
// 显示导航类型选择的对话框
|
||||
Constant.currentNaviType = nav_type;
|
||||
public void accept(RoadMatchEntity minRoadLink) throws Exception {
|
||||
JobSearchBean.BodyBean.ListBean bean = minRoadLink.getDataDetail();
|
||||
Coordinate endPoint = GeometryTools.createGeometry(Geohash.getInstance().decode(bean.getGeo())).getCoordinates()[0];
|
||||
ToastUtils.Message(AutoTakePictureActivity.this, "已为您规划距离最近的任务路径:"+bean.getName());
|
||||
// 跳转到对应的导航界面
|
||||
try {
|
||||
tencentNaviManager = NaviUtils.getInstance().searchRouteOnly(AutoTakePictureActivity.this, Constant.currentNaviType, new NaviPoi(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()), new NaviPoi(endPoint.getY(), endPoint.getX()), routeSearchCallback);
|
||||
if (Constant.currentNaviType == null) {
|
||||
NaviUtils.getInstance().selectNaviType(AutoTakePictureActivity.this, new NaviUtils.SelectNaviTypeListener() {
|
||||
@Override
|
||||
public void selectNaviType(Constant.NAV_TYPE nav_type) {
|
||||
// 显示导航类型选择的对话框
|
||||
Constant.currentNaviType = nav_type;
|
||||
try {
|
||||
tencentNaviManager = NaviUtils.getInstance().searchRouteOnly(AutoTakePictureActivity.this, Constant.currentNaviType, new NaviPoi(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()), new NaviPoi(endPoint.getY(), endPoint.getX()), routeSearchCallback);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
com.github.lazylibrary.util.ToastUtils.showToast(AutoTakePictureActivity.this, e.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// 已选择导航方式
|
||||
tencentNaviManager = NaviUtils.getInstance().searchRouteOnly(AutoTakePictureActivity.this, Constant.currentNaviType, new NaviPoi(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()), new NaviPoi(endPoint.getY(), endPoint.getX()), routeSearchCallback);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
com.github.lazylibrary.util.ToastUtils.showToast(AutoTakePictureActivity.this, e.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// 已选择导航方式
|
||||
tencentNaviManager = NaviUtils.getInstance().searchRouteOnly(AutoTakePictureActivity.this, Constant.currentNaviType, new NaviPoi(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()), new NaviPoi(endPoint.getY(), endPoint.getX()), routeSearchCallback);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
com.github.lazylibrary.util.ToastUtils.showToast(AutoTakePictureActivity.this, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private TencentNaviManager tencentNaviManager;
|
||||
@ -900,22 +934,11 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
|
||||
|
||||
@Override
|
||||
public void onRouteSearchSuccess(ArrayList<RouteData> arrayList) {
|
||||
NaviUtils.getInstance().addRoutes(arrayList, tencentMap);
|
||||
NaviUtils.getInstance().zoomToRoute(arrayList.get(0), tencentMap);
|
||||
if (tencentNaviManager!=null) {
|
||||
if (Constant.currentNaviType == Constant.NAV_TYPE.CAR) {
|
||||
((TencentCarNaviManager)tencentNaviManager).startNavi(0);
|
||||
} else if (Constant.currentNaviType == Constant.NAV_TYPE.RIDE) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
currentNaviLine = drawNaviLine(arrayList.get(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCalcRouteSuccess(CalcRouteResult calcRouteResult) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -924,6 +947,118 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 绘制导航线路
|
||||
* */
|
||||
private Polyline drawNaviLine(RouteData routeData) {
|
||||
if (currentNaviLine!=null) {
|
||||
currentNaviLine.remove();
|
||||
}
|
||||
Polyline polyline = NaviUtils.getInstance().addRoutes(routeData, tencentMap);
|
||||
NaviUtils.getInstance().zoomToRoute(AutoTakePictureActivity.this, routeData, tencentMap);
|
||||
if (tencentNaviManager!=null) {
|
||||
// if (Constant.currentNaviType == Constant.NAV_TYPE.CAR) {
|
||||
// } else if (Constant.currentNaviType == Constant.NAV_TYPE.RIDE) {
|
||||
//
|
||||
// } else {
|
||||
//
|
||||
// }
|
||||
tencentNaviManager.setNaviCallback(new TencentNaviCallback() {
|
||||
@Override
|
||||
public void onStartNavi() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopNavi() {
|
||||
polyline.remove();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOffRoute() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRecalculateRouteSuccess(int i, ArrayList<RouteData> arrayList) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRecalculateRouteSuccessInFence(int i) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRecalculateRouteFailure(int i, int i1, String s) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRecalculateSuccess(CalcRouteResult calcRouteResult) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRecalculateFailure(CalcRouteResult calcRouteResult) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRecalculateRouteStarted(int i) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRecalculateRouteCanceled() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArrivedDestination() {
|
||||
polyline.remove();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPassedWayPoint(int i) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateRoadType(int i) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateParallelRoadStatus(ParallelRoadStatus parallelRoadStatus) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateAttachedLocation(AttachedLocation attachedLocation) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFollowRouteClick(String s, ArrayList<LatLng> arrayList) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onVoiceBroadcast(NaviTts naviTts) {
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
return polyline;
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除导航的路线
|
||||
* */
|
||||
private void clearNaviLine(Polyline polyline) {
|
||||
polyline.remove();
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化领取任务的管理栈
|
||||
* */
|
||||
@ -1568,204 +1703,204 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
|
||||
// window.setAttributes(lp);
|
||||
}
|
||||
|
||||
// private TencentLocation obtainTecentLocation(LatLng latLng) {
|
||||
// return new TencentLocation() {
|
||||
// @Override
|
||||
// public String getProvider() {
|
||||
// return "NetWork";
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getFusionProvider() {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getSourceProvider() {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public double getLatitude() {
|
||||
// return latLng.getLatitude();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public double getLongitude() {
|
||||
// return latLng.getLongitude();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public double getAltitude() {
|
||||
// return latLng.getAltitude();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public float getAccuracy() {
|
||||
// return 100;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getName() {
|
||||
// return "null";
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getAddress() {
|
||||
// return "null";
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getNation() {
|
||||
// return "null";
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getProvince() {
|
||||
// return "null";
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getCity() {
|
||||
// return "null";
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getDistrict() {
|
||||
// return "null";
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getTown() {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getVillage() {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getStreet() {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getStreetNo() {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Integer getAreaStat() {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<TencentPoi> getPoiList() {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public float getBearing() {
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public float getSpeed() {
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public long getTime() {
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public long getElapsedRealtime() {
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int getGPSRssi() {
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int getInOutStatus() {
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getIndoorBuildingId() {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getIndoorBuildingFloor() {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int getIndoorLocationType() {
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public double getDirection() {
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getCityCode() {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getCityPhoneCode() {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public TencentMotion getMotion() {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int getGpsQuality() {
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public float getDeltaAngle() {
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public float getDeltaSpeed() {
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int getCoordinateType() {
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int getFakeReason() {
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int isMockGps() {
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Bundle getExtra() {
|
||||
// return null;
|
||||
// }
|
||||
// };
|
||||
// }
|
||||
private TencentLocation obtainTecentLocation(LatLng latLng) {
|
||||
return new TencentLocation() {
|
||||
@Override
|
||||
public String getProvider() {
|
||||
return "NetWork";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFusionProvider() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSourceProvider() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getLatitude() {
|
||||
return latLng.getLatitude();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getLongitude() {
|
||||
return latLng.getLongitude();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getAltitude() {
|
||||
return latLng.getAltitude();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getAccuracy() {
|
||||
return 100;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "null";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAddress() {
|
||||
return "null";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNation() {
|
||||
return "null";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProvince() {
|
||||
return "null";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCity() {
|
||||
return "null";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDistrict() {
|
||||
return "null";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTown() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVillage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStreet() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStreetNo() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getAreaStat() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TencentPoi> getPoiList() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBearing() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getSpeed() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTime() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getElapsedRealtime() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGPSRssi() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInOutStatus() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIndoorBuildingId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIndoorBuildingFloor() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIndoorLocationType() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDirection() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCityCode() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCityPhoneCode() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TencentMotion getMotion() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGpsQuality() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDeltaAngle() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDeltaSpeed() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCoordinateType() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFakeReason() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isMockGps() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Bundle getExtra() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private Handler handler = new Handler(new Handler.Callback() {
|
||||
@Override
|
||||
|
@ -44,7 +44,7 @@ object FileSpliteMergeUtils {
|
||||
val begin = offSet
|
||||
// 如果当前index对应的数据没有超过文件大小,则使用cutSize,否则使用文件实际剩余大小
|
||||
var end = begin + cutSize
|
||||
if (totalLength<end) {
|
||||
if (totalLength<=end) {
|
||||
end = totalLength;
|
||||
}
|
||||
val file = createSingleFile(sourceFile,i)
|
||||
@ -88,9 +88,9 @@ object FileSpliteMergeUtils {
|
||||
private fun writeFile(inFile: RandomAccessFile,single: File,begin: Long,end: Long): Long{
|
||||
var endPointer = 0L
|
||||
val out = RandomAccessFile(single,"rw")
|
||||
var index = 0
|
||||
try {
|
||||
val byte = ByteArray(1024)
|
||||
var index = 0
|
||||
inFile.seek(begin)
|
||||
while (inFile.read(byte).also { index = it } != -1 && inFile.filePointer <= end){
|
||||
out.write(byte,0,index)
|
||||
@ -101,7 +101,7 @@ object FileSpliteMergeUtils {
|
||||
}finally {
|
||||
out.close()
|
||||
}
|
||||
return endPointer - 1024//减1024是为了避免分割文件时丢包
|
||||
return endPointer - index // 减去最后一次读取的字节数,因为while循环中会先读取文件,导致filePointer字段向后移动index,但是后面的判断条件导致循环跳出,所以要将下次读取的offset向前移动
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -474,8 +474,8 @@ public class NaviUtils {
|
||||
@Override
|
||||
public void onRouteSearchSuccess(ArrayList<RouteData> arrayList) {
|
||||
// 添加道路Route到地图,默认选取第一条
|
||||
addRoutes(arrayList, tencentMap);
|
||||
zoomToRoute(arrayList.get(0), tencentMap);
|
||||
addRoutes(arrayList.get(0), tencentMap);
|
||||
zoomToRoute(mContext, arrayList.get(0), tencentMap);
|
||||
try {
|
||||
// 自动开始导航
|
||||
if (Constant.currentNaviType == Constant.NAV_TYPE.CAR) {
|
||||
@ -536,8 +536,7 @@ public class NaviUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public void addRoutes(ArrayList<RouteData> mRouteDatas, TencentMap map) {
|
||||
RouteData routeData = mRouteDatas.get(0);
|
||||
public Polyline addRoutes(RouteData routeData, TencentMap map) {
|
||||
ArrayList<TrafficItem> traffics = getTrafficItemsFromList(routeData.getTrafficIndexList());
|
||||
List<LatLng> mRoutePoints = routeData.getRoutePoints();
|
||||
// 点的个数
|
||||
@ -578,9 +577,9 @@ public class NaviUtils {
|
||||
map = tencentMap;
|
||||
}
|
||||
Polyline polyline = map.addPolyline(options);
|
||||
|
||||
return polyline;
|
||||
}
|
||||
public void zoomToRoute(RouteData routeData, TencentMap map) {
|
||||
public void zoomToRoute(Context mContext, RouteData routeData, TencentMap map) {
|
||||
int marginLeft = mContext.getResources().getDimensionPixelSize(R.dimen.navigation_line_margin_left);
|
||||
int marginTop = mContext.getResources().getDimensionPixelSize(R.dimen.navigation_line_margin_top);
|
||||
int marginRight = mContext.getResources().getDimensionPixelSize(R.dimen.navigation_line_margin_right);
|
||||
|
BIN
app/src/main/res/mipmap-xxhdpi/navigation_distance.png
Normal file
BIN
app/src/main/res/mipmap-xxhdpi/navigation_distance.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.7 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/navigation_distance_disable.png
Normal file
BIN
app/src/main/res/mipmap-xxhdpi/navigation_distance_disable.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.8 KiB |
Loading…
x
Reference in New Issue
Block a user