Merge branch 'dev_robotaxi-d-app-module_266_220425_2.6.6' of gitlab.zhidaoauto.com:zhjt/AndroidApp/MoGoEagleEye into dev_robotaxi-d-app-module_266_220425_2.6.6
This commit is contained in:
@@ -28,6 +28,7 @@ public class BusPassengerLineStationsAdapter extends RecyclerView.Adapter<Recycl
|
||||
private static final int LINE_START_STATION_ITEM = 0;
|
||||
private static final int LINE_END_STATION_ITEM = 1;
|
||||
private static final int LINE_MIDDLE_STATION_ITEM = 2;
|
||||
private String preArrivingStation = "";
|
||||
|
||||
public BusPassengerLineStationsAdapter(Context context, List<BusPassengerStation> stations){
|
||||
this.mContext = context;
|
||||
@@ -57,41 +58,58 @@ public class BusPassengerLineStationsAdapter extends RecyclerView.Adapter<Recycl
|
||||
BusPassengerStation station = mStations.get(position);
|
||||
if (holder instanceof StartStationViewHolder){
|
||||
StartStationViewHolder viewHolder = (StartStationViewHolder)holder;
|
||||
viewHolder.startStationName.setText(station.getName());
|
||||
if (!preArrivingStation.equals(station.getName())){
|
||||
viewHolder.startStationName.setText(station.getName());
|
||||
}
|
||||
if (station.getDrivingStatus() == STATION_STATUS_STOPPED && !station.isLeaving()){//到站
|
||||
viewHolder.curStationBg.setVisibility(View.VISIBLE);
|
||||
viewHolder.stationCircle.setVisibility(View.GONE);
|
||||
viewHolder.startStationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_current_station_txt_color));
|
||||
viewHolder.startStationName.setSelected(true);
|
||||
preArrivingStation = station.getName();
|
||||
}else {
|
||||
viewHolder.curStationBg.setVisibility(View.GONE);
|
||||
viewHolder.stationCircle.setVisibility(View.VISIBLE);
|
||||
viewHolder.startStationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_station_txt_color));
|
||||
viewHolder.startStationName.setSelected(false);
|
||||
}
|
||||
}else if (holder instanceof EndStationViewHolder){
|
||||
EndStationViewHolder viewHolder = (EndStationViewHolder)holder;
|
||||
viewHolder.endStationName.setText(station.getName());
|
||||
if (!preArrivingStation.equals(station.getName())){
|
||||
viewHolder.endStationName.setText(station.getName());
|
||||
}
|
||||
BusPassengerStation preStation = mStations.get(position -1);
|
||||
if ((preStation.getDrivingStatus() == STATION_STATUS_STOPPED && preStation.isLeaving())
|
||||
|| (station.getDrivingStatus() == STATION_STATUS_STOPPED && !station.isLeaving())){//到站
|
||||
viewHolder.curStationBg.setVisibility(View.VISIBLE);
|
||||
viewHolder.stationCircle.setVisibility(View.GONE);
|
||||
viewHolder.endStationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_current_station_txt_color));
|
||||
viewHolder.endStationName.setSelected(true);
|
||||
preArrivingStation = station.getName();
|
||||
}else {
|
||||
viewHolder.curStationBg.setVisibility(View.GONE);
|
||||
viewHolder.stationCircle.setVisibility(View.VISIBLE);
|
||||
viewHolder.endStationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_station_txt_color));
|
||||
viewHolder.endStationName.setSelected(false);
|
||||
}
|
||||
}else {
|
||||
MiddleStationViewHolder viewHolder = (MiddleStationViewHolder)holder;
|
||||
viewHolder.middleStationName.setText(station.getName());
|
||||
if (!preArrivingStation.equals(station.getName())){
|
||||
viewHolder.middleStationName.setText(station.getName());
|
||||
}
|
||||
BusPassengerStation preStation = mStations.get(position -1);
|
||||
if ((preStation.getDrivingStatus() == STATION_STATUS_STOPPED && preStation.isLeaving())
|
||||
|| (station.getDrivingStatus() == STATION_STATUS_STOPPED && !station.isLeaving())) {//到站
|
||||
viewHolder.curStationBg.setVisibility(View.VISIBLE);
|
||||
viewHolder.middleStationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_current_station_txt_color));
|
||||
viewHolder.stationCircle.setVisibility(View.GONE);
|
||||
viewHolder.middleStationName.setSelected(true);
|
||||
preArrivingStation = station.getName();
|
||||
}else {
|
||||
viewHolder.curStationBg.setVisibility(View.GONE);
|
||||
viewHolder.middleStationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_station_txt_color));
|
||||
viewHolder.stationCircle.setVisibility(View.VISIBLE);
|
||||
viewHolder.middleStationName.setSelected(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -144,9 +162,11 @@ class MiddleStationViewHolder extends RecyclerView.ViewHolder{
|
||||
|
||||
public TextView middleStationName;
|
||||
public ImageView curStationBg;
|
||||
public ImageView stationCircle;
|
||||
public MiddleStationViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
middleStationName = itemView.findViewById(R.id.bus_p_middle_station);
|
||||
curStationBg = itemView.findViewById(R.id.bus_p_middle_tag);
|
||||
stationCircle = itemView.findViewById(R.id.bus_p_middle_circle);
|
||||
}
|
||||
}
|
||||
@@ -198,13 +198,13 @@ public class BusPassengerMapDirectionView
|
||||
}
|
||||
boundsBuilder.include(currentLatLng);
|
||||
//第二个参数为四周留空宽度
|
||||
mAMap.animateCamera(CameraUpdateFactory.newLatLngBoundsRect(boundsBuilder.build(),100,100,100,100));
|
||||
mAMap.moveCamera(CameraUpdateFactory.newLatLngBoundsRect(boundsBuilder.build(),100,100,100,100));
|
||||
|
||||
}else {
|
||||
//设置希望展示的地图缩放级别
|
||||
CameraPosition cameraPosition = new CameraPosition.Builder()
|
||||
.target(mCarMarker.getPosition()).tilt(0).bearing(location.getBearing()).zoom(zoomLevel).build();
|
||||
mAMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
|
||||
mAMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
@@ -36,7 +35,8 @@ import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS
|
||||
* @date: 2022/4/12
|
||||
*/
|
||||
public class BusPassengerRouteFragment extends
|
||||
BusPassengerBaseFragment<BusPassengerRouteFragment, BaseBusPassengerPresenter> implements IBusPassengerMapViewCallback {
|
||||
BusPassengerBaseFragment<BusPassengerRouteFragment, BaseBusPassengerPresenter>
|
||||
implements IBusPassengerMapViewCallback {
|
||||
|
||||
private final String TAG = "BusPassengerRouteFragment";
|
||||
|
||||
@@ -224,6 +224,10 @@ public class BusPassengerRouteFragment extends
|
||||
mStationsList.addAll(stations);
|
||||
mAdapter.notifyDataSetChanged();
|
||||
|
||||
if (currentStationIndex > -1){
|
||||
updateCurrentStation(currentStationIndex);
|
||||
}
|
||||
|
||||
if (currentStationIndex == 0 && isArrived){ //到达始发站且并未出发, 恢复站点marker 清楚路径 清空路径点
|
||||
clearPolyline();
|
||||
if (mMapDirectionView != null) mMapDirectionView.clearCoordinatesLatLng();
|
||||
@@ -282,4 +286,10 @@ public class BusPassengerRouteFragment extends
|
||||
int speedKM = (int) (Math.abs(speed) * 3.6F);
|
||||
mSpeedTv.setText(String.valueOf(speedKM));
|
||||
}
|
||||
|
||||
public void updateCurrentStation(int position) {
|
||||
if (mStationsListRv != null){
|
||||
mStationsListRv.smoothScrollToPosition(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/bus_p_tag_line_color" />
|
||||
<corners android:radius="@dimen/bus_p_station_circle_radius_size" />
|
||||
</shape>
|
||||
@@ -53,13 +53,15 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bus_p_cur_station_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="@dimen/bus_p_curent_station_txt_width"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:textColor="@color/bus_p_panel_cur_station_txt_color"
|
||||
android:textSize="@dimen/bus_p_curent_station_txt_size1"
|
||||
android:textStyle="bold"
|
||||
android:text="-- --"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:elevation="@dimen/dp_10"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/bus_p_cur_station_title"
|
||||
app:layout_constraintTop_toBottomOf="@+id/bus_p_cur_station_title" />
|
||||
|
||||
@@ -145,10 +145,12 @@
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/bus_p_line_stations_rl"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/bus_p_driver_number_plate_margin_top"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="@dimen/dp_280"
|
||||
android:paddingBottom="@dimen/dp_30"
|
||||
android:paddingLeft="@dimen/bus_p_route_info_margin_left"
|
||||
android:paddingRight="@dimen/bus_p_route_info_margin_right"
|
||||
android:requiresFadingEdge="vertical"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/bus_p_driver_num_plate_tv"
|
||||
app:layout_constraintTop_toBottomOf="@+id/dividing_line_2" />
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bus_p_station_item_height"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="@dimen/bus_p_station_item_height"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/bus_p_station_tag_line_width"
|
||||
android:layout_height="@dimen/bus_p_station_tag_line_height"
|
||||
android:layout_height="@dimen/bus_p_station_tag_line_height1"
|
||||
android:background="@color/bus_p_tag_line_color"
|
||||
android:layout_marginLeft="@dimen/dp_7"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
@@ -14,17 +15,21 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bus_p_end_station"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="--"
|
||||
android:textSize="@dimen/bus_p_station_txt_size"
|
||||
android:textStyle="bold"
|
||||
android:includeFontPadding = "false"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:marqueeRepeatLimit="marquee_forever"
|
||||
android:layout_marginRight="@dimen/dp_60"
|
||||
android:textColor="@color/bus_p_station_txt_color"
|
||||
android:layout_marginLeft="@dimen/dp_45"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/bus_p_end_tag"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/bus_p_end_tag"/>
|
||||
app:layout_constraintRight_toLeftOf="@+id/bus_p_end_tag"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bus_p_end_circle"
|
||||
@@ -38,9 +43,11 @@
|
||||
android:id="@+id/bus_p_cur_end_station_tag"
|
||||
android:layout_width="@dimen/bus_p_cur_station_circle_width"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="fitXY"
|
||||
android:background="@drawable/bg_bus_p_arrived_station"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/bus_p_end_station"/>
|
||||
app:layout_constraintBottom_toBottomOf="@+id/bus_p_end_station"
|
||||
app:layout_constraintTop_toTopOf="@+id/bus_p_end_station"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bus_p_end_tag"
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bus_p_station_item_middle_height"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="@dimen/bus_p_station_item_middle_height"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<ImageView
|
||||
@@ -20,11 +21,17 @@
|
||||
app:layout_constraintLeft_toLeftOf="parent"/>
|
||||
<TextView
|
||||
android:id="@+id/bus_p_middle_station"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="@dimen/bus_p_station_txt_width"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="--"
|
||||
android:textSize="@dimen/bus_p_station_txt_size"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:layout_marginBottom="@dimen/dp_20"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:marqueeRepeatLimit="marquee_forever"
|
||||
android:layout_marginRight="@dimen/dp_60"
|
||||
android:includeFontPadding = "false"
|
||||
android:textColor="@color/bus_p_current_station_txt_color"
|
||||
android:layout_marginLeft="@dimen/dp_45"
|
||||
@@ -32,15 +39,23 @@
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bus_p_middle_circle"
|
||||
android:layout_width="@dimen/bus_p_station_circle_width_height"
|
||||
android:layout_height="@dimen/bus_p_station_circle_width_height"
|
||||
android:background="@drawable/bg_bus_p_middle_station_circle"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/bus_p_middle_station"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/bus_p_middle_station"/>
|
||||
<ImageView
|
||||
android:id="@+id/bus_p_middle_tag"
|
||||
android:layout_width="@dimen/bus_p_cur_station_circle_width"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="fitXY"
|
||||
android:background="@drawable/bg_bus_p_arrived_station"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
app:layout_constraintTop_toTopOf="@+id/bus_p_middle_station"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/bus_p_middle_station"/>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,12 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bus_p_station_item_height"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="@dimen/bus_p_station_item_height"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/bus_p_station_tag_line_width"
|
||||
android:layout_height="@dimen/bus_p_station_tag_line_height"
|
||||
android:layout_height="@dimen/bus_p_station_tag_line_height1"
|
||||
android:background="@color/bus_p_tag_line_color"
|
||||
android:layout_marginLeft="@dimen/dp_7"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@@ -14,17 +15,21 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bus_p_start_station"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_45"
|
||||
android:includeFontPadding="false"
|
||||
android:text="--"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:marqueeRepeatLimit="marquee_forever"
|
||||
android:textColor="@color/bus_p_station_txt_color"
|
||||
android:textSize="@dimen/bus_p_station_txt_size"
|
||||
android:textStyle="bold"
|
||||
android:includeFontPadding = "false"
|
||||
android:textColor="@color/bus_p_station_txt_color"
|
||||
android:layout_marginLeft="@dimen/dp_45"
|
||||
android:layout_marginRight="@dimen/dp_60"
|
||||
app:layout_constraintRight_toLeftOf="@+id/bus_p_start_tag"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/bus_p_start_tag"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/bus_p_start_tag"/>
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bus_p_start_circle"
|
||||
@@ -39,9 +44,11 @@
|
||||
android:id="@+id/bus_p_cur_start_station_tag"
|
||||
android:layout_width="@dimen/bus_p_cur_station_circle_width"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="fitXY"
|
||||
android:background="@drawable/bg_bus_p_arrived_station"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/bus_p_start_station"/>
|
||||
app:layout_constraintTop_toTopOf="@+id/bus_p_start_station"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/bus_p_start_station"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bus_p_start_tag"
|
||||
|
||||
@@ -43,7 +43,8 @@
|
||||
<dimen name="bus_p_station_tag_txt_size">36px</dimen>
|
||||
<dimen name="bus_p_station_item_height">80px</dimen>
|
||||
<dimen name="bus_p_station_item_middle_height">100px</dimen>
|
||||
<dimen name="bus_p_station_tag_line_height">50px</dimen>
|
||||
<dimen name="bus_p_station_tag_line_height">80px</dimen>
|
||||
<dimen name="bus_p_station_tag_line_height1">60px</dimen>
|
||||
<dimen name="bus_p_station_tag_line_width">6px</dimen>
|
||||
|
||||
<dimen name="bus_p_curent_station_panel_width">638px</dimen>
|
||||
@@ -52,4 +53,7 @@
|
||||
<dimen name="bus_p_curent_station_txt_size">44px</dimen>
|
||||
<dimen name="bus_p_curent_station_txt_size1">55px</dimen>
|
||||
<dimen name="bus_p_curent_station_tip_size1">40px</dimen>
|
||||
|
||||
<dimen name="bus_p_curent_station_txt_width">584px</dimen>
|
||||
<dimen name="bus_p_station_txt_width">550px</dimen>
|
||||
</resources>
|
||||
@@ -44,7 +44,8 @@
|
||||
<dimen name="bus_p_station_tag_txt_size">36px</dimen>
|
||||
<dimen name="bus_p_station_item_height">80px</dimen>
|
||||
<dimen name="bus_p_station_item_middle_height">100px</dimen>
|
||||
<dimen name="bus_p_station_tag_line_height">50px</dimen>
|
||||
<dimen name="bus_p_station_tag_line_height">80px</dimen>
|
||||
<dimen name="bus_p_station_tag_line_height1">60px</dimen>
|
||||
<dimen name="bus_p_station_tag_line_width">6px</dimen>
|
||||
|
||||
<dimen name="bus_p_curent_station_panel_width">638px</dimen>
|
||||
@@ -53,4 +54,7 @@
|
||||
<dimen name="bus_p_curent_station_txt_size">44px</dimen>
|
||||
<dimen name="bus_p_curent_station_txt_size1">55px</dimen>
|
||||
<dimen name="bus_p_curent_station_tip_size1">40px</dimen>
|
||||
|
||||
<dimen name="bus_p_curent_station_txt_width">584px</dimen>
|
||||
<dimen name="bus_p_station_txt_width">550px</dimen>
|
||||
</resources>
|
||||
@@ -47,6 +47,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation rootProject.ext.dependencies.amapnavi3dmap
|
||||
|
||||
implementation rootProject.ext.dependencies.rxjava
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by pangfan on 2021/8/19
|
||||
*
|
||||
* 订单状态更新请求数据结构
|
||||
*/
|
||||
public class BusRoutePlanningUpdateReqBean {
|
||||
public String sn;
|
||||
public int lineId;
|
||||
public int startSiteId;
|
||||
public int endSiteId;
|
||||
public List<Result> points;
|
||||
|
||||
public static class Result {
|
||||
public Double latitude;
|
||||
public Double longitude;
|
||||
}
|
||||
|
||||
public BusRoutePlanningUpdateReqBean(String sn, int lineId, int startSiteId
|
||||
, int endSiteId, List<Result> points) {
|
||||
this.sn = sn;
|
||||
this.lineId = lineId;
|
||||
this.startSiteId = startSiteId;
|
||||
this.endSiteId = endSiteId;
|
||||
this.points = points;
|
||||
}
|
||||
}
|
||||
@@ -41,6 +41,7 @@ import com.mogo.module.common.constants.DataTypes;
|
||||
import com.mogo.module.common.view.OnPreventFastClickListener;
|
||||
import com.mogo.och.bus.R;
|
||||
import com.mogo.och.bus.ui.BusTrafficLightView;
|
||||
import com.mogo.och.bus.util.BDRouteDataTestUtils;
|
||||
import com.mogo.och.bus.view.BusArcView;
|
||||
import com.mogo.och.bus.view.SlidePanelView;
|
||||
|
||||
@@ -198,6 +199,8 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
|
||||
debugArrivedStation()
|
||||
);
|
||||
|
||||
findViewById(R.id.btnAutopilotRoute).setOnClickListener(view -> debugArrivedRoute());
|
||||
|
||||
tvOperationStatus.setOnClickListener(view -> {
|
||||
onChangeOperationStatus();
|
||||
});
|
||||
@@ -227,6 +230,10 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
|
||||
CallerHmiManager.INSTANCE.registerUpgradeTipsCallback(() -> mUpgradeTipIv);
|
||||
}
|
||||
|
||||
private void debugArrivedRoute() {
|
||||
BDRouteDataTestUtils.converToRouteData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.bus.presenter;
|
||||
package com.mogo.och.bus.model;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.bus.presenter;
|
||||
package com.mogo.och.bus.model;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS;
|
||||
import static com.mogo.och.bus.constant.BusConst.STATION_STATUS_STOPPED;
|
||||
@@ -9,15 +9,19 @@ import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
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.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
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.toast.TipToast;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
@@ -27,6 +31,7 @@ import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.och.bus.bean.BusOperationStatusResponse;
|
||||
import com.mogo.och.bus.bean.BusOrderBean;
|
||||
import com.mogo.och.bus.bean.BusOrdersResponse;
|
||||
import com.mogo.och.bus.bean.BusRoutePlanningUpdateReqBean;
|
||||
import com.mogo.och.bus.bean.BusRoutesResponse;
|
||||
import com.mogo.och.bus.bean.BusRoutesResult;
|
||||
import com.mogo.och.bus.bean.BusStationBean;
|
||||
@@ -38,7 +43,9 @@ import com.mogo.och.bus.callback.ISlidePannelHideCallback;
|
||||
import com.mogo.och.bus.constant.BusConst;
|
||||
import com.mogo.och.bus.net.BusServiceManager;
|
||||
import com.mogo.och.bus.net.IBusServiceCallback;
|
||||
import com.mogo.och.bus.presenter.BusModelLoopManager;
|
||||
import com.mogo.och.bus.util.BusAnalyticsUtil;
|
||||
import com.mogo.och.bus.util.CoordinateCalculateRouteUtil;
|
||||
import com.mogo.och.bus.util.PinYinUtil;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
@@ -94,6 +101,8 @@ public class BusOrderModel {
|
||||
private ISlidePannelHideCallback slidePannelHideCallback;
|
||||
private IBusControllerStatusCallback mControllerStatusCallback; //Model->Presenter:VR mode等
|
||||
|
||||
List<BusRoutePlanningUpdateReqBean.Result> points = new ArrayList<>();//全路径信息
|
||||
|
||||
private boolean hadQueryLeaveAwayPassager = false;
|
||||
|
||||
private final Handler handler = new Handler(new Handler.Callback() {
|
||||
@@ -135,6 +144,9 @@ public class BusOrderModel {
|
||||
.getApis()
|
||||
.getStatusManagerApi()
|
||||
.registerStatusChangedListener( TAG, StatusDescriptor.VR_MODE, mMogoStatusChangedListener );
|
||||
|
||||
//自动驾驶路线规划接口
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG, moGoAutopilotPlanningListener);
|
||||
}
|
||||
|
||||
//2022.1.28
|
||||
@@ -194,6 +206,57 @@ public class BusOrderModel {
|
||||
this.mControllerStatusCallback = callback;
|
||||
}
|
||||
|
||||
private final IMoGoAutopilotPlanningListener moGoAutopilotPlanningListener = new IMoGoAutopilotPlanningListener() {
|
||||
|
||||
@Override
|
||||
public void onAutopilotTrajectory(@NonNull List<MessagePad.TrajectoryPoint> trajectoryInfos) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotRotting(MessagePad.GlobalPathResp routeList) {
|
||||
if (null != routeList && routeList.getWayPointsList().size() > 0){
|
||||
points.clear();
|
||||
points.addAll(CoordinateCalculateRouteUtil.coordinateConverterWgsToGcjList(mContext,routeList.getWayPointsList()));
|
||||
updateOrderRoute();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* 上报订单全路径规划数据
|
||||
*/
|
||||
public void updateOrderRoute() {
|
||||
if (!isGoingToNextStation || currentStationIndex >= stationList.size() || currentStationIndex-1 < 0 || points.size() == 0){
|
||||
return;
|
||||
}
|
||||
|
||||
BusStationBean currentStation = stationList.get( currentStationIndex -1);
|
||||
BusStationBean nextStation = stationList.get( currentStationIndex);
|
||||
|
||||
BusServiceManager.getInstance().updateOrderRoute(mContext, currentLineId, currentStation.getSiteId()
|
||||
, nextStation.getSiteId(), points, new IBusServiceCallback<BaseData>() {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(String failMsg) {
|
||||
if (isGoingToNextStation){//重试
|
||||
updateOrderRoute();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void debugUpdateOrderRoute(List<MessagePad.Location> list){
|
||||
points.clear();
|
||||
points.addAll(CoordinateCalculateRouteUtil.coordinateConverterWgsToGcjList(mContext,list));
|
||||
updateOrderRoute();
|
||||
}
|
||||
|
||||
/**
|
||||
* 轮询bus待服务订单
|
||||
*/
|
||||
@@ -262,6 +325,9 @@ public class BusOrderModel {
|
||||
.getApis()
|
||||
.getRegisterCenterApi()
|
||||
.unregisterCarLocationChangedListener(TAG, mCarLocationChangedListener2);
|
||||
|
||||
//自动驾驶路线规划接口
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.removeListener(moGoAutopilotPlanningListener);
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
@@ -563,6 +629,8 @@ public class BusOrderModel {
|
||||
public void onFail(String failMsg) {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
TipToast.shortTip("网络异常,请稍后重试");
|
||||
}else {
|
||||
TipToast.shortTip(failMsg);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -11,6 +11,7 @@ import com.mogo.eagle.core.network.RequestOptions;
|
||||
import com.mogo.eagle.core.network.SubscribeImpl;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.och.bus.bean.BusQueryLinesResponse;
|
||||
import com.mogo.och.bus.bean.BusRoutePlanningUpdateReqBean;
|
||||
import com.mogo.och.bus.bean.BusRoutesResponse;
|
||||
import com.mogo.och.bus.bean.CarHeartbeatReqBean;
|
||||
import com.mogo.och.bus.bean.BusOperationStatusRequest;
|
||||
@@ -22,7 +23,9 @@ import com.mogo.och.bus.bean.BusUpdateSiteStatusRequest;
|
||||
import com.mogo.och.bus.bean.QueryLeaveAwayPassengersRequest;
|
||||
import com.mogo.och.bus.bean.QueryLeaveAwayPassengersResponse;
|
||||
import com.mogo.och.bus.constant.BusConst;
|
||||
import com.mogo.och.bus.presenter.BusOrderModel;
|
||||
import com.mogo.och.bus.model.BusOrderModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
@@ -192,6 +195,18 @@ public class BusServiceManager {
|
||||
.subscribe(getSubscribeImpl(context,callback,"queryBusLines"));
|
||||
}
|
||||
|
||||
public void updateOrderRoute(Context context,int lineId, int startSiteId, int endSiteId
|
||||
, List< BusRoutePlanningUpdateReqBean.Result > points
|
||||
, IBusServiceCallback<BaseData> callback){
|
||||
mService.updateOrderRoute(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new BusRoutePlanningUpdateReqBean(MoGoAiCloudClientConfig.getInstance().getSn()
|
||||
,lineId,startSiteId,endSiteId, points))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context,callback,"updateOrderRoute"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 车机端上传心跳数据(只在出车状态时上传):包含高德坐标系经纬度
|
||||
* @param context
|
||||
|
||||
@@ -3,6 +3,7 @@ import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.och.bus.bean.BusOperationStatusRequest;
|
||||
import com.mogo.och.bus.bean.BusOrdersResponse;
|
||||
import com.mogo.och.bus.bean.BusQueryLinesResponse;
|
||||
import com.mogo.och.bus.bean.BusRoutePlanningUpdateReqBean;
|
||||
import com.mogo.och.bus.bean.BusRoutesResponse;
|
||||
import com.mogo.och.bus.bean.CarHeartbeatReqBean;
|
||||
import com.mogo.och.bus.bean.BusQueryLineStationsRequest;
|
||||
@@ -145,5 +146,10 @@ public interface IBusApiService {
|
||||
// @GET("/autopilot-car-hailing/line/v2/driver/bindLine/query")
|
||||
@GET("/autopilot-car-hailing/line/v2/driver/bus/bindLine/query")
|
||||
Observable<BusQueryLinesResponse> queryBusLines(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
|
||||
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
// @POST( "/autopilot-car-hailing/location/v2/driver/heartbeat" )
|
||||
@POST( "/autopilot-car-hailing/location/v2/driver/bus/heartbeat" )
|
||||
Observable<BaseData> updateOrderRoute(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusRoutePlanningUpdateReqBean data);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.bus.bean.BusQueryLinesResponse;
|
||||
import com.mogo.och.bus.callback.IBusLinesCallback;
|
||||
import com.mogo.och.bus.model.BusLineModel;
|
||||
import com.mogo.och.bus.model.BusOrderModel;
|
||||
import com.mogo.och.bus.ui.BusSwitchLineView;
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,6 +4,7 @@ import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.och.bus.constant.BusConst;
|
||||
import com.mogo.och.bus.model.BusOrderModel;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.mogo.och.bus.callback.IBusControllerStatusCallback;
|
||||
import com.mogo.och.bus.callback.IRefreshBusStationsCallback;
|
||||
import com.mogo.och.bus.callback.ISlidePannelHideCallback;
|
||||
import com.mogo.och.bus.fragment.BusFragment;
|
||||
import com.mogo.och.bus.model.BusOrderModel;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,177 @@
|
||||
package com.mogo.och.bus.util;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.amap.api.maps.CoordinateConverter;
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.och.bus.bean.BusRoutePlanningUpdateReqBean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/3/28
|
||||
*/
|
||||
public class CoordinateCalculateRouteUtil {
|
||||
|
||||
public static float calculateRouteSumLength(List<LatLng> points){
|
||||
if (null == points || points.size() == 0) return 0;
|
||||
|
||||
float sumLength = 0;
|
||||
|
||||
//计算全路径总距离
|
||||
for (int i = 0;i + 1< points.size();i++){
|
||||
double preLat = points.get(i).latitude;
|
||||
double preLon = points.get(i).longitude;
|
||||
double laLat = points.get(i+1).latitude;
|
||||
double laLon = points.get(i+1).longitude;
|
||||
|
||||
float length = CoordinateUtils.calculateLineDistance(laLon,laLat,preLon,preLat);
|
||||
sumLength += length;
|
||||
}
|
||||
return sumLength;
|
||||
}
|
||||
|
||||
public static List<LatLng> coordinateConverterWgsToGcjListCommon(Context mContext, List<MessagePad.Location> models) {
|
||||
//转成MogoLatLng集合
|
||||
List<LatLng> list = new ArrayList<>();
|
||||
for (MessagePad.Location m : models) {
|
||||
LatLng mogoLatLng = coordinateConverterWgsToGcj(mContext, m);
|
||||
list.add(mogoLatLng);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static LatLng coordinateConverterWgsToGcj(Context mContext, MessagePad.Location mogoLatLng) {
|
||||
CoordinateConverter mCoordinateConverter = new CoordinateConverter(mContext);
|
||||
mCoordinateConverter.from(CoordinateConverter.CoordType.GPS);
|
||||
mCoordinateConverter.coord(new LatLng(mogoLatLng.getLatitude(), mogoLatLng.getLongitude()));
|
||||
LatLng latLng = mCoordinateConverter.convert();
|
||||
return latLng;
|
||||
}
|
||||
|
||||
|
||||
public static List<BusRoutePlanningUpdateReqBean.Result> coordinateConverterWgsToGcjList(Context mContext, List<MessagePad.Location> mogoLatLngList) {
|
||||
List<BusRoutePlanningUpdateReqBean.Result> points = new ArrayList<>();
|
||||
for (MessagePad.Location m : mogoLatLngList) {
|
||||
LatLng mogoLatLng = CoordinateCalculateRouteUtil.coordinateConverterWgsToGcj(mContext, m);
|
||||
BusRoutePlanningUpdateReqBean.Result result = new BusRoutePlanningUpdateReqBean.Result();
|
||||
result.latitude = mogoLatLng.latitude;
|
||||
result.longitude = mogoLatLng.longitude;
|
||||
points.add(result);
|
||||
}
|
||||
return points;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据实时定位的坐标确定出已行驶到那个坐标点 todo 有问题 暂不使用
|
||||
* @param mRoutePoints
|
||||
* @param realLon
|
||||
* @param realLat
|
||||
* @return 返回剩余路径集合
|
||||
*/
|
||||
@Deprecated
|
||||
public static List<LatLng> getCurrentPoinByCompare(List<LatLng> mRoutePoints, double realLon, double realLat) {
|
||||
// 疑似坐标 先以坐标中间1/2为第一个比对点
|
||||
int currentIndex = Math.round(mRoutePoints.size()/2);
|
||||
LatLng currentLatLng = mRoutePoints.get(currentIndex);
|
||||
|
||||
//差值初始化
|
||||
float baseDiffDis = CoordinateUtils.calculateLineDistance(realLon,realLat
|
||||
,currentLatLng.longitude,currentLatLng.latitude);// lon,lat, prelon, prelat
|
||||
|
||||
List<LatLng> latePoints = new ArrayList<>();
|
||||
//与选中点左右比较
|
||||
if (currentIndex -1 >= 0 && currentIndex+1<= mRoutePoints.size()-1){
|
||||
LatLng leftCurrentLatLng = mRoutePoints.get(currentIndex -1);
|
||||
LatLng rightCurentLatLng = mRoutePoints.get(currentIndex + 1);
|
||||
float leftDiffDis = CoordinateUtils.calculateLineDistance(realLon,realLat
|
||||
,leftCurrentLatLng.longitude,leftCurrentLatLng.latitude);
|
||||
float rightDiffDis = CoordinateUtils.calculateLineDistance(realLon,realLat,rightCurentLatLng.longitude,rightCurentLatLng.latitude);
|
||||
|
||||
if (rightDiffDis < leftDiffDis){ //靠近了右半边
|
||||
baseDiffDis = rightDiffDis;
|
||||
for (int i = currentIndex +1; i+1 <mRoutePoints.size() ;i++){
|
||||
float diff = CoordinateUtils.calculateLineDistance(realLon,realLat
|
||||
,mRoutePoints.get(i).longitude,mRoutePoints.get(i).latitude);
|
||||
Logger.d(M_BUS + "Compare右半边集合", "点:"+i+"------------baseDiffDis = "+baseDiffDis+"---diff="+diff);
|
||||
if (baseDiffDis >= diff){
|
||||
baseDiffDis = diff;
|
||||
currentIndex = i;
|
||||
if (i == mRoutePoints.size()-1){
|
||||
latePoints.addAll(mRoutePoints);
|
||||
}
|
||||
}else {
|
||||
latePoints.addAll(mRoutePoints.subList(currentIndex,mRoutePoints.size()-1));
|
||||
return latePoints;
|
||||
}
|
||||
}
|
||||
}else if (rightDiffDis > leftDiffDis){ //靠近左半边
|
||||
baseDiffDis = leftDiffDis;
|
||||
for (int j = currentIndex-1; j -1 >=0 ;j++){
|
||||
float diff = CoordinateUtils.calculateLineDistance(realLon,realLat,mRoutePoints.get(j).longitude,mRoutePoints.get(j).latitude);
|
||||
Logger.d(M_BUS + "Compare左半边集合", "点:"+j+"------------baseDiffDis = "+baseDiffDis+"---diff="+diff);
|
||||
if (baseDiffDis >= diff){
|
||||
baseDiffDis = diff;
|
||||
currentIndex = j;
|
||||
if (j == 0){
|
||||
latePoints.addAll(mRoutePoints);
|
||||
}
|
||||
}else {
|
||||
latePoints.addAll(mRoutePoints.subList(currentIndex,mRoutePoints.size()-1));
|
||||
return latePoints;
|
||||
}
|
||||
}
|
||||
}else {
|
||||
Logger.d(M_BUS + "正好相等", "点:"+currentIndex+"------------baseDiffDis = "+baseDiffDis+"---diff="+leftDiffDis);
|
||||
latePoints.addAll(mRoutePoints.subList(currentIndex,currentIndex));
|
||||
return latePoints;
|
||||
}
|
||||
}
|
||||
return latePoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* 简单粗暴 直接比较 todo 需要优化
|
||||
* @param mRoutePoints
|
||||
* @param realLon
|
||||
* @param realLat
|
||||
* @return
|
||||
*/
|
||||
public static List<LatLng> getRemainPointListByCompare(List<LatLng> mRoutePoints,double realLon,double realLat) {
|
||||
List<LatLng> latePoints = new ArrayList<>();
|
||||
int currentIndex = 0; //记录疑似点
|
||||
if (mRoutePoints.size() > 0){
|
||||
//基础点
|
||||
LatLng baseLatLng = mRoutePoints.get(0);
|
||||
float baseDiffDis = CoordinateUtils.calculateLineDistance(realLon,realLat
|
||||
,baseLatLng.longitude,baseLatLng.latitude);// lon,lat, prelon, prelat
|
||||
|
||||
for (int i= 1; i < mRoutePoints.size(); i++){
|
||||
LatLng latLng = mRoutePoints.get(i);
|
||||
float diff = CoordinateUtils.calculateLineDistance(realLon,realLat
|
||||
,latLng.longitude,latLng.latitude);
|
||||
if (baseDiffDis > diff){
|
||||
// Logger.d(M_TAXI + "calculateRouteSumLength", "点:"+i+"-------先记录点----- ");
|
||||
baseDiffDis = diff;
|
||||
currentIndex = i;
|
||||
}
|
||||
}
|
||||
Logger.d(M_BUS + "calculateRouteSumLength", "点:"+currentIndex+"-------是最近的点------ ");
|
||||
if (currentIndex == mRoutePoints.size()-1){
|
||||
latePoints.add(mRoutePoints.get(currentIndex));
|
||||
}else {
|
||||
latePoints.addAll(mRoutePoints.subList(currentIndex,mRoutePoints.size()-1));
|
||||
}
|
||||
return latePoints;
|
||||
}
|
||||
return latePoints;
|
||||
}
|
||||
}
|
||||
@@ -222,13 +222,23 @@
|
||||
android:textSize="30sp"
|
||||
app:layout_constraintRight_toRightOf="@id/btnAutopilotDisable"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnAutopilotRunning" />
|
||||
<Button
|
||||
android:id="@+id/btnAutopilotRoute"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#023D35"
|
||||
android:text="上传全路径"
|
||||
android:textSize="30sp"
|
||||
app:layout_constraintRight_toRightOf="@id/btnAutopilotDisable"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnAutopilotArrive" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/groupTestPanel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
app:constraint_referenced_ids="btnAutopilotArrive,btnAutopilotDisable,btnAutopilotEnable,btnAutopilotRunning"
|
||||
app:constraint_referenced_ids="btnAutopilotArrive,btnAutopilotDisable,btnAutopilotEnable
|
||||
,btnAutopilotRunning,btnAutopilotRoute"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<!-- <com.mogo.och.bus.ui.BusTrafficLightView-->
|
||||
|
||||
@@ -88,7 +88,6 @@ public class IdentifyDataDrawer {
|
||||
return;
|
||||
}
|
||||
|
||||
long start = System.currentTimeMillis();
|
||||
//清除缓存
|
||||
for (MessagePad.TrackedObject data : resultList) {
|
||||
if (trafficDataUuidList.size() > 0 && trafficDataUuidList.contains("" + data.getUuid())) {
|
||||
@@ -100,18 +99,13 @@ public class IdentifyDataDrawer {
|
||||
algoCache.remove(uuid);
|
||||
});
|
||||
|
||||
CallerLogger.INSTANCE.d(M_HMI + "arrow48", "origin data size : " + resultList.size());
|
||||
ArrayList<MessagePad.TrackedObject> filterList = filterTrafficData(resultList);
|
||||
|
||||
long cost = System.currentTimeMillis() - start;
|
||||
CallerLogger.INSTANCE.d(M_HMI + "arrow48", "cost : " + cost);
|
||||
|
||||
if (filterList.size() > 0) {
|
||||
// 绘制新数据
|
||||
MogoMarkerManager.getInstance(mContext)
|
||||
.updateBatchMarkerPosition(filterList);
|
||||
}
|
||||
CallerLogger.INSTANCE.d(M_HMI + "arrow48", "mMarkersCaches : " + mMarkersCaches.size());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -158,9 +152,11 @@ public class IdentifyDataDrawer {
|
||||
assert cacheTrackObj != null;
|
||||
if (data.getSpeed() >= 1.5) {
|
||||
double heading = MogoMap.getInstance().getMogoMap().getUIController().getAngle(cacheTrackObj.getLongitude(), cacheTrackObj.getLatitude(), lonLat[0], lonLat[1]);
|
||||
double correct = Math.abs(heading - data.getHeading()) > 30 && Math.abs(heading - data.getHeading()) < 120 ? heading : data.getHeading();//todo test
|
||||
CallerLogger.INSTANCE.d(M_HMI + "type : " + data.getType(), " uuid : " + uuid + " , origin H : " + data.getHeading() + " , cal H : " + heading + ", correct : " + correct + " , 使用滤波角度 : " + (Math.abs(heading - data.getHeading()) > 30 && Math.abs(heading - data.getHeading()) < 120));
|
||||
return data.toBuilder().setHeading(heading).setLongitude(lonLat[0]).setLatitude(lonLat[1]).build();
|
||||
double correct = Math.abs(heading - data.getHeading()) > 30 && Math.abs(heading - data.getHeading()) < 120 ? heading : data.getHeading();//todo test, 需要对每个uuid做航向角缓存
|
||||
if (data.getType() == TrafficTypeEnum.TYPE_TRAFFIC_ID_TA_CHE.getType() || data.getType() == TrafficTypeEnum.TYPE_TRAFFIC_ID_BUS.getType() || data.getType() == TrafficTypeEnum.TYPE_TRAFFIC_ID_TRUCK.getType()) {
|
||||
CallerLogger.INSTANCE.d(M_HMI + "type : " + data.getType(), " uuid : " + uuid + " , origin H : " + data.getHeading() + " , cal H : " + heading + ", correct : " + correct + " , 使用滤波角度 : " + (Math.abs(heading - data.getHeading()) > 30 && Math.abs(heading - data.getHeading()) < 120));
|
||||
}
|
||||
return data.toBuilder().setHeading(correct).setLongitude(lonLat[0]).setLatitude(lonLat[1]).build();
|
||||
} else {
|
||||
return data;
|
||||
}
|
||||
@@ -169,7 +165,7 @@ public class IdentifyDataDrawer {
|
||||
if (AdasRecognizedType.valueFrom(data.getType()) == AdasRecognizedType.classIdTrafficBus || AdasRecognizedType.valueFrom(data.getType()) == AdasRecognizedType.classIdTrafficTruck) {
|
||||
r = 0.00001;
|
||||
}
|
||||
algoCache.put(uuid, new KalmanFilter(data.getLongitude(), data.getLatitude(), r));
|
||||
algoCache.put(uuid, new KalmanFilter(data.getLongitude(), data.getLatitude(), data.getHeading(), r));
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,14 +10,17 @@ public class KalmanFilter {
|
||||
double[][] k = new double[][]{{0.0D, 0.0D}, {0.0D, 0.0D}};
|
||||
int idx = 1;
|
||||
|
||||
public KalmanFilter(double lon, double lat, double r) {
|
||||
double cacheHeading;
|
||||
|
||||
public KalmanFilter(double lon, double lat, double originHeading, double r) {
|
||||
this.xhat[0][0] = lon;
|
||||
this.xhat[0][1] = lat;
|
||||
this.r = r;
|
||||
this.cacheHeading = originHeading;
|
||||
}
|
||||
|
||||
public double[] filter(double lon, double lat) {
|
||||
for(int i = 0; i < 2; ++i) {
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
this.xhatminus[this.idx][i] = this.xhat[1 - this.idx][i];
|
||||
this.pMinus[this.idx][i] = this.p[1 - this.idx][i] + 1.0E-6D;
|
||||
this.k[this.idx][i] = this.pMinus[this.idx][i] / (this.pMinus[this.idx][i] + this.r);
|
||||
@@ -31,4 +34,5 @@ public class KalmanFilter {
|
||||
this.idx = 1 - this.idx;
|
||||
return new double[]{lon1, lat1};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user