[Taxi driver V2.6.5] 1、taxi 司机屏全路径计算 2、乘客屏路径同步

This commit is contained in:
wangmingjun
2022-03-31 15:05:07 +08:00
parent 27d2a298a4
commit ebdd6cf9b9
19 changed files with 315 additions and 271 deletions

View File

@@ -9,9 +9,5 @@ import java.util.List;
* Created by pangfan on 2021/8/19
*/
public class TaxiPassengerQueryOrderRouteResp extends BaseData {
public Result data;
public static class Result {
public List<LatLng> point;
}
public List<LatLng> data;
}

View File

@@ -39,5 +39,8 @@ class TaxiPassengerConst {
// 订单总里程
const val SP_KEY_ORDER_SUM_DIS = "SP_KEY_ORDER_SUM_DIS"
//实时查询订单剩余时间 和 剩余里程 轮询间隔2s
const val LOOP_CALCULATEROUTE_2S = 2 * 1000L
}
}

View File

@@ -13,7 +13,6 @@ import com.amap.api.navi.model.NaviLatLng;
import com.elegant.network.utils.GsonUtil;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.voice.AIAssist;
import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
@@ -30,7 +29,6 @@ import com.mogo.eagle.core.utilcode.util.NetworkUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.och.taxi.passenger.R;
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrderQueryRemainingResp;
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrderQueryRespBean;
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrdersInServiceQueryRespBean;
@@ -46,7 +44,6 @@ import com.mogo.och.taxi.passenger.constant.TaxiPassengerOrderStatusEnum;
import com.mogo.och.taxi.passenger.network.TaxiPassengerServiceCallback;
import com.mogo.och.taxi.passenger.network.TaxiPassengerServiceManager;
import com.mogo.och.taxi.passenger.utils.TPCoordinateCalculateRouteUtil;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.cloud.socket.IMogoLifecycleListener;
import com.mogo.service.intent.IMogoIntentListener;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
@@ -162,6 +159,7 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
public void release() {
startOrStopOrderLoop(false);
startOrStopQueryOrderRemaining(false);
releaseListeners();
}
@@ -582,6 +580,7 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
@Override
public void onSuccess(TaxiPassengerOrderQueryRemainingResp data) {
if (data != null && data.data!=null){
CallerLogger.INSTANCE.e(M_TAXI_P + TAG,"distance = "+data.data.distance+" ,duration = "+data.data.duration);
for (IOCHTaxiPassengerOrderStatusCallback callback :mOrderStatusCallbackMap.values()){
callback.onCurrentOrderDistToEndChanged(data.data.distance,data.data.duration);
}
@@ -597,13 +596,15 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
public void queryOrderRouteList() {
if (mCurrentOCHOrder == null) return;
CallerLogger.INSTANCE.d(M_TAXI_P + TAG, "--route--- queryOrderRouteList");
TaxiPassengerServiceManager.getInstance().queryOrderRouteList(mContext, mCurrentOCHOrder.orderNo, new TaxiPassengerServiceCallback<TaxiPassengerQueryOrderRouteResp>() {
@Override
public void onSuccess(TaxiPassengerQueryOrderRouteResp data) {
if (data != null && data.data != null && data.data.point != null && data.data.point.size() > 0){
CallerLogger.INSTANCE.d(M_TAXI_P + TAG, "--route---"+GsonUtil.jsonFromObject(data));
if (data != null && data.data != null && data.data != null && data.data.size() > 0){
if (mAutopilotPlanningCallback != null){
calculateRouteLineSum(data.data.point);
mAutopilotPlanningCallback.routeResultByServer(data.data.point);
calculateRouteLineSum(data.data);
mAutopilotPlanningCallback.routeResultByServer(data.data);
}
}
}

View File

@@ -60,7 +60,7 @@ public class TaxiPassengerModelLoopManager {
}
CallerLogger.INSTANCE.i(M_TAXI_P + TAG, "startQueryOrderRemainingtLoop()");
mQueryOrderRemainingDisposable = Observable.interval(TaxiPassengerConst.LOOP_DELAY,
TaxiPassengerConst.LOOP_PERIOD_60S, TimeUnit.MILLISECONDS)
TaxiPassengerConst.LOOP_CALCULATEROUTE_2S, TimeUnit.MILLISECONDS)
.map((aLong -> aLong + 1))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())

View File

@@ -49,8 +49,8 @@ public class TaxiPassengerServiceManager {
* @return
*/
private String getDriverAppSn(){
return CallerTelematicManager.INSTANCE.getServerToken();
// return "X2020211111NG0XNFK";
// return CallerTelematicManager.INSTANCE.getServerToken();
return "X2020210525EFA93B5946FA38D4";
}
/**

View File

@@ -12,6 +12,7 @@ import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.mvp.Presenter;
import com.mogo.commons.voice.AIAssist;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.network.utils.GsonUtil;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
@@ -121,7 +122,7 @@ public class BaseTaxiPassengerPresenter extends Presenter<TaxiPassengerBaseFragm
@Override
public void onCurrentOrderStatusChanged(TaxiPassengerOrderQueryRespBean.Result order) {
CallerLogger.INSTANCE.d(M_TAXI_P + TAG,"order = "+order.toString());
CallerLogger.INSTANCE.d(M_TAXI_P + TAG, GsonUtil.jsonFromObject(order));
if (mCurrentPassengerOrder == null){
mCurrentPassengerOrder = order; //当前无订单
updateOrderView(order);
@@ -155,15 +156,13 @@ public class BaseTaxiPassengerPresenter extends Presenter<TaxiPassengerBaseFragm
}
if (TaxiPassengerOrderStatusEnum.ArriveAtEndStation.getCode() == order.orderStatus){
TaxiPassengerModel.getInstance().recoverNaviInfo();
// runOnUIThread(() ->{
// AIAssist.getInstance(getContext()).speakTTSVoice(getContext().getString(R.string.taxi_p_arrive_end_tts));
// });
TaxiPassengerNaviToDestinationModel.getInstance(getContext()).destroyAmaNavi();
mView.showOrHideServingOrderFragment(false);
mView.showOrHideArrivedEndLayout(true,order.endSiteAddr);
return;
}
if (TaxiPassengerOrderStatusEnum.JourneyCompleted.getCode() == order.orderStatus){
mView.showOrHideServingOrderFragment(false);
mView.showOrHideArrivedEndLayout(false,"");
mCurrentPassengerOrder = null;
return;

View File

@@ -11,6 +11,8 @@ import com.amap.api.maps.model.LatLng;
import com.mogo.commons.mvp.Presenter;
import com.mogo.commons.voice.AIAssist;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.network.utils.GsonUtil;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.och.taxi.passenger.R;
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrderQueryRespBean;
import com.mogo.och.taxi.passenger.callback.IOCHTaxiPassengerAutopilotPlanningCallback;
@@ -28,6 +30,8 @@ import java.util.List;
import mogo.telematics.pad.MessagePad;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI_P;
/**
* @author: wangmingjun
* @date: 2022/3/14
@@ -83,19 +87,27 @@ public class TaxiPassengerServingOrderPresenter extends Presenter<TaxiPassengerS
@Override
public void onCurrentOrderStatusChanged(TaxiPassengerOrderQueryRespBean.Result order) {
CallerLogger.INSTANCE.d(M_TAXI_P + TAG, GsonUtil.jsonFromObject(order));
if (mCurrentPassengerOrder == null){
mCurrentPassengerOrder = order; //当前无订单
mView.updateOrderStatusView(order);
}else if (mCurrentPassengerOrder.orderStatus != order.orderStatus) {
mView.updateOrderStatusView(order);
if (TaxiPassengerOrderStatusEnum.OnTheWayToEndStation.getCode() == order.orderStatus){
TaxiPassengerModel.getInstance().startOrStopQueryOrderRemaining(true);
TaxiPassengerModel.getInstance().queryOrderRouteList();
}
mView.updateOrderStatusView(order);
}else if (mCurrentPassengerOrder.orderStatus != order.orderStatus) {
mView.updateOrderStatusView(order);
CallerLogger.INSTANCE.d(M_TAXI_P + TAG, GsonUtil.jsonFromObject(order));
if (TaxiPassengerOrderStatusEnum.OnTheWayToEndStation.getCode() == order.orderStatus){
TaxiPassengerModel.getInstance().startOrStopQueryOrderRemaining(true);
TaxiPassengerModel.getInstance().queryOrderRouteList();
}
if (TaxiPassengerOrderStatusEnum.Cancel.getCode() == mCurrentPassengerOrder.orderStatus
|| TaxiPassengerOrderStatusEnum.ArriveAtStartStation.getCode() == mCurrentPassengerOrder.orderStatus){
TaxiPassengerModel.getInstance().startOrStopQueryOrderRemaining(false);
// TaxiPassengerModel.getInstance().setmTtsLessThan200Tip(0);
}
mCurrentPassengerOrder = order;
}

View File

@@ -12,6 +12,7 @@ import android.view.View;
import android.view.animation.Animation;
import android.view.animation.RotateAnimation;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
@@ -315,6 +316,7 @@ public class TaxiPassengerServingOrderFragment extends
}
mPresenter.routeResult(list);
// TaxiPassengerModel.getInstance().startOrStopQueryOrderRemaining(true);
return true;
}
});
@@ -465,6 +467,9 @@ public class TaxiPassengerServingOrderFragment extends
if (TaxiPassengerOrderStatusEnum.ArriveAtStartStation.getCode() == order.orderStatus) {
mTPOrderStatus.setText(getString(R.string.taxi_p_arrive_to_start));
mTPOrderRemainDis.setText("--");
mTPOrderRemainTime.setText("--");
mTPOrderRemainArriveTime.setText("--");
setSeekBarMax();
return;
}
@@ -485,14 +490,19 @@ public class TaxiPassengerServingOrderFragment extends
public void onCurrentOrderDistToEndChanged(long meters, long remainTime) {
String disUnit = "公里";
String remainDis = "";
if (meters / 1000 < 1){
disUnit = "";
remainDis = String.valueOf(Math.round(meters));
if (meters == 0f){
remainDis = "0";
}else {
disUnit = "公里";
DecimalFormat fnum = new DecimalFormat("##0.00");
remainDis = fnum.format((float) meters / 1000);
if (meters / 1000 < 1){
disUnit = "";
remainDis = String.valueOf(Math.round(meters));
}else {
disUnit = "公里";
DecimalFormat fnum = new DecimalFormat("##0.00");
remainDis = fnum.format((float) meters / 1000);
}
}
int time = new Long(remainTime).intValue();
Calendar beforeTime = Calendar.getInstance();
beforeTime.add(Calendar.MINUTE,time);

View File

@@ -11,8 +11,6 @@ import java.util.List;
import mogo.telematics.pad.MessagePad;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI;
/**
* @author: wangmingjun
* @date: 2022/3/28

View File

@@ -119,6 +119,7 @@
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
app:layout_constraintRight_toLeftOf="@+id/taxi_p_order_rl2"
app:layout_constraintTop_toTopOf="parent">
@@ -134,7 +135,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:includeFontPadding="false"
android:text="0"
android:text="--"
android:textColor="#84D4FF"
android:textSize="42px"
android:textStyle="bold" />
@@ -171,6 +172,7 @@
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
app:layout_constraintRight_toLeftOf="@+id/taxi_p_order_rl3"
app:layout_constraintTop_toTopOf="parent">
@@ -186,7 +188,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:includeFontPadding="false"
android:text="0"
android:text="--"
android:textColor="#84D4FF"
android:textSize="42px"
android:textStyle="bold" />
@@ -223,6 +225,7 @@
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent">
@@ -232,7 +235,7 @@
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:includeFontPadding="false"
android:text="0"
android:text="--"
android:textColor="#84D4FF"
android:textSize="42px"
android:textStyle="bold" />
@@ -259,6 +262,7 @@
android:layout_height="@dimen/taxi_p_order_map_height"
android:background="@color/taxi_p_map_bg"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/taxi_p_order_remain"
app:layout_constraintLeft_toLeftOf="parent" />
<View

View File

@@ -9,9 +9,5 @@ import java.util.List;
* Created by pangfan on 2021/8/19
*/
public class QueryOrderRouteResp extends BaseData {
public Result data;
public static class Result {
public List<LatLng> point;
}
public List<LatLng> data;
}

View File

@@ -6,6 +6,6 @@ package com.mogo.och.taxi.callback;
*/
public interface IOCHTaxiNaviChangedCallback {
// 当前位置距离上车点的距离(米)、预估时间(秒)
void onCurrentNaviDistAndTimeChanged(int meters, int timeInSecond);
void onCurrentNaviDistAndTimeChanged(int meters, long timeInSecond);
void reInitNaviAmap(boolean isPlay,boolean isRestart);
}

View File

@@ -59,7 +59,7 @@ class OCHTaxiConst {
const val EVENT_PARAM_ORDER_NUMBER = "order_num"
const val EVENT_PARAM_START_RESULT = "start_autopilot" // true/false
// 轮询查询进行中/待服务订单的间隔时间 2秒
// 实时计算当前剩余里程和时间 间隔 2秒
const val LOOP_CALCULATEROUTE_2S = 2 * 1000L
//总里程/平均车速。bus的平均里程25km/htaxi的平均里程38km/h单位为分钟不足1分钟时显示1分钟。

View File

@@ -1107,28 +1107,38 @@ public class MogoOCHTaxiModelNew {
if (mCurrentOCHOrder != null && mRoutePoints.size() == 0){//根据orderNo去查询
queryOrderRouteList(mCurrentOCHOrder.orderNo);
}
if (mRoutePoints.size() == 0) return;
//开启实时计算剩余距离,剩余时间,预计时间
startOrStopCalculateRouteInfo(true);
}
/**
* 实时计算当前剩余里程和时间
*/
public void dynamicCalculateRouteInfo(){
// Logger.d(M_TAXI + "dynamicCalculateRouteInfo", "----- startcCalculate ----- ");
List<LatLng> lastPoints = CoordinateCalculateRouteUtil.getRemainPointListByCompare(mRoutePoints,mLongitude,mLatitude);
List<LatLng> lastPoints = CoordinateCalculateRouteUtil
.getRemainPointListByCompare(mRoutePoints,mLongitude,mLatitude);
double lastSumLength = CoordinateCalculateRouteUtil.calculateRouteSumLength(lastPoints);
double lastTime = lastSumLength / OCHTaxiConst.TAXI_AVERAGE_SPEED * 0.06 ; //分钟
Logger.d(M_TAXI + "dynamicCalculateRouteInfo", "---lastSumLength: "+lastSumLength+"----lastTime : "+lastTime);
float lastSumLength = 0f;
if (lastPoints.size() == 1){
lastSumLength = CoordinateUtils.calculateLineDistance(
lastPoints.get(0).longitude, lastPoints.get(0).latitude,
mLongitude, mLatitude);
}else {
lastSumLength = CoordinateCalculateRouteUtil.calculateRouteSumLength(lastPoints);
}
double lastTime = lastSumLength / OCHTaxiConst.TAXI_AVERAGE_SPEED * 3.6 ; //秒
Logger.d(M_TAXI + "dynamicCalculateRouteInfo"
, "---lastSumLength: "+lastSumLength+"----lastTime : "+lastTime);
mCurrentOCHOrder.decreaseTravelDistance(lastSumLength);
if (mOrderStatusCallback != null) {
mOrderStatusCallback.onCurrentOrderDistToEndChanged((long) lastSumLength, (long)Math.ceil(lastTime));
mOrderStatusCallback.onCurrentOrderDistToEndChanged((long) lastSumLength, (long) lastTime);
}
reportOrderRemain((long)lastSumLength,(long)Math.ceil(lastTime));
reportOrderRemain((long)lastSumLength,(long)lastTime);
}
/**
@@ -1136,12 +1146,13 @@ public class MogoOCHTaxiModelNew {
*/
private void queryOrderRouteList(String orderNo) {
if (mCurrentOCHOrder != null){
OCHTaxiServiceManagerNew.getInstance().queryOrderRoute(mContext, orderNo, new OCHTaxiServiceCallback<QueryOrderRouteResp>() {
OCHTaxiServiceManagerNew.getInstance().queryOrderRoute(mContext, orderNo,
new OCHTaxiServiceCallback<QueryOrderRouteResp>() {
@Override
public void onSuccess(QueryOrderRouteResp data) {
if (data != null && data.data != null && data.data.point != null){
if (data != null && data.data != null){
mRoutePoints.clear();
mRoutePoints.addAll(data.data.point);
mRoutePoints.addAll(data.data);
}
}
@@ -1174,7 +1185,8 @@ public class MogoOCHTaxiModelNew {
*/
private void reportOrderRemain(long lastSumLength, long duration) {// 米/分钟
if (mCurrentOCHOrder == null) return;
OCHTaxiServiceManagerNew.getInstance().reportOrderRemain(mContext, mCurrentOCHOrder.orderNo, lastSumLength, duration, new OCHTaxiServiceCallback<BaseData>() {
OCHTaxiServiceManagerNew.getInstance().reportOrderRemain(mContext, mCurrentOCHOrder.orderNo
, lastSumLength, duration, new OCHTaxiServiceCallback<BaseData>() {
@Override
public void onSuccess(BaseData data) {

View File

@@ -58,6 +58,7 @@ public class OCHTaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implem
private String mOrderNo;
private double mOrderStartStationLat = 0;
private double mOrderStartStationLng = 0;
private volatile int mTtsLessThan200Tip = 0;//离终点200米提示播报
public static OCHTaxiBeingServerdOrdersFragment newInstance(Activity activity, OCHTaxiFragment taxiFragment) {
mActivity = activity;
@@ -304,40 +305,48 @@ public class OCHTaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implem
// CallerLogger.INSTANCE.d(M_TAXI + TAG,"meters = "+meters);
String dis = "0";
String disUnit = "公里";
if (meters / 1000 < 1){
disUnit = "";
dis = String.valueOf(Math.round(meters));
}else {
disUnit = "公里";
DecimalFormat fnum = new DecimalFormat("##0.00");
dis = fnum.format((float) meters / 1000);
if (meters > 0){
if (meters / 1000 < 1){
disUnit = "";
dis = String.valueOf(Math.round(meters));
}else {
disUnit = "公里";
DecimalFormat fnum = new DecimalFormat("##0.00");
dis = fnum.format((float) meters / 1000);
}
}
String strHtml2 = "<font color=\"#CAD6FF\">里程 </font>" + "<b><font color=\"#FFFFFF\">" + dis + "</font></b>" + "<font color=\"#CAD6FF\"> "+disUnit+"</font>"
+ "<font color=\"#CAD6FF\">,剩余 </font>" + "<b><font color=\"#FFFFFF\">" + Math.ceil(timeInSecond/ 60) + "</font></b>" + "<font color=\"#CAD6FF\"> 分钟</font>";
if (mContentModule3 != null && mContentModule3.getVisibility() == View.VISIBLE) { //前往上车点
String strHtml2 = "<font color=\"#CAD6FF\">里程 </font>" + "<b><font color=\"#FFFFFF\">" + dis + "</font></b>" + "<font color=\"#CAD6FF\"> "+disUnit+"</font>"
+ "<font color=\"#CAD6FF\">,剩余 </font>" + "<b><font color=\"#FFFFFF\">" + Math.ceil(timeInSecond / 60) + "</font></b>" + "<font color=\"#CAD6FF\"> 分钟</font>";
mDistanceAndTime3.setText(Html.fromHtml(strHtml2));
mNaviIcon.setVisibility(View.VISIBLE);
} else if (mContentModule2 != null && mContentModule2.getVisibility() == View.VISIBLE) { //前往终点
if (meters <= 200){
} else if (mContentModule2 != null && mContentModule2.getVisibility() == View.VISIBLE) { //前往终点 时间单位是分钟
if (mTtsLessThan200Tip < 1 && meters <= 250 && meters > 150){
speekVoice200mTipsOnce();
}
String strHtml2 = "<font color=\"#CAD6FF\">里程 </font>" + "<b><font color=\"#FFFFFF\">" + dis + "</font></b>" + "<font color=\"#CAD6FF\"> "+disUnit+"</font>"
+ "<font color=\"#CAD6FF\">,剩余 </font>" + "<b><font color=\"#FFFFFF\">" + timeInSecond + "</font></b>" + "<font color=\"#CAD6FF\"> 分钟</font>";
// String strHtml2 = "<font color=\"#CAD6FF\">里程 </font>" + "<b><font color=\"#FFFFFF\">" + dis + "</font></b>" + "<font color=\"#CAD6FF\"> "+disUnit+"</font>"
// + "<font color=\"#CAD6FF\">,剩余 </font>" + "<b><font color=\"#FFFFFF\">" + Math.ceil(timeInSecond / 60) + "</font></b>" + "<font color=\"#CAD6FF\"> 分钟</font>";
mDistanceAndTime2.setText(Html.fromHtml(strHtml2));
}
}
private void speekVoice200mTipsOnce() {
mTtsLessThan200Tip = 1;
showNotice(getResources().getString(R.string.module_och_taxi_order_arrive_end_200m_tip));
}
public void onCurrentOrderRouteInfoGot(OrderQueryRouteInfoRespBean.Result routeInfo) {
public void onCurrentOrderRouteInfoGot(OrderQueryRouteInfoRespBean.Result routeInfo) {// 单位 米, 秒
CallerLogger.INSTANCE.d(M_TAXI + TAG, "meters = " + routeInfo.durationToEnd);
DecimalFormat fnum = new DecimalFormat("##0.00");
String dis = fnum.format((float) routeInfo.distanceToEnd / 1000);
String dis = "0";
if (routeInfo.distanceToEnd > 0){
DecimalFormat fnum = new DecimalFormat("##0.00");
dis = fnum.format((float) routeInfo.distanceToEnd / 1000);
}
String strHtml2 = "<font color=\"#CAD6FF\">距离 </font>" + "<b><font color=\"#FFFFFF\">" + dis + "</font></b>" + "<font color=\"#CAD6FF\"> 公里</font>"
+ "<font color=\"#CAD6FF\">,用时 </font>" + "<b><font color=\"#FFFFFF\">" + Math.ceil(routeInfo.durationToEnd / 60) + "</font></b>" + "<font color=\"#CAD6FF\"> 分钟</font>";
if (mContentModule2 != null && mContentModule2.getVisibility() == View.VISIBLE) {
@@ -380,12 +389,14 @@ public class OCHTaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implem
case OnTheWayToStartStation:
mOrderCancel.setVisibility(View.VISIBLE);
showNotice(mActivity.getString(R.string.module_och_taxi_new_order));
mTtsLessThan200Tip = 0;
startNaviToStartStation(false, mOrderStartStationLat, mOrderStartStationLng);
showOrHideNavi(true);
setOrRemoveMapMaker(true, OCHTaxiConst.TAXI_START_MAP_MAKER,order.startSitePoint);
setOrRemoveMapMaker(true,OCHTaxiConst.TAXI_END_MAP_MAKER,order.endSitePoint);
break;
case Cancel:
mTtsLessThan200Tip = 0;
mOrderCancel.setVisibility(View.VISIBLE);
showNotice(mActivity.getString(R.string.module_och_taxi_order_cancel));
showOrHideNavi(false);
@@ -393,6 +404,7 @@ public class OCHTaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implem
setOrRemoveMapMaker(false,OCHTaxiConst.TAXI_END_MAP_MAKER,order.endSitePoint);
break;
case ArriveAtStartStation:
mTtsLessThan200Tip = 0;
mOrderCancel.setVisibility(View.VISIBLE);
showNotice(mActivity.getString(R.string.module_och_taxi_order_status_ph_text));
showOrHideNavi(false);
@@ -407,6 +419,7 @@ public class OCHTaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implem
setOrRemoveMapMaker(true,OCHTaxiConst.TAXI_END_MAP_MAKER,order.endSitePoint);
break;
case ArriveAtEndStation:
mTtsLessThan200Tip = 0;
mOrderCancel.setVisibility(View.GONE);
showNotice(mActivity.getString(R.string.module_och_taxi_order_auto_arrive_end_tip));
showOrHideNavi(false);
@@ -414,6 +427,7 @@ public class OCHTaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implem
setOrRemoveMapMaker(false,OCHTaxiConst.TAXI_END_MAP_MAKER,order.endSitePoint);
break;
case JourneyCompleted:
mTtsLessThan200Tip = 0;
mOrderCancel.setVisibility(View.GONE);
showNotice("感谢您使用蘑菇智行,再见~");
showOrHideNavi(false);
@@ -499,7 +513,7 @@ public class OCHTaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implem
}
@Override
public void onCurrentNaviDistAndTimeChanged(int meters, int timeInSecond) {
public void onCurrentNaviDistAndTimeChanged(int meters, long timeInSecond) {
updateDistanceAndTime(meters, timeInSecond);
}

View File

@@ -357,204 +357,205 @@ public class OCHTaxiFragment extends BaseOchTaxiTabFragment<OCHTaxiFragment, OCH
findViewById(R.id.test_bar_on_the_way_to_end).setOnClickListener(v -> {
showNotice("自动驾驶已启动,请系好安全带");
MogoOCHTaxiModelNew.getInstance().setOnTheWayToEndStation();
testRouteInfoUpload();
});
findViewById(R.id.test_bar_send_route).setOnClickListener(v -> {
}
String listStr = "{\"models\":[{\n" +
"\t\t\"lat\": 40.19927810144466,\n" +
"\t\t\"lon\": 116.73527259387767\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19927836356079,\n" +
"\t\t\"lon\": 116.73513114732762\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19927759500293,\n" +
"\t\t\"lon\": 116.73497660879111\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.199264819842284,\n" +
"\t\t\"lon\": 116.73480063747202\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.1992510141554,\n" +
"\t\t\"lon\": 116.73463922037767\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.199245872804,\n" +
"\t\t\"lon\": 116.73445960685193\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19924673374912,\n" +
"\t\t\"lon\": 116.73427704009703\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19924747108264,\n" +
"\t\t\"lon\": 116.7340707102972\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19924828745573,\n" +
"\t\t\"lon\": 116.73385916927226\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19924941093133,\n" +
"\t\t\"lon\": 116.73364048294795\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19924939253381,\n" +
"\t\t\"lon\": 116.73340837408566\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19924949105934,\n" +
"\t\t\"lon\": 116.73317368725336\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19925040039033,\n" +
"\t\t\"lon\": 116.73296532811216\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.1992515355653,\n" +
"\t\t\"lon\": 116.73277787366743\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.1992512720328,\n" +
"\t\t\"lon\": 116.73263377253741\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.199205174954606,\n" +
"\t\t\"lon\": 116.73249773114644\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.1991015743076,\n" +
"\t\t\"lon\": 116.7324219601283\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.198971862686285,\n" +
"\t\t\"lon\": 116.73239393296355\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19883883071582,\n" +
"\t\t\"lon\": 116.73237676435652\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19870171355796,\n" +
"\t\t\"lon\": 116.73236052150362\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.1985491853193,\n" +
"\t\t\"lon\": 116.73234157857011\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.1983890047355,\n" +
"\t\t\"lon\": 116.73232167996464\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.1982209877466,\n" +
"\t\t\"lon\": 116.73230101645792\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.198037574138326,\n" +
"\t\t\"lon\": 116.73227735486083\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19787327856243,\n" +
"\t\t\"lon\": 116.73225676816314\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19771917207499,\n" +
"\t\t\"lon\": 116.73223814728027\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.197548305175935,\n" +
"\t\t\"lon\": 116.73221624705808\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19739568979691,\n" +
"\t\t\"lon\": 116.73219618210774\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19724703821575,\n" +
"\t\t\"lon\": 116.73217598293311\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.1970956560885,\n" +
"\t\t\"lon\": 116.73215773721505\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19697703483188,\n" +
"\t\t\"lon\": 116.73214337172284\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19687000725696,\n" +
"\t\t\"lon\": 116.73210037067965\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.196833449601726,\n" +
"\t\t\"lon\": 116.73196646708011\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19685833847804,\n" +
"\t\t\"lon\": 116.73181315361103\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.196889170203264,\n" +
"\t\t\"lon\": 116.73164355747393\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19692242860347,\n" +
"\t\t\"lon\": 116.7314555399657\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19696431701069,\n" +
"\t\t\"lon\": 116.7312261834129\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19700025925464,\n" +
"\t\t\"lon\": 116.73102774016093\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19703414798773,\n" +
"\t\t\"lon\": 116.73084270562073\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19707287604138,\n" +
"\t\t\"lon\": 116.73062835248406\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19710951629977,\n" +
"\t\t\"lon\": 116.73041744082339\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19714593807105,\n" +
"\t\t\"lon\": 116.73021414314803\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.197183297026285,\n" +
"\t\t\"lon\": 116.7300057066447\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.1972247359487,\n" +
"\t\t\"lon\": 116.7297751515664\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19726518822745,\n" +
"\t\t\"lon\": 116.72954958923812\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19730538240706,\n" +
"\t\t\"lon\": 116.72932440756041\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19734272112662,\n" +
"\t\t\"lon\": 116.72911631453036\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.197379191549075,\n" +
"\t\t\"lon\": 116.72890982812105\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.197417565369314,\n" +
"\t\t\"lon\": 116.72869447869044\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19746052080799,\n" +
"\t\t\"lon\": 116.72845641541247\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19750040582118,\n" +
"\t\t\"lon\": 116.72823569991117\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19753999704064,\n" +
"\t\t\"lon\": 116.72801998373052\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19757796882569,\n" +
"\t\t\"lon\": 116.72781280504363\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.197617062364586,\n" +
"\t\t\"lon\": 116.72759949431683\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19765391602761,\n" +
"\t\t\"lon\": 116.72739776789756\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19768973009218,\n" +
"\t\t\"lon\": 116.72719980764646\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.197726191028785,\n" +
"\t\t\"lon\": 116.72699719861669\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19776233489642,\n" +
"\t\t\"lon\": 116.72679516155276\n" +
"\t}]}\n";
private void testRouteInfoUpload() {
String listStr = "{\"models\":[{\n" +
"\t\t\"lat\": 40.19927810144466,\n" +
"\t\t\"lon\": 116.73527259387767\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19927836356079,\n" +
"\t\t\"lon\": 116.73513114732762\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19927759500293,\n" +
"\t\t\"lon\": 116.73497660879111\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.199264819842284,\n" +
"\t\t\"lon\": 116.73480063747202\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.1992510141554,\n" +
"\t\t\"lon\": 116.73463922037767\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.199245872804,\n" +
"\t\t\"lon\": 116.73445960685193\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19924673374912,\n" +
"\t\t\"lon\": 116.73427704009703\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19924747108264,\n" +
"\t\t\"lon\": 116.7340707102972\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19924828745573,\n" +
"\t\t\"lon\": 116.73385916927226\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19924941093133,\n" +
"\t\t\"lon\": 116.73364048294795\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19924939253381,\n" +
"\t\t\"lon\": 116.73340837408566\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19924949105934,\n" +
"\t\t\"lon\": 116.73317368725336\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19925040039033,\n" +
"\t\t\"lon\": 116.73296532811216\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.1992515355653,\n" +
"\t\t\"lon\": 116.73277787366743\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.1992512720328,\n" +
"\t\t\"lon\": 116.73263377253741\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.199205174954606,\n" +
"\t\t\"lon\": 116.73249773114644\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.1991015743076,\n" +
"\t\t\"lon\": 116.7324219601283\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.198971862686285,\n" +
"\t\t\"lon\": 116.73239393296355\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19883883071582,\n" +
"\t\t\"lon\": 116.73237676435652\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19870171355796,\n" +
"\t\t\"lon\": 116.73236052150362\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.1985491853193,\n" +
"\t\t\"lon\": 116.73234157857011\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.1983890047355,\n" +
"\t\t\"lon\": 116.73232167996464\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.1982209877466,\n" +
"\t\t\"lon\": 116.73230101645792\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.198037574138326,\n" +
"\t\t\"lon\": 116.73227735486083\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19787327856243,\n" +
"\t\t\"lon\": 116.73225676816314\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19771917207499,\n" +
"\t\t\"lon\": 116.73223814728027\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.197548305175935,\n" +
"\t\t\"lon\": 116.73221624705808\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19739568979691,\n" +
"\t\t\"lon\": 116.73219618210774\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19724703821575,\n" +
"\t\t\"lon\": 116.73217598293311\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.1970956560885,\n" +
"\t\t\"lon\": 116.73215773721505\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19697703483188,\n" +
"\t\t\"lon\": 116.73214337172284\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19687000725696,\n" +
"\t\t\"lon\": 116.73210037067965\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.196833449601726,\n" +
"\t\t\"lon\": 116.73196646708011\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19685833847804,\n" +
"\t\t\"lon\": 116.73181315361103\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.196889170203264,\n" +
"\t\t\"lon\": 116.73164355747393\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19692242860347,\n" +
"\t\t\"lon\": 116.7314555399657\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19696431701069,\n" +
"\t\t\"lon\": 116.7312261834129\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19700025925464,\n" +
"\t\t\"lon\": 116.73102774016093\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19703414798773,\n" +
"\t\t\"lon\": 116.73084270562073\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19707287604138,\n" +
"\t\t\"lon\": 116.73062835248406\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19710951629977,\n" +
"\t\t\"lon\": 116.73041744082339\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19714593807105,\n" +
"\t\t\"lon\": 116.73021414314803\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.197183297026285,\n" +
"\t\t\"lon\": 116.7300057066447\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.1972247359487,\n" +
"\t\t\"lon\": 116.7297751515664\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19726518822745,\n" +
"\t\t\"lon\": 116.72954958923812\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19730538240706,\n" +
"\t\t\"lon\": 116.72932440756041\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19734272112662,\n" +
"\t\t\"lon\": 116.72911631453036\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.197379191549075,\n" +
"\t\t\"lon\": 116.72890982812105\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.197417565369314,\n" +
"\t\t\"lon\": 116.72869447869044\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19746052080799,\n" +
"\t\t\"lon\": 116.72845641541247\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19750040582118,\n" +
"\t\t\"lon\": 116.72823569991117\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19753999704064,\n" +
"\t\t\"lon\": 116.72801998373052\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19757796882569,\n" +
"\t\t\"lon\": 116.72781280504363\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.197617062364586,\n" +
"\t\t\"lon\": 116.72759949431683\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19765391602761,\n" +
"\t\t\"lon\": 116.72739776789756\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19768973009218,\n" +
"\t\t\"lon\": 116.72719980764646\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.197726191028785,\n" +
"\t\t\"lon\": 116.72699719861669\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19776233489642,\n" +
"\t\t\"lon\": 116.72679516155276\n" +
"\t}]}\n";
List<MessagePad.Location> list = new ArrayList<>();
List<MessagePad.Location> list = new ArrayList<>();
try {
JSONObject jsonObject = new JSONObject(listStr);
JSONArray jsonElements = jsonObject.getJSONArray("models");
for (int i = 0; i < jsonElements.length(); i++) {
JSONObject s = jsonElements.getJSONObject(i);
MessagePad.Location.Builder builder = MessagePad.Location.newBuilder();
builder.setLatitude(s.getDouble("lat"));
builder.setLongitude(s.getDouble("lon"));
list.add(builder.build());
}
MogoOCHTaxiModelNew.getInstance().updateOrderRoute(list);
MogoOCHTaxiModelNew.getInstance().updateOrderRouteInfo(list);
} catch (JSONException e) {
e.printStackTrace();
try {
JSONObject jsonObject = new JSONObject(listStr);
JSONArray jsonElements = jsonObject.getJSONArray("models");
for (int i = 0; i < jsonElements.length(); i++) {
JSONObject s = jsonElements.getJSONObject(i);
MessagePad.Location.Builder builder = MessagePad.Location.newBuilder();
builder.setLatitude(s.getDouble("lat"));
builder.setLongitude(s.getDouble("lon"));
list.add(builder.build());
}
});
MogoOCHTaxiModelNew.getInstance().updateOrderRoute(list);
MogoOCHTaxiModelNew.getInstance().updateOrderRouteInfo(list);
} catch (JSONException e) {
e.printStackTrace();
}
}
public void clickTestBar() {

View File

@@ -165,7 +165,11 @@ public class CoordinateCalculateRouteUtil {
}
}
Logger.d(M_TAXI + "calculateRouteSumLength", "点:"+currentIndex+"-------是最近的点------ ");
latePoints.addAll(mRoutePoints.subList(currentIndex,mRoutePoints.size()-1));
if (currentIndex == mRoutePoints.size()-1){
latePoints.add(mRoutePoints.get(currentIndex));
}else {
latePoints.addAll(mRoutePoints.subList(currentIndex,mRoutePoints.size()-1));
}
return latePoints;
}
return latePoints;

View File

@@ -63,11 +63,5 @@
android:text="到达目的地"
android:textSize="12sp" />
<Button
android:id="@+id/test_bar_send_route"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="发送全路径"
android:textSize="12sp" />
</LinearLayout>
</com.mogo.och.taxi.ui.BorderShadowLayout>

View File

@@ -21,5 +21,5 @@
<string name="module_och_taxi_order_server_completed_tip">车辆已停稳,请携带好随身物品,下车请注意安全</string>
<string name="module_och_taxi_order_server_start_auto_tip">无人驾驶已启动,请您系好安全带</string>
<string name="module_och_taxi_order_arrive_end_200m_tip">即将到达目的地,请拿好随身物品,准备下车</string>
<string name="module_och_taxi_order_auto_arrive_end_tip">已达到目的地,感谢乘坐蘑菇车联无人驾驶车,期待下次相遇</string>
<string name="module_och_taxi_order_auto_arrive_end_tip">已达到目的地,感谢乘坐\'蘑菇车联\'无人驾驶车,期待下次相遇</string>
</resources>