[290 bus] 1、司机端增加到站围栏 2、滑动出发控件调整

This commit is contained in:
wangmingjun
2022-07-28 21:33:42 +08:00
parent a920c9adcd
commit c4cd4a3f8f
5 changed files with 71 additions and 2 deletions

View File

@@ -28,6 +28,8 @@ public class BusStationBean {
private double lon; //高精坐标
private double lat; //高精坐标
private int businessType; //站点类型9:taxi10:bus
private double gcjLon; //高德
private double gcjLat; //高德
private int status;
private int siteId;
private int seq;
@@ -35,6 +37,14 @@ public class BusStationBean {
private int ifStop = 1; // 是否需要停靠、1需要、0不需要 // TODO: 2021/10/19 原来站点里有设计是否需要停靠字段,现设计暂无,默认都需要停靠
private boolean leaving;
public double getGcjLon() {
return gcjLon;
}
public double getGcjLat() {
return gcjLat;
}
public void setName(String name) {
this.name = name;
}

View File

@@ -72,5 +72,8 @@ class BusConst {
const val TYPE_MARKER_BUS_ORDER = "TYPE_MARKER_BUS_ORDER"
const val TIMER_START_AUTOPILOT_INTERVAL = 20 * 1000L
//围栏到站 暂定10米
const val ARRIVE_AT_END_STATION_DISTANCE = 10
}
}

View File

@@ -17,6 +17,7 @@ import androidx.annotation.NonNull;
import com.amap.api.maps.model.LatLng;
import com.elegant.network.utils.GsonUtil;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.voice.AIAssist;
@@ -25,8 +26,10 @@ import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
@@ -111,6 +114,8 @@ public class BusOrderModel {
private boolean hadQueryLeaveAwayPassager = false;
private volatile boolean isArrivedStation = false;
private final Handler handler = new Handler(new Handler.Callback() {
@Override
public boolean handleMessage(Message msg) {
@@ -376,9 +381,42 @@ public class BusOrderModel {
if (mControllerStatusCallback != null) {
mControllerStatusCallback.onCarLocationChanged(location);
}
//是否到站的围栏判断 离站状态并且自动驾驶还未触发到站
if (isGoingToNextStation && !isArrivedStation){
judgeStartStation(location);
}
}
};
//根据围栏判断,是否到达起点
private void judgeStartStation(Location location) {
if (backgroundCurrentStationIndex -1 < 0 || backgroundCurrentStationIndex > stationList.size()-1){
return;
}
BusStationBean upcomingStation = stationList.get( backgroundCurrentStationIndex);
double startLon = upcomingStation.getGcjLon();
double startLat = upcomingStation.getGcjLat();
double distance = CoordinateUtils.calculateLineDistance(
startLon, startLat,
location.getLongitude(), location.getLatitude() );
Logger.i(TAG, "judgeStartStation() distance = " + distance);
if ( distance > BusConst.ARRIVE_AT_END_STATION_DISTANCE ) {
distance = CoordinateUtils.calculateLineDistance(startLon, startLat,
CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lon(),
CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lat());
}
if ( distance <= BusConst.ARRIVE_AT_END_STATION_DISTANCE ) {
onArriveAt(null); //无自动驾驶到站信息传null
return;
}
}
/**
* 查询小巴路线
*/
@@ -443,6 +481,7 @@ public class BusOrderModel {
if ( o.getResult() == null || o.getResult().getSites() == null || o.getResult().getSites().isEmpty() ) {
return;
}
isArrivedStation = false;
if (!isOneWayOver){
CallerLogger.INSTANCE.d( M_BUS + TAG, "自动驾驶开启开往下一站====" );
//需要更改当前站和下一站的状态 然后渲染
@@ -499,6 +538,9 @@ public class BusOrderModel {
* @param isRestart
*/
private void startAutopilot(boolean isRestart) {
isArrivedStation = false;
BusStationBean currentStation = stationList.get( backgroundCurrentStationIndex);
BusStationBean nextStation = stationList.get( backgroundCurrentStationIndex + 1);
@@ -542,6 +584,10 @@ public class BusOrderModel {
* 到站后重置站点状态
*/
private void arriveSiteStation(boolean isRestart) {
if ( backgroundCurrentStationIndex +1 > stationList.size() - 1 ) { //到站短时间内调用多次
CallerLogger.INSTANCE.e( M_BUS + TAG, "数组越界" );
return;
}
int arrivedStationIndex = 0;
if (!isRestart){
arrivedStationIndex = backgroundCurrentStationIndex + 1;
@@ -890,6 +936,10 @@ public class BusOrderModel {
CallerLogger.INSTANCE.e( M_BUS + TAG, "到站异常,取消后续操作结束" );
return;
}
if (isArrivedStation) return;
isArrivedStation = true;
if (FunctionBuildConfig.isDemoMode && backgroundCurrentStationIndex <= stationList.size() - 1) {//到达一站结束美化
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false;
CallerAutoPilotManager.INSTANCE.setDemoMode(false);

View File

@@ -112,6 +112,7 @@ public class SlidePanelView extends View {
}
private void init() {
bgRectF = new RectF(0, 0, 0, 0);
bgPaint.setColor(Color.parseColor("#CC0F1325"));
bgPaint.setStyle(Paint.Style.FILL);
@@ -160,7 +161,12 @@ public class SlidePanelView extends View {
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
bgRectF = new RectF(0, 0, w, h);
if (bgRectF != null){
bgRectF.left = 0;
bgRectF.top = 0;
bgRectF.right = w;
bgRectF.bottom = h;
}
if (matrixAnim != null) {
matrixAnim.cancel();

View File

@@ -169,7 +169,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/module_mogo_och_margin_bottom"
android:visibility="gone"
android:visibility="invisible"
app:BLOCK_START_X="@dimen/module_mogo_och_slide_panel_block_start_x"
app:BLOCK_START_Y="@dimen/module_mogo_och_slide_panel_block_start_y"
app:NORMAL_TEXT_MARGIN_LEFT="@dimen/module_mogo_och_slide_panel_normal_text_margin_left"