This commit is contained in:
zhongchao
2021-04-09 11:49:54 +08:00
75 changed files with 667 additions and 461 deletions

2
.idea/misc.xml generated
View File

@@ -8,7 +8,7 @@
<asm skipDebug="false" skipFrames="false" skipCode="false" expandFrames="false" />
<groovy codeStyle="LEGACY" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="JDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
</project>

View File

@@ -75,6 +75,7 @@ class OchBusOrderModel {
/**
* 站点信息变更推送
* 新订单、取消订单、到达站点等都会导致停靠站点变更,故都会收到此推送
*/
private IMogoOnMessageListener< OchBusStationsChangedMsg > mOnBusStationsChangedMsg = new IMogoOnMessageListener< OchBusStationsChangedMsg >() {
@Override

View File

@@ -71,7 +71,7 @@ public class OchBusPresenter extends Presenter< OchBusFragment > implements IMog
private IOchBusApiService mService;
/**
* 运营状态
* 运营状态、后端更具运营状态来判断车辆是否派单
*/
private boolean mIsWorking = false;
@@ -104,8 +104,8 @@ public class OchBusPresenter extends Presenter< OchBusFragment > implements IMog
double lat = 40.1974932972;
double lon = 116.7354579447;
// lat = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat();
// lon = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon();
lat = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat();
lon = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon();
OchBusRoutesRequest request = new OchBusRoutesRequest( Utils.getSn(), lat, lon );
RequestBody requestBody = RequestBody.create( MediaType.get( "application/json;charset=UTF-8" ), GsonUtil.jsonFromObject( request ) );
@@ -171,7 +171,6 @@ public class OchBusPresenter extends Presenter< OchBusFragment > implements IMog
if ( isGoingToNextStation ) {
mView.hideSlidePanel();
mView.hideNotice();
}
resetNextStopStation( lastStopStation );
@@ -216,10 +215,16 @@ public class OchBusPresenter extends Presenter< OchBusFragment > implements IMog
return nextStationIndex;
}
/**
* 延时查询站点信心
*/
private void queryBusStationDelay() {
handler.sendEmptyMessageDelayed( MSG_QUERY_BUS_STATION, QUERY_BUS_STATION_DELAY );
}
/**
* 在踩刹车、控制方向盘等操作后,会停止自动加水,重启自动驾驶的话相当于重新设置自动驾驶目的地
*/
public void restartAutopilot() {
Logger.d( TAG, "重启自动驾驶===" + isGoingToNextStation );
if ( isGoingToNextStation ) {
@@ -228,7 +233,7 @@ public class OchBusPresenter extends Presenter< OchBusFragment > implements IMog
}
/**
* 测试
* 测试、重置站点状态
*/
public void debugResetStationStatus() {
OchBusResetRequest request = new OchBusResetRequest( Utils.getSn(), 1 );
@@ -294,7 +299,6 @@ public class OchBusPresenter extends Presenter< OchBusFragment > implements IMog
if ( mView != null ) {
mView.refreshBusStations( stationList, currentStationIndex, nextStationIndex );
mView.hideSlidePanel();
mView.hideNotice();
}
if ( isGoingToNextStation ) {
@@ -403,14 +407,20 @@ public class OchBusPresenter extends Presenter< OchBusFragment > implements IMog
} );
}
/**
* 播报下车乘客信息
*
* @param o
*/
private void playLeavePassengersMsg( QueryLeaveAwayPassengersResponse o ) {
if ( currentStationIndex > stationList.size() - 1 ) {
return;
}
String station = stationList.get( currentStationIndex ).getSiteName();
StringBuilder builder = new StringBuilder( "已到达" );
if ( station.endsWith( "" ) ) {
builder.append( station );
builder.append( station );
if ( !station.endsWith( "" ) ) {
builder.append( "" );
}
if ( o == null || o.result == null || o.result.info == null || o.result.info.isEmpty() ) {
//

View File

@@ -84,6 +84,8 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
} else {
flatMode();
}
// 出租车不需要开启按钮
tvOperationStatus.setVisibility(View.GONE);
}
private void initListeners() {

View File

@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="@dimen/module_och_taxi_panel_width"
android:layout_height="@dimen/module_och_taxi_panel_height"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/module_och_taxi_panel_bkg"
android:orientation="vertical">
@@ -49,18 +50,18 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5px"
android:text="后路站"
android:textColor="@color/module_och_order_status_textColor"
android:textSize="@dimen/module_och_taxi_order_start_station_textSize"
android:textStyle="bold"
app:layout_constraintLeft_toRightOf="@+id/greenDot"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
tools:text="后路站" />
<TextView
android:id="@+id/module_och_taxi_order_start_station_anchor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="上车站点"
android:text="上车"
android:textColor="@color/module_och_taxi_order_start_station_anchor_textColor"
android:textSize="@dimen/module_och_taxi_order_start_station_anchor_textSize"
android:textStyle="bold"
@@ -71,10 +72,11 @@
<ImageView
android:id="@+id/dotLine"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="0dp"
android:src="@drawable/module_och_taxi_dot_line"
app:layout_constraintLeft_toLeftOf="@+id/greenDot"
app:layout_constraintRight_toRightOf="@+id/greenDot"
app:layout_constraintBottom_toTopOf="@+id/blueDot"
app:layout_constraintTop_toBottomOf="@+id/greenDot" />
<ImageView
@@ -90,20 +92,20 @@
android:id="@+id/module_och_taxi_order_end_station"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="后路站1"
android:textColor="@color/module_och_order_status_textColor"
android:textSize="@dimen/module_och_taxi_order_start_station_textSize"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="@+id/module_och_taxi_order_start_station"
app:layout_constraintLeft_toRightOf="@+id/greenDot" />
app:layout_constraintLeft_toRightOf="@+id/greenDot"
tools:text="后路站1" />
<TextView
android:id="@+id/module_och_taxi_order_end_station_anchor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="下车站点"
android:text="下车"
android:textColor="@color/module_och_taxi_order_end_station_anchor_textColor"
android:textSize="@dimen/module_och_taxi_order_end_station_anchor_textSize"
android:textStyle="bold"

View File

@@ -2,25 +2,25 @@
<resources>
<dimen name="module_och_taxi_panel_width">464px</dimen>
<dimen name="module_och_taxi_panel_height">310px</dimen>
<dimen name="module_och_taxi_order_status_marginLeft">30px</dimen>
<dimen name="module_och_taxi_order_status_marginTop">24px</dimen>
<dimen name="module_och_taxi_order_status_textSize">24px</dimen>
<dimen name="module_och_taxi_order_status_marginLeft">20px</dimen>
<dimen name="module_och_taxi_order_status_marginTop">20px</dimen>
<dimen name="module_och_taxi_order_status_textSize">20px</dimen>
<dimen name="module_och_taxi_order_status_divider_height">1px</dimen>
<dimen name="module_och_taxi_order_status_divider_marginLeft">30px</dimen>
<dimen name="module_och_taxi_order_status_divider_marginTop">23px</dimen>
<dimen name="module_och_taxi_order_status_divider_marginRight">30px</dimen>
<dimen name="module_och_taxi_order_status_stationInfo_height">146px</dimen>
<dimen name="module_och_taxi_order_status_stationInfo_paddingLeft">30px</dimen>
<dimen name="module_och_taxi_order_status_stationInfo_paddingTop">23px</dimen>
<dimen name="module_och_taxi_order_status_stationInfo_paddingRight">30px</dimen>
<dimen name="module_och_taxi_order_status_stationInfo_paddingBottom">23px</dimen>
<dimen name="module_och_taxi_order_status_divider_marginLeft">20px</dimen>
<dimen name="module_och_taxi_order_status_divider_marginTop">20px</dimen>
<dimen name="module_och_taxi_order_status_divider_marginRight">20px</dimen>
<dimen name="module_och_taxi_order_status_stationInfo_height">140px</dimen>
<dimen name="module_och_taxi_order_status_stationInfo_paddingLeft">20px</dimen>
<dimen name="module_och_taxi_order_status_stationInfo_paddingTop">20px</dimen>
<dimen name="module_och_taxi_order_status_stationInfo_paddingRight">17px</dimen>
<dimen name="module_och_taxi_order_status_stationInfo_paddingBottom">20px</dimen>
<dimen name="module_och_taxi_order_start_station_textSize">26px</dimen>
<dimen name="module_och_taxi_order_start_station_anchor_textSize">20px</dimen>
<dimen name="module_och_taxi_order_end_station_anchor_textSize">20px</dimen>
<dimen name="module_och_taxi_order_distance_container_height">80px</dimen>
<dimen name="module_och_taxi_order_distance_container_height">64px</dimen>
<dimen name="module_och_taxi_order_distance_container_marginLeft">3px</dimen>
<dimen name="module_och_taxi_order_distance_anchor_marginLeft">27px</dimen>
<dimen name="module_och_taxi_order_distance_anchor_marginLeft">20px</dimen>
<dimen name="module_och_taxi_order_distance_anchor_textSize">20px</dimen>
<dimen name="module_och_taxi_order_distance_textSize">28px</dimen>
<dimen name="module_och_taxi_order_distance_marginRight">27px</dimen>
<dimen name="module_och_taxi_order_distance_textSize">24px</dimen>
<dimen name="module_och_taxi_order_distance_marginRight">17px</dimen>
</resources>

View File

@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="module_och_order_status_textColor">#FFFFFF</color>
<color name="module_och_taxi_order_status_divider_bkgColor">#4D151B37</color>
<color name="module_och_taxi_order_status_divider_bkgColor">#707DBE</color>
<color name="module_och_taxi_order_start_station_anchor_textColor">#8198E8</color>
<color name="module_och_taxi_order_end_station_anchor_textColor">#8198E8</color>
<color name="module_och_taxi_order_distance_anchor_textColor">#8198E8</color>
<color name="module_och_taxi_order_distance_textColor">#1FA7FF</color>
<color name="module_och_taxi_order_distance_textColor">#FFFFFF</color>
</resources>

View File

@@ -2,25 +2,25 @@
<resources>
<dimen name="module_och_taxi_panel_width">464px</dimen>
<dimen name="module_och_taxi_panel_height">310px</dimen>
<dimen name="module_och_taxi_order_status_marginLeft">30px</dimen>
<dimen name="module_och_taxi_order_status_marginTop">24px</dimen>
<dimen name="module_och_taxi_order_status_textSize">24px</dimen>
<dimen name="module_och_taxi_order_status_marginLeft">20px</dimen>
<dimen name="module_och_taxi_order_status_marginTop">20px</dimen>
<dimen name="module_och_taxi_order_status_textSize">20px</dimen>
<dimen name="module_och_taxi_order_status_divider_height">1px</dimen>
<dimen name="module_och_taxi_order_status_divider_marginLeft">30px</dimen>
<dimen name="module_och_taxi_order_status_divider_marginTop">23px</dimen>
<dimen name="module_och_taxi_order_status_divider_marginRight">30px</dimen>
<dimen name="module_och_taxi_order_status_stationInfo_height">146px</dimen>
<dimen name="module_och_taxi_order_status_stationInfo_paddingLeft">30px</dimen>
<dimen name="module_och_taxi_order_status_stationInfo_paddingTop">23px</dimen>
<dimen name="module_och_taxi_order_status_stationInfo_paddingRight">30px</dimen>
<dimen name="module_och_taxi_order_status_stationInfo_paddingBottom">23px</dimen>
<dimen name="module_och_taxi_order_status_divider_marginLeft">20px</dimen>
<dimen name="module_och_taxi_order_status_divider_marginTop">20px</dimen>
<dimen name="module_och_taxi_order_status_divider_marginRight">20px</dimen>
<dimen name="module_och_taxi_order_status_stationInfo_height">140px</dimen>
<dimen name="module_och_taxi_order_status_stationInfo_paddingLeft">20px</dimen>
<dimen name="module_och_taxi_order_status_stationInfo_paddingTop">20px</dimen>
<dimen name="module_och_taxi_order_status_stationInfo_paddingRight">17px</dimen>
<dimen name="module_och_taxi_order_status_stationInfo_paddingBottom">20px</dimen>
<dimen name="module_och_taxi_order_start_station_textSize">26px</dimen>
<dimen name="module_och_taxi_order_start_station_anchor_textSize">20px</dimen>
<dimen name="module_och_taxi_order_end_station_anchor_textSize">20px</dimen>
<dimen name="module_och_taxi_order_distance_container_height">80px</dimen>
<dimen name="module_och_taxi_order_distance_container_height">64px</dimen>
<dimen name="module_och_taxi_order_distance_container_marginLeft">3px</dimen>
<dimen name="module_och_taxi_order_distance_anchor_marginLeft">27px</dimen>
<dimen name="module_och_taxi_order_distance_anchor_marginLeft">20px</dimen>
<dimen name="module_och_taxi_order_distance_anchor_textSize">20px</dimen>
<dimen name="module_och_taxi_order_distance_textSize">28px</dimen>
<dimen name="module_och_taxi_order_distance_marginRight">27px</dimen>
<dimen name="module_och_taxi_order_distance_textSize">24px</dimen>
<dimen name="module_och_taxi_order_distance_marginRight">17px</dimen>
</resources>

View File

@@ -7,9 +7,9 @@
<string name="module_och_taxi_order_distance_text_ph">3.2 km</string>
<string name="module_och_taxi_order_complete">请携带好随身物品,注意侧后\n方来车感谢体验蘑菇智行自\n动驾驶车</string>
<string name="module_och_taxi_on_the_way_2_end_station">去往下车地点</string>
<string name="module_och_taxi_waiting">已到达上车地点,等待乘客上车</string>
<string name="module_och_taxi_new_order">收到新订单,正在前往上车地点</string>
<string name="module_och_taxi_arrive_at_end_station2">已到达乘客下车地点</string>
<string name="module_och_taxi_waiting">已到达,等待乘客上车</string>
<string name="module_och_taxi_new_order">收到新订单,前往上车地点</string>
<string name="module_och_taxi_arrive_at_end_station2">已到达下车地点</string>
<string name="module_och_taxi_order_completed">订单已完成</string>
<string name="module_och_taxi_order_cancel">订单已取消</string>
</resources>

View File

@@ -32,13 +32,10 @@ public abstract class BaseOchFragment<V extends IView, P extends Presenter<V>> e
private static final String TAG = "BaseOchFragment";
protected SlidePanelView slidePanelView;
private View tvNoticeContainer;
private TextView tvNotice;
private CheckedTextView ctvAutopilotStatus;
protected TextView tvOperationStatus;
private FrameLayout flStationPanelContainer;
private FrameAnimImageView fivNoticeHead;
private final SlidePanelView.OnSlidePanelMoveToEndListener onSlideToEndListener = () -> {
// 此处做一个代理,处理一下共有情况
@@ -55,17 +52,13 @@ public abstract class BaseOchFragment<V extends IView, P extends Presenter<V>> e
@Override
protected void initViews() {
slidePanelView = findViewById(R.id.module_mogo_och_slide_panel);
tvNoticeContainer = findViewById(R.id.module_mogo_och_notice_container);
tvNotice = findViewById(R.id.module_mogo_och_notice);
ctvAutopilotStatus = findViewById(R.id.module_mogo_och_autopilot_status);
flStationPanelContainer = findViewById(R.id.module_mogo_och_station_panel_container);
fivNoticeHead = findViewById(R.id.module_mogo_och_notice_head);
tvOperationStatus = findViewById( R.id.module_mogo_och_operation_status );
panelView = LayoutInflater.from(getContext()).inflate(getStationPanelViewId(), flStationPanelContainer);
slidePanelView.setOnSlidePanelMoveToEndListener(onSlideToEndListener);
fivNoticeHead.setAnimRes(sHappy1);
ctvAutopilotStatus.setOnClickListener(new OnPreventFastClickListener() {
@Override
@@ -123,19 +116,7 @@ public abstract class BaseOchFragment<V extends IView, P extends Presenter<V>> e
public void showNotice(String notice) {
getActivity().runOnUiThread(() -> {
tvNotice.setText(notice);
AIAssist.getInstance(getContext()).speakTTSVoice(notice);
tvNoticeContainer.setVisibility(View.VISIBLE);
fivNoticeHead.setVisibility(View.VISIBLE);
fivNoticeHead.startAnim();
});
}
public void hideNotice() {
getActivity().runOnUiThread(() -> {
tvNoticeContainer.setVisibility(View.GONE);
fivNoticeHead.setVisibility(View.GONE);
fivNoticeHead.stopAnim();
});
}
@@ -196,35 +177,5 @@ public abstract class BaseOchFragment<V extends IView, P extends Presenter<V>> e
*/
public abstract void restartAutopilot();
private final int[] sHappy1 = {
R.drawable.ic_happy1_00000,
R.drawable.ic_happy1_00001,
R.drawable.ic_happy1_00002,
R.drawable.ic_happy1_00003,
R.drawable.ic_happy1_00004,
R.drawable.ic_happy1_00005,
R.drawable.ic_happy1_00006,
R.drawable.ic_happy1_00007,
R.drawable.ic_happy1_00008,
R.drawable.ic_happy1_00009,
R.drawable.ic_happy1_00010,
R.drawable.ic_happy1_00011,
R.drawable.ic_happy1_00012,
R.drawable.ic_happy1_00013,
R.drawable.ic_happy1_00014,
R.drawable.ic_happy1_00015,
R.drawable.ic_happy1_00016,
R.drawable.ic_happy1_00017,
R.drawable.ic_happy1_00018,
R.drawable.ic_happy1_00019,
R.drawable.ic_happy1_00020,
R.drawable.ic_happy1_00021,
R.drawable.ic_happy1_00022,
R.drawable.ic_happy1_00023,
R.drawable.ic_happy1_00024,
R.drawable.ic_happy1_00025,
R.drawable.ic_happy1_00026,
R.drawable.ic_happy1_00027,
R.drawable.ic_happy1_00028
};
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

View File

@@ -57,40 +57,6 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
<FrameLayout
android:id="@+id/module_mogo_och_notice_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/module_mogo_och_base_notice_box_bg"
android:visibility="gone"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible">
<TextView
android:id="@+id/module_mogo_och_notice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:lineSpacingExtra="5px"
android:maxWidth="@dimen/module_mogo_och_notice_text_max_width"
android:text="请携带好随身物品\n注意侧后方来车\n感谢体验蘑菇智行自动驾驶车"
android:textColor="#fff"
android:textSize="@dimen/module_mogo_och_notice_text_size"
android:textStyle="bold" />
</FrameLayout>
<com.mogo.och.view.FrameAnimImageView
android:id="@+id/module_mogo_och_notice_head"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="185px"
android:src="@drawable/ic_happy1_00000"
android:visibility="gone"
app:layout_constraintRight_toRightOf="@id/module_mogo_och_notice_container"
app:layout_constraintTop_toTopOf="@id/module_mogo_och_notice_container" />
<Button
android:id="@+id/btnAutopilotDisable"
android:layout_width="wrap_content"

View File

@@ -145,7 +145,7 @@ MOGO_OCH_TAXI_VERSION=1.0.0
######## 外部依赖引用
# 车聊聊
CARCHATTING_VERSION=2.2.311
CARCHATTING_VERSION=2.2.318
# 车聊聊接口
CARCHATTINGPROVIDER_VERSION=1.1.11
# websocket

View File

@@ -197,7 +197,6 @@ public class AMapWrapper implements IMogoMap {
@Override
public void showIndoorMap(boolean enable) {
if (checkAMap()) {
// TODO: 2020/5/27 显示室内地图
// mAMap.showIndoorMap( enable );
}
}
@@ -212,7 +211,6 @@ public class AMapWrapper implements IMogoMap {
@Override
public void stopAnimation() {
if (checkAMap()) {
// TODO: 2020/5/27 停止当前执行的改变地图状态的动画。
// mAMap.stopAnimation();
}
}

View File

@@ -19,10 +19,15 @@ class DataTypes {
public static final String TYPE_MARKER_CLOUD_DATA = "TYPE_MARKER_CLOUD_DATA";
/**
* 云端下发数据
* 云端下发警告数据
*/
public static final String TYPE_MARKER_CLOUD_WARN_DATA = "TYPE_MARKER_CLOUD_WARN_DATA";
/**
* 云端下发停止线数据
*/
public static final String TYPE_MARKER_CLOUD_STOP_LINE_DATA = "TYPE_MARKER_CLOUD_STOP_LINE_DATA";
/**
* Push 事件场景 VR
*/

View File

@@ -290,7 +290,6 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
marker.setPosition( cloudRoadData.getWgslat(), cloudRoadData.getWgslon() );
}
// TODO: 2021/3/23 后端算法提供显示颜色
marker.setAnchorColor( getModelRenderColor( cloudRoadData.getType(), cloudRoadData.getSpeed(), cloudRoadData.getWgslon(), cloudRoadData.getWgslat(), cloudRoadData.getHeading() ) );
if ( shouldShowSpeed( cloudRoadData.getType() ) ) {
@@ -371,7 +370,6 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
String resIdVal = null;
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
options.set3DMode( true );
// TODO: 2021/3/23 后端算法提供显示颜色
options.anchorColor( getModelRenderColor( data.getType(), data.getSpeed(), data.getWgslon(), data.getWgslat(), data.getHeading() ) );
int resId = getModelRes( data.getType() );
resIdVal = resId + "";

View File

@@ -14,9 +14,9 @@ import com.mogo.module.common.entity.V2XWarningEntity;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.StatusDescriptor;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.WorkThreadHandler;
import com.mogo.utils.logger.Logger;
import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_STOP_LINE_DATA;
import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_WARN_DATA;
@@ -26,9 +26,7 @@ import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_WARN_
public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedListener {
private static final String TAG = "V2XWarnDataDrawer";
private static volatile V2XWarnDataDrawer sInstance;
private boolean mChangeCarModeStatus;
private V2XWarnDataDrawer() {
@@ -59,8 +57,6 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
Logger.d(TAG, "%s - %s", descriptor, isTrue);
mChangeCarModeStatus = true;
AdasRecognizedResultDrawer.getInstance().notifyVrModeChanged();
}
public boolean isVrMode() {
@@ -69,34 +65,33 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
/**
* 绘制行人和二轮车
* 绘制行人和二轮车,前方和左右
*
* @param data
*/
public void renderWarnData(V2XWarningEntity data) {
MarkerLocation location = new MarkerLocation();
location.setLat(data.getLat());
location.setLon(data.getLon());
location.setLat(data.getDirection() == 1 ? data.getStopLines().get(0).lat : data.getLat());
location.setLon(data.getDirection() == 1 ? data.getStopLines().get(0).lon : data.getLon());
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
markerShowEntity.setMarkerLocation(location);
markerShowEntity.setMarkerType(TYPE_MARKER_CLOUD_WARN_DATA);
WorkThreadHandler.getInstance().postDelayed(() -> {
IMogoMarker marker = drawMarker(markerShowEntity);
Log.d("liyz", "renderWarnData marker != null ");
marker.addDynamicAnchorPosition(new MogoLatLng(data.getCollisionLat(), data.getCollisionLon()), (float) data.getHeading(), 5000);
//移动完成以后3s后消失
UiThreadHandler.postDelayed( () -> {
marker.remove();
}, 8000 );
}, 0);
IMogoMarker marker = drawMarker(markerShowEntity);
Log.d("liyz", "renderWarnData marker != null direction = " + data.getDirection());
marker.addDynamicAnchorPosition(new MogoLatLng(
data.getDirection() == 1 ? data.getStopLines().get(1).lat : data.getCollisionLat(),
data.getDirection() == 1 ? data.getStopLines().get(1).lon : data.getCollisionLon()), (float) data.getHeading(), 5000);
//移动完成以后3s后消失
UiThreadHandler.postDelayed(() -> {
marker.remove();
}, 8000);
}
public IMogoMarker drawMarker(MarkerShowEntity markerShowEntity) {
MogoMarkerOptions options = new MogoMarkerOptions()
.object(markerShowEntity)
@@ -105,8 +100,7 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
options.icon3DRes(getModelRes(2)); //TODO
// options.anchorColor("#FF4040");
options.anchorColor("#FF3036"); //红色
options.anchorColor("#FB3C3CFF"); //红色#FF3036 蓝色:#256BFF
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerShowEntity.getMarkerType(), options);
iMarkerView.setMarker(marker);
marker.setToTop();
@@ -114,4 +108,44 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
return marker;
}
/**
* 绘制停止线 marker
*
* @param data
*/
public void renderStopLineData(V2XWarningEntity data) {
MarkerLocation location = new MarkerLocation();
location.setLat(data.getLat());
location.setLon(data.getLon());
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
markerShowEntity.setMarkerLocation(location);
markerShowEntity.setMarkerType(TYPE_MARKER_CLOUD_STOP_LINE_DATA);
IMogoMarker marker = drawStopLineMarker(markerShowEntity);
//移动完成以后3s后消失
UiThreadHandler.postDelayed(() -> {
marker.remove();
}, 8000);
}
public IMogoMarker drawStopLineMarker(MarkerShowEntity markerShowEntity) {
MogoMarkerOptions options = new MogoMarkerOptions()
.object(markerShowEntity)
.latitude(markerShowEntity.getMarkerLocation().getLat())
.longitude(markerShowEntity.getMarkerLocation().getLon());
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
options.icon3DRes(getModelRes(1)); //TODO
options.anchorColor("#FB3C3CFF"); //红色#FF3036 蓝色:#256BFF
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerShowEntity.getMarkerType(), options);
iMarkerView.setMarker(marker);
marker.setToTop();
return marker;
}
}

View File

@@ -1332,9 +1332,9 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
public void onCarLocationChanged2(Location location) {
vrModeNavInfoView.refreshCurrentSpeed((int) (location.getSpeed() * 3.6F));
int speed = (int) (location.getSpeed() * 3.6F);
mouduleArc.setArcColor(Color.parseColor(speed > 40 ? "#DB3137" : "#3E77F6"));
mouduleArc.setArcColor(Color.parseColor(speed > 60 ? "#DB3137" : "#3E77F6"));
mouduleArc.setValues(speed);
flSpeed.setBackgroundResource(speed > 40 ? R.drawable.yi_biao_pan_bg_speeding : R.drawable.yi_biao_pan_bg_nor);
flSpeed.setBackgroundResource(speed > 60 ? R.drawable.yi_biao_pan_bg_speeding : R.drawable.yi_biao_pan_bg_nor);
}
@Override

View File

@@ -52,8 +52,7 @@ public class TopView extends FrameLayout {
originX = ev.getY();
} else if (ev.getAction() == MotionEvent.ACTION_MOVE) {
// 垂直滑动,事件拦截
return Math.abs(originY - ev.getY()) > ViewConfiguration.get(getContext()).getScaledTouchSlop()
||Math.abs(originX - ev.getX()) > ViewConfiguration.get(getContext()).getScaledTouchSlop();
return Math.abs(originY - ev.getY()) > ViewConfiguration.get(getContext()).getScaledTouchSlop();
}
return false;
}

View File

@@ -48,6 +48,7 @@ import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
import com.mogo.utils.storage.SharedPrefsMgr;
import org.json.JSONArray;
import org.json.JSONObject;
import java.io.BufferedReader;
@@ -849,8 +850,16 @@ public class MockIntentHandler implements IntentHandler {
}
}
AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult( allList );
AdasRec adasRec = new AdasRec();
adasRec.models = allList;
MogoApisHandler.getInstance().getApis().getAdasControllerApi().mockAdasRecognized( GsonUtil.jsonFromObject( adasRec ) );
Log.i( "mock-timer-adas", "cost " + ( System.currentTimeMillis() - start ) + "ms" );
return true;
}
public static class AdasRec{
public String action = "view";
public List<ADASRecognizedResult> models;
}
}

View File

@@ -198,7 +198,7 @@ public class CarIconDisplayStrategy {
new MogoMarkerOptions()
.icons(mBitmapFrames)
.period(1)
.zIndex(1000)
.zIndex(0)
.autoManager(false)
.anchor(0.5f, 0.5f)
.position(MarkerServiceHandler.getMapService().getNavi(AbsMogoApplication.getApp()).getCarLocation2()));

View File

@@ -43,6 +43,13 @@ public class MoGoV2XServicePaths {
@Keep
public static final String PATH_V2X_PERSON_WARN_POLYLINE_MANAGER = "/v2xPersonWarnPolylineManager/api";
/**
* V2X 停止线连接线
*/
@Keep
public static final String PATH_V2X_STOP_POLYLINE_MANAGER = "/v2xStopPolylineManager/api";
/**
* V2X 云端数据处理
*/

View File

@@ -17,6 +17,7 @@ import com.mogo.module.common.drawer.AdasRecognizedResultDrawer;
import com.mogo.module.service.MarkerServiceHandler;
import com.mogo.module.v2x.alarm.V2XCalculateServer;
import com.mogo.module.v2x.manager.IMoGoPersonWarnPolylineManager;
import com.mogo.module.v2x.manager.IMoGoStopPolylineManager;
import com.mogo.module.v2x.manager.IMoGoV2XCloundDataManager;
import com.mogo.module.v2x.manager.IMoGoV2XMarkerManager;
import com.mogo.module.v2x.manager.IMoGoV2XPolylineManager;
@@ -114,6 +115,7 @@ public class V2XServiceManager {
private static IMoGoV2XStatusManager moGoV2XStatusManager;
private static IMoGoWarnPolylineManager moGoWarnPolylineManager;
private static IMoGoPersonWarnPolylineManager moGoPersonWarnPolylineManager;
private static IMoGoStopPolylineManager moGoStopPolylineManager;
private static IMoGoV2XCloundDataManager moGoV2XCloundDataManager;
private V2XServiceManager() {
@@ -170,6 +172,7 @@ public class V2XServiceManager {
moGoWarnPolylineManager = (IMoGoWarnPolylineManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_WARN_POLYLINE_MANAGER).navigation(context);
moGoV2XCloundDataManager = (IMoGoV2XCloundDataManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_WARN_CLOUND_DATA_MANAGER).navigation(context);
moGoPersonWarnPolylineManager = (IMoGoPersonWarnPolylineManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_PERSON_WARN_POLYLINE_MANAGER).navigation(context);
moGoStopPolylineManager = (IMoGoStopPolylineManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_STOP_POLYLINE_MANAGER).navigation(context);
moGoV2XStatusManager = (IMoGoV2XStatusManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_STATUS_MANAGER).navigation(context);
}
@@ -351,4 +354,11 @@ public class V2XServiceManager {
V2XServiceManager.moGoPersonWarnPolylineManager = moGoPersonWarnPolylineManager;
}
public static IMoGoStopPolylineManager getMoGoStopPolylineManager() {
return moGoStopPolylineManager;
}
public static void setMoGoStopPolylineManager(IMoGoStopPolylineManager moGoStopPolylineManager) {
V2XServiceManager.moGoStopPolylineManager = moGoStopPolylineManager;
}
}

View File

@@ -138,27 +138,8 @@ public class V2XWaringManager {
// info1.setHeading(10);
// info1.setStartLocation(startLatlng1);
// info1.setEndLocation(endLatlng1);
//
// //只有在3d模型下高精数据才有值 TODO
// if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
// float roadWidth = V2XServiceManager.getMapUIController().getRoadWidth(116.411198243370,
// 39.9809517154582, (float) 3.13919341919472 , true, true);
// Log.d(V2XConst.LOG_NAME_WARN, "roadWidth = " + roadWidth);
// float pixel = V2XServiceManager.getMapUIController().getScalePerPixel();
// float width = roadWidth / pixel;
// Log.d(V2XConst.LOG_NAME_WARN, "width = " + width + "---pixel = " + pixel);
// info1.setWidth(roadWidth);
// }
//
// V2XServiceManager.getMoGoWarnPolylineManager().drawWarnPolyline(getContext(), info1);
//
// //延迟3秒清理线
// UiThreadHandler.postDelayed( () -> {
// V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
// }, 3000 );
// adas 每隔一秒传递的他车或行人数据
// adas 每隔一秒传递的他车或行人数据,避免重复
// V2XServiceManager.getmIMogoADASController().addAdasRecognizedDataCallback(resultList -> {
// // 绘制近景识别到的车辆,行人和二轮车
// AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult( resultList );
@@ -185,6 +166,7 @@ public class V2XWaringManager {
// } );
//
//adas自车定位
// MogoApisHandler.getInstance().getApis().getMapServiceApi().getSingletonLocationClient().getLastKnowLocation()
// double lon = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon();
// double lat = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat();
}

View File

@@ -143,6 +143,7 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
private MogoImageView ivEvent;
private TextView tvEvent;
private ImageView ivPlay;
private TextView tvLine;
private TextView tvPlay;
@@ -163,6 +164,7 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
ivEvent = itemView.findViewById(R.id.iv_event);
tvEvent = itemView.findViewById(R.id.tv_event);
ivPlay = itemView.findViewById(R.id.iv_play);
tvLine = itemView.findViewById(R.id.tv_line);
tvPlay = itemView.findViewById(R.id.tv_play);
}
@@ -248,6 +250,7 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
ivEventImg.setOnClickListener(v -> {
showRoadVideoInfo(v2XEventShowEntity);
});
ivPlay.setVisibility(VISIBLE);
tvLine.setVisibility(VISIBLE);
tvPlay.setVisibility(VISIBLE);
tvPlay.setOnClickListener(v -> {
@@ -261,6 +264,7 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
ivEventImg.setOnClickListener(null);
ivEventPlay.setOnClickListener(null);
ivEventPlay.setVisibility(GONE);
ivPlay.setVisibility(GONE);
tvLine.setVisibility(GONE);
tvPlay.setVisibility(GONE);
}
@@ -279,11 +283,11 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
}
ivEvent.setImageResource(EventTypeUtils.getPoiTypeSrcVr(mNoveltyInfo.getPoiType()));
tvEvent.setText(EventTypeUtils.getPoiTypeStrVr(mNoveltyInfo.getPoiType()));
if (mNoveltyInfo.getPoiType() == V2XPoiTypeEnum.FOURS_FOG) {
if (V2XPoiTypeEnum.FOURS_FOG.equals(mNoveltyInfo.getPoiType())) {
V2XServiceManager.getDisplayEffectsManager().displayEffects(V2XPoiTypeEnum.FOURS_FOG);
// MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(ALERT_THE_FRONT_CRASH_WARNING_TOP, MogoReceiver.ACTION_V2X_FRONT_WARNING);
}
tvEventAddress.setText(mNoveltyInfo.getAddr());
tvEventAddress.setText(mNoveltyInfo.getAddr());
tvEventDistance.setText("距离 " + (int) mNoveltyInfo.getDistance() + "");
Calendar c = Calendar.getInstance();

View File

@@ -1,6 +1,5 @@
package com.mogo.module.v2x.entity.model;
import com.mogo.map.MogoLatLng;
@@ -22,6 +21,8 @@ public class DrawLineInfo {
private float width;
private int direction;
public String getType() {
return type;
}
@@ -61,4 +62,12 @@ public class DrawLineInfo {
public void setWidth(float width) {
this.width = width;
}
public int getDirection() {
return direction;
}
public void setDirection(int direction) {
this.direction = direction;
}
}

View File

@@ -0,0 +1,27 @@
package com.mogo.module.v2x.manager;
import android.content.Context;
import com.alibaba.android.arouter.facade.template.IProvider;
import com.mogo.map.overlay.IMogoPolyline;
import com.mogo.module.v2x.entity.model.DrawLineInfo;
/**
* 绘制可变宽度和渐变的线
*/
public interface IMoGoStopPolylineManager extends IProvider {
/**
* 绘制连接线,目标车,与当前车辆间连线
*
* @param context
* @param info
*/
void drawStopPolyline(Context context, DrawLineInfo info);
/**
* 移除连接线
*/
void clearLine();
IMogoPolyline getMogoStopPolyline();
}

View File

@@ -39,26 +39,12 @@ public class MoGoPersonWarnPolylineManager implements IMoGoPersonWarnPolylineMan
// 渐变色
List<Integer> colors = new ArrayList<>();
// if (info.getType() != null) {
// if (info.getType().equals("1")) { //预警 TODO
// colors.add(0xFFFFA31A);
// colors.add(0xFFFFA31A);
// } else {
// colors.add(0xFFE32F46);
// colors.add(0xFFE32F46);
// }
// } else {
// colors.add(0xFFE32F46);
// colors.add(0xFFE32F46);
// }
colors.add(0xFFE32F46);
colors.add(0xFFE32F46);
// 线条粗细,渐变,渐变色值
Log.d(V2XConst.LOG_NAME_WARN, "MoGoPersonWarnPolylineManager width = " + info.getWidth());
options.width(info.getWidth()).useGradient(true).transparency(0.1f).colorValues(colors);
Log.d(V2XConst.LOG_NAME_WARN, "MoGoPersonWarnPolylineManager width = " + info.getWidth());
options.width(info.getWidth()).useGradient(true).colorValues(colors);
// 当前车辆位置
options.add(info.getStartLocation());
// 目标车辆位置
@@ -66,7 +52,7 @@ public class MoGoPersonWarnPolylineManager implements IMoGoPersonWarnPolylineMan
// 绘制线的对象
mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options);
mMogoPolyline.setTransparency(0.5f);
} catch (Exception e) {
e.printStackTrace();
}

View File

@@ -0,0 +1,79 @@
package com.mogo.module.v2x.manager.impl;
import android.content.Context;
import android.util.Log;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.map.overlay.IMogoPolyline;
import com.mogo.map.overlay.MogoPolylineOptions;
import com.mogo.module.v2x.MoGoV2XServicePaths;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.entity.model.DrawLineInfo;
import com.mogo.module.v2x.manager.IMoGoStopPolylineManager;
import com.mogo.module.v2x.manager.IMoGoWarnPolylineManager;
import java.util.ArrayList;
import java.util.List;
/**
* 当前车辆与道路事件的连接线
*/
@Route(path = MoGoV2XServicePaths.PATH_V2X_STOP_POLYLINE_MANAGER)
public class MoGoStopPolylineManager implements IMoGoStopPolylineManager {
private static IMogoPolyline mMogoPolyline;
@Override
public void drawStopPolyline(Context context, DrawLineInfo info) {
if (info == null) {
return;
}
try {
if (mMogoPolyline != null) {
mMogoPolyline.remove();
}
// 连接线参数
MogoPolylineOptions options = new MogoPolylineOptions();
List<Integer> colors = new ArrayList<>();
colors.add(0xFFE32F46);
colors.add(0xFFE32F46);
Log.d(V2XConst.LOG_NAME_WARN, "MoGoStopPolylineManager roadWidth = " + info.getWidth());
// 线条粗细,渐变,渐变色值
// 当前车辆位置
options.width(info.getWidth() == 0.0 ? 60 : info.getWidth()).useGradient(true).colorValues(colors);
options.add(info.getStartLocation());
// 目标车辆位置
options.add(info.getEndLocation());
// 绘制线的对象
mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options);
mMogoPolyline.setTransparency(0.5f);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void clearLine() {
if (mMogoPolyline != null) {
mMogoPolyline.remove();
mMogoPolyline = null;
}
}
@Override
public void init(Context context) {
}
@Override
public IMogoPolyline getMogoStopPolyline() {
return mMogoPolyline;
}
}

View File

@@ -1,26 +1,36 @@
package com.mogo.module.v2x.manager.impl;
import android.content.Context;
import android.content.Intent;
import android.location.Location;
import android.util.Log;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.map.MogoLatLng;
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
import com.mogo.map.overlay.IMogoPolyline;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.drawer.V2XWarnDataDrawer;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XWarningEntity;
import com.mogo.module.service.MarkerServiceHandler;
import com.mogo.module.service.receiver.MogoReceiver;
import com.mogo.module.v2x.MoGoV2XServicePaths;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.entity.model.DrawLineInfo;
import com.mogo.module.v2x.manager.IMoGoV2XCloundDataManager;
import com.mogo.module.v2x.utils.LocationUtils;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.WorkThreadHandler;
import com.mogo.utils.logger.Logger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static com.mogo.module.v2x.V2XServiceManager.getContext;
@@ -31,6 +41,9 @@ import static com.mogo.module.v2x.V2XServiceManager.getContext;
public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMogoCarLocationChangedListener2 {
private V2XWarningEntity mCloundWarningInfo;
private static String TAG = "MoGoV2XCloundDataManager";
private boolean isSelfLineClear;
private List fillPoints = new ArrayList();//停止线经纬度合集
@Override
public void init(Context context) {
@@ -43,21 +56,104 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
Log.d(V2XConst.LOG_NAME_WARN, "analysisV2XCloundDataEvent -----> ");
mCloundWarningInfo = cloundWarningInfo;
pointsBetween();
//绘制识别物与交汇点连线,并且更新连线数据
WorkThreadHandler.getInstance().postDelayed(() -> {
drawOtherObjectLine(cloundWarningInfo);
}, 0);
//发送预警提示
MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(cloundWarningInfo.getType(), MogoReceiver.ACTION_V2X_FRONT_WARNING);
//二轮车和行人的渲染和移动
V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo);
isSelfLineClear = false;
Log.d(V2XConst.LOG_NAME_WARN, "direction = " + cloundWarningInfo.getDirection());
if (cloundWarningInfo.getDirection() == 1) { //前方
//停止线前方画线
MogoLatLng newLocation = LocationUtils.getNewLocation((MogoLatLng) fillPoints.get(0), 80, cloundWarningInfo.heading);
WorkThreadHandler.getInstance().postDelayed(() -> {
//二轮车和行人的渲染和移动
V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo);
//绘制识别物与交汇点连线,并且更新连线数据
drawStopLine(cloundWarningInfo, newLocation);
//添加停止线marker
handleStopLine();
}, 0);
UiThreadHandler.postDelayed(() -> {
V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine();
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
V2XServiceManager.getMoGoStopPolylineManager().clearLine();
isSelfLineClear = true;
}, 8000);
} else { //左侧或者右侧
WorkThreadHandler.getInstance().postDelayed(() -> {
//绘制识别物与交汇点连线,并且更新连线数据
drawOtherObjectLine(cloundWarningInfo);
//二轮车和行人的渲染和移动
V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo);
}, 0);
//延迟3秒清理线
UiThreadHandler.postDelayed(() -> {
V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine();
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
isSelfLineClear = true;
}, 8000);
}
//延迟3秒清理线
UiThreadHandler.postDelayed( () -> {
V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine();
}, 8000 );
}
private void handleStopLine() {
for (int i = 0; i < fillPoints.size(); i++) {
V2XWarningEntity entity = new V2XWarningEntity();
MogoLatLng latLng = (MogoLatLng) fillPoints.get(i);
Log.d("liyz", "handleStopLine lat = " + latLng.lat + "--lon =" + latLng.lon);
entity.setLat(latLng.lat);
entity.setLon(latLng.lon);
entity.setCollisionLat(mCloundWarningInfo.getCollisionLat());
entity.setCollisionLon(mCloundWarningInfo.getCollisionLon());
entity.heading = mCloundWarningInfo.heading;
V2XWarnDataDrawer.getInstance().renderStopLineData(entity);
}
}
/**
* 绘制停止线前方线 TODO 需要实时给行人当前位置
*/
private void drawStopLine(V2XWarningEntity info, MogoLatLng mogoLatLng) {
IMogoPolyline polyLine = V2XServiceManager.getMoGoStopPolylineManager().getMogoStopPolyline();
if (info != null) {
if (polyLine != null) {
Log.d(V2XConst.LOG_NAME_WARN, "drawStopLine polyLine != null");
polyLine.setPoints(Arrays.asList(new MogoLatLng(info.getLat(), info.getLon()),
new MogoLatLng(info.getCollisionLat(), info.getCollisionLon())));
polyLine.setTransparency(0.5f);
} else {
Log.e(V2XConst.LOG_NAME_WARN, "drawStopLine polyLine == null");
DrawLineInfo lineInfo = new DrawLineInfo();
MogoLatLng startLatlng = new MogoLatLng(
((MogoLatLng) fillPoints.get(0)).lat,
((MogoLatLng) fillPoints.get(0)).lon);
Log.d(V2XConst.LOG_NAME_WARN, "stop drawStopLine lon =" + startLatlng.lon + "--lat =" + startLatlng.lat);
MogoLatLng endLatlng = new MogoLatLng(mogoLatLng.lat, mogoLatLng.lon);
Log.d(V2XConst.LOG_NAME_WARN, " drawStopLine lon =" + mogoLatLng.lon + "--lat =" + mogoLatLng.lat);
Log.d(V2XConst.LOG_NAME_WARN, " drawStopLine lon =" + endLatlng.lon + "--lat =" + endLatlng.lat);
lineInfo.setStartLocation(startLatlng);
lineInfo.setEndLocation(endLatlng);
lineInfo.setHeading(info.heading);
Log.d(V2XConst.LOG_NAME_WARN, "drawStopLine width = " + info.getRoadwidth());
lineInfo.setWidth(info.getRoadwidth());
V2XServiceManager.getMoGoStopPolylineManager().drawStopPolyline(getContext(), lineInfo);
}
} else {
Log.e(V2XConst.LOG_NAME_WARN, "drawStopLine info == null");
V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine();
}
}
/**
* 绘制行人和二轮车连线,并且更新数据 TODO 需要实时给行人当前位置
*/
@@ -68,6 +164,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
Log.d(V2XConst.LOG_NAME_WARN, "polyLine != null");
polyLine.setPoints(Arrays.asList(new MogoLatLng(info.getLat(), info.getLon()),
new MogoLatLng(info.getCollisionLat(), info.getCollisionLon())));
polyLine.setTransparency(0.5f);
} else {
Log.e(V2XConst.LOG_NAME_WARN, "polyLine == null");
DrawLineInfo lineInfo = new DrawLineInfo();
@@ -76,15 +173,10 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
lineInfo.setStartLocation(startLatlng);
lineInfo.setEndLocation(endLatlng);
lineInfo.setHeading(info.heading);
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
// float roadWidth = V2XServiceManager.getMapUIController().getRoadWidth(info.getLon(),
// info.getLat(), (float) info.heading, true, true);
Log.d(V2XConst.LOG_NAME_WARN, "drawOtherObjectLine width = " + info.getRoadwidth());
lineInfo.setWidth(info.getRoadwidth());
}
Log.d(V2XConst.LOG_NAME_WARN, "drawOtherObjectLine width = " + info.getRoadwidth());
lineInfo.setWidth(info.getRoadwidth());
V2XServiceManager.getMoGoPersonWarnPolylineManager().drawPersonWarnPolyline(getContext(), lineInfo);
}
} else {
Log.e(V2XConst.LOG_NAME_WARN, "info == null");
V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine();
@@ -101,35 +193,33 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
*/
@Override
public void onCarLocationChanged2(Location latLng) {
Log.d(V2XConst.LOG_NAME_WARN, "onCarLocationChanged2 latLng = " + latLng.getLatitude() + "--" + latLng.getLongitude());
// Log.d(V2XConst.LOG_NAME_WARN, "onCarLocationChanged2 latLng = " + latLng.getLatitude() + "--" + latLng.getLongitude() + "---isSelfLineClear = " + isSelfLineClear);
//当行人经纬度交点 经纬度不为空,开始画线,否则清理
//自车只需要关注移动
IMogoPolyline mogoPolyline = V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline();
if (mCloundWarningInfo != null) {
if (mogoPolyline != null) {
mogoPolyline.setPoints(Arrays.asList(new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()),
new MogoLatLng(mCloundWarningInfo.getCollisionLat(), mCloundWarningInfo.getCollisionLon())));
if (!isSelfLineClear) {
IMogoPolyline mogoPolyline = V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline();
if (mCloundWarningInfo != null) {
if (mogoPolyline != null) {
mogoPolyline.setPoints(Arrays.asList(new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()),
new MogoLatLng(mCloundWarningInfo.getDirection() == 1 ? mCloundWarningInfo.getStopLines().get(0).lat : mCloundWarningInfo.getCollisionLat(),
mCloundWarningInfo.getDirection() == 1 ? mCloundWarningInfo.getStopLines().get(0).lon : mCloundWarningInfo.getCollisionLon())));
mogoPolyline.setTransparency(0.5f);
} else {
Log.e(V2XConst.LOG_NAME_WARN, "onCarLocationChanged2 mogoPolyline == null width = " + mCloundWarningInfo.getRoadwidth());
DrawLineInfo info = new DrawLineInfo(); // 对象
MogoLatLng startLatlng = new MogoLatLng(latLng.getLatitude(), latLng.getLongitude());
MogoLatLng endLatlng = new MogoLatLng(mCloundWarningInfo.getDirection() == 1 ? mCloundWarningInfo.getStopLines().get(0).lat : mCloundWarningInfo.getCollisionLat(),
mCloundWarningInfo.getDirection() == 1 ? mCloundWarningInfo.getStopLines().get(0).lon : mCloundWarningInfo.getCollisionLon());
info.setHeading(latLng.getBearing());
info.setStartLocation(startLatlng);
info.setEndLocation(endLatlng);
info.setWidth(mCloundWarningInfo.getRoadwidth()); //TODO 还需要转换比例尺
info.setDirection(mCloundWarningInfo.getDirection());
V2XServiceManager.getMoGoWarnPolylineManager().drawWarnPolyline(getContext(), info);
}
} else {
Log.e(V2XConst.LOG_NAME_WARN, "onCarLocationChanged2 mogoPolyline == null width = " + mCloundWarningInfo.getRoadwidth());
DrawLineInfo info = new DrawLineInfo(); // 对象
MogoLatLng startLatlng = new MogoLatLng(latLng.getLatitude(), latLng.getLongitude());
MogoLatLng endLatlng = new MogoLatLng(mCloundWarningInfo.getCollisionLat(), mCloundWarningInfo.getCollisionLon());
info.setHeading(latLng.getBearing());
info.setStartLocation(startLatlng);
info.setEndLocation(endLatlng);
info.setWidth(mCloundWarningInfo.getRoadwidth()); //TODO 还需要转换比例尺
V2XServiceManager.getMoGoWarnPolylineManager().drawWarnPolyline(getContext(), info);
}
//延迟3秒清理线 TODO 何时 清理
UiThreadHandler.postDelayed( () -> {
Log.e(V2XConst.LOG_NAME_WARN, "onCarLocationChanged2 mCloundWarningInfo == null");
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
}, 13000 );
} else {
Log.e(V2XConst.LOG_NAME_WARN, "onCarLocationChanged2 mCloundWarningInfo == null");
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
}
}
}
@@ -139,4 +229,39 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
}
/**
* 补点后的停止线经纬度合集
*/
public void pointsBetween() {
try {
fillPoints.clear();
List stopLines = mCloundWarningInfo.getStopLines();
if (stopLines.size() > 1) {
MogoLatLng x = mCloundWarningInfo.getStopLines().get(0);
MogoLatLng y = mCloundWarningInfo.getStopLines().get(1);
//两点间的距离
float distance = CoordinateUtils.calculateLineDistance(x.lon, x.lat, y.lon, y.lat);
float average = distance / 3;
//两点间的角度
double angle = LocationUtils.getAngle(x.lon, x.lat, y.lon, y.lat);
//根据距离和角度获取下个点的经纬度
fillPoints.add(x);
for (int i = 1; i < 3; i++) {
MogoLatLng newLocation = LocationUtils.getNewLocation(x, average * i, angle);
fillPoints.add(newLocation);
}
fillPoints.add(y);
}
} catch (Exception e) {
e.printStackTrace();
}
}
private MogoLatLng getMogoLat(MogoLatLng latlng) {
MogoLatLng newLocation = LocationUtils.getNewLocation(latlng, mCloundWarningInfo.getDistance(), mCloundWarningInfo.getDirection());
return newLocation;
}
}

View File

@@ -42,34 +42,26 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager {
MogoPolylineOptions options = new MogoPolylineOptions();
List<Integer> colors = new ArrayList<>();
// if (info.getType() != null) {
// if (info.getType().equals("1")) { //预警 TODO
// colors.add(0xFFFFA31A);
// colors.add(0xFFFFA31A);
// } else {
// colors.add(0xFFE32F46);
// colors.add(0xFFE32F46);
// }
// } else {
// Log.e(V2XConst.LOG_NAME_WARN, "drawWarnPolyline info.getType() == null ");
// colors.add(0xFFE32F46);
// colors.add(0xFFE32F46);
// }
if (info.getDirection() == 1) {
colors.add(0xFF3036FF);
colors.add(0xFF3036FF);
} else {
colors.add(0xFFE32F46);
colors.add(0xFFE32F46);
}
colors.add(0xFFE32F46);
colors.add(0xFFE32F46);
Log.d(V2XConst.LOG_NAME_WARN, "MoGoWarnPolylineManager roadWidth = " + info.getWidth());
Log.d(V2XConst.LOG_NAME_WARN, "MoGoWarnPolylineManager roadWidth = " + info.getWidth());
// 线条粗细,渐变,渐变色值
options.width(info.getWidth()).useGradient(true).transparency(0.9f).colorValues(colors);
// options.width(info.getWidth()).useGradient(true).colorValues(colors);
// 当前车辆位置
options.width(info.getWidth() == 0.0 ? 60 : info.getWidth()).useGradient(true).colorValues(colors);
// options.width(60).useGradient(true).colorValues(colors);
options.add(info.getStartLocation());
// 目标车辆位置
options.add(info.getEndLocation());
// 绘制线的对象
mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options);
mMogoPolyline.setTransparency(0.5f);
} catch (Exception e) {
e.printStackTrace();

View File

@@ -114,7 +114,11 @@ public class V2XScenarioManager implements IV2XScenarioManager {
case V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_LEFT:
case V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_RIGHT:
case V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_BOTTOM:
mV2XScenario = new V2XFrontWarningScenario();
if (V2XServiceManager.getMoGoStatusManager().isVrMode()) {
mV2XScenario = new V2XFrontWarningScenario();
} else {
mV2XScenario = null;
}
break;
default:
mV2XScenario = null;

View File

@@ -47,10 +47,10 @@ public class V2XCarForHelpScenario extends AbsV2XScenario<Boolean> implements IM
private V2XSeekHelpButton mV2XSeekHelpButton;
public V2XCarForHelpScenario() {
setV2XWindow(new V2XCarForHelpWindow(V2XServiceManager.getContext()));
mV2XSeekHelpButton = new V2XSeekHelpButton();
setV2XButton(mV2XSeekHelpButton);
V2XServiceManager.getMoGoStatusManager().registerStatusChangedListener(TAG, StatusDescriptor.SEEK_HELPING, this);
V2XServiceManager.getMoGoStatusManager().registerStatusChangedListener(TAG, StatusDescriptor.VR_MODE, this);
}
@Override
@@ -61,14 +61,6 @@ public class V2XCarForHelpScenario extends AbsV2XScenario<Boolean> implements IM
}
setV2XMessageEntity(v2XMessageEntity);
Boolean isShow = getV2XMessageEntity().getContent();
if (V2XServiceManager.getMoGoStatusManager().isVrMode()) {
if (isShow) {
showWindow();
} else {
closeWindow();
}
// return;
}
if (isShow) {
showButton();
mySeekHelpCountDownTimerCancel();
@@ -96,20 +88,10 @@ public class V2XCarForHelpScenario extends AbsV2XScenario<Boolean> implements IM
@Override
public void showWindow() {
if (getV2XWindow() != null) {
ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
(int) V2XUtils.getApp().getResources().getDimension(R.dimen.dp_140));
V2XServiceManager.getMogoTopViewManager().addView(getV2XWindow().getView(), layoutParams);
getV2XWindow().show(getV2XMessageEntity().getContent());
}
}
@Override
public void closeWindow() {
if (getV2XWindow() != null) {
getV2XWindow().close();
}
}
private V2XVoiceCallbackListener cancelCb = null;
@@ -122,7 +104,7 @@ public class V2XCarForHelpScenario extends AbsV2XScenario<Boolean> implements IM
if (getV2XButton() != null) {
getV2XButton().setOnActionListener(this::showDialog);
getV2XButton().show();
V2XServiceManager.getMogoEntranceButtonController().showLeftNoticeByType(IMogoEntranceButtonController.NOTICE_TYPE_SEEK_HELP, R.drawable.module_v2x_left_notice_seek_help, "正在发起求助...");
// V2XServiceManager.getMogoEntranceButtonController().showLeftNoticeByType(IMogoEntranceButtonController.NOTICE_TYPE_SEEK_HELP, R.drawable.module_v2x_left_notice_seek_help, "正在发起求助...");
}
});
}
@@ -241,6 +223,18 @@ public class V2XCarForHelpScenario extends AbsV2XScenario<Boolean> implements IM
entity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_CAR_FOR_HELP);
entity.setContent(isTrue);
init(entity);
} else if (descriptor == StatusDescriptor.VR_MODE) {
if (V2XServiceManager.getMoGoStatusManager().isSeekHelping()) {
if (isTrue) {
((V2XSeekHelpButton) getV2XButton()).showTopView();
V2XServiceManager.getMogoEntranceButtonController()
.getButton(ButtonIndex.BUTTON2).setVisibility(View.GONE);
} else {
((V2XSeekHelpButton) getV2XButton()).closeTopView();
V2XServiceManager.getMogoEntranceButtonController()
.getButton(ButtonIndex.BUTTON2).setVisibility(View.VISIBLE);
}
}
}
}
}

View File

@@ -1,102 +0,0 @@
package com.mogo.module.v2x.scenario.scene.help;
import android.content.Context;
import android.content.Intent;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import com.mogo.commons.data.BaseData;
import com.mogo.commons.voice.AIAssist;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
import com.mogo.module.v2x.network.V2XRefreshCallback;
import com.mogo.module.v2x.scenario.scene.V2XBasWindow;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.module.v2x.voice.V2XVoiceCallbackListener;
import com.mogo.module.v2x.voice.V2XVoiceConstants;
import com.mogo.module.v2x.voice.V2XVoiceManager;
import com.mogo.utils.storage.SharedPrefsMgr;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
/**
* created by wujifei on 2021/4/1 16:04
* describe:
*/
public class V2XCarForHelpWindow extends V2XBasWindow implements IV2XWindow<Boolean> {
private static final String TAG = MODULE_NAME + "_" + V2XCarForHelpScenario.class.getSimpleName();
private TextView tvCancel;
private V2XVoiceCallbackListener cancelCb = (String command, Intent intent) -> {
close();
};
public V2XCarForHelpWindow(Context context) {
this(context, null);
}
public V2XCarForHelpWindow(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public V2XCarForHelpWindow(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initView(context);
}
private void initView(Context context) {
LayoutInflater.from(context).inflate(R.layout.window_carforhelp_detail, this);
tvCancel = (TextView) findViewById(R.id.tv_cancel);
tvCancel.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
close();
}
});
}
@Override
public void show(Boolean entity) {
V2XVoiceManager.INSTANCE.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CANCEL_HELP, cancelCb);
}
@Override
public void close() {
if (V2XServiceManager.getMoGoStatusManager().isSeekHelping()) {
V2XServiceManager.getMoGoStatusManager().setSeekHelping(TAG, false);
SharedPrefsMgr.getInstance(V2XUtils.getApp()).putLong(V2XConst.SEEK_HELP_TIME, 0);
V2XServiceManager.getV2XRefreshModel().cancelHelpSignal(new V2XRefreshCallback<BaseData>() {
@Override
public void onSuccess(BaseData result) {
AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice("已取消", null);
//移除窗体
V2XServiceManager.getMogoTopViewManager().removeView(V2XCarForHelpWindow.this);
V2XVoiceManager.INSTANCE.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CANCEL_HELP);
}
@Override
public void onFail(String msg) {
Toast.makeText(V2XServiceManager.getContext(), msg, Toast.LENGTH_SHORT).show();
}
});
}
}
@Override
public View getView() {
return this;
}
@Override
public void setWindowStatusListener(V2XWindowStatusListener listener) {
}
}

View File

@@ -1,7 +1,9 @@
package com.mogo.module.v2x.scenario.scene.help;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.mogo.commons.data.BaseData;
@@ -35,6 +37,8 @@ public class V2XSeekHelpButton implements IV2XButton {
private V2XVoiceCallbackListener cancelCb = (String command, Intent intent) -> {
doAction();
};
private View topView;
private void doAction() {
if (mListener != null) {
@@ -53,31 +57,57 @@ public class V2XSeekHelpButton implements IV2XButton {
try {
tv = V2XServiceManager.getMogoEntranceButtonController().getButton(ButtonIndex.BUTTON2);
tv.setText("取消\n求助");
tv.setVisibility(View.VISIBLE);
tv.setOnClickListener(v -> {
//调用取消求助接口
// TODO: 2020/5/18 回调,显示对话框
doAction();
});
if (V2XServiceManager.getMoGoStatusManager().isVrMode()) {
showTopView();
tv.setVisibility(View.GONE);
} else {
closeTopView();
tv.setVisibility(View.VISIBLE);
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void showTopView() {
topView = View.inflate(V2XServiceManager.getContext(), R.layout.window_carforhelp_detail, null);
TextView tvCancel = topView.findViewById(R.id.tv_cancel);
tvCancel.setOnClickListener(v -> {
doAction();
});
ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
(int) V2XUtils.getApp().getResources().getDimension(R.dimen.dp_140));
V2XServiceManager.getMogoTopViewManager().addView(topView, layoutParams);
}
public void closeTopView() {
V2XServiceManager.getMogoTopViewManager().removeView(topView);
}
@Override
public void close() {
if (tv != null) {
AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice("已取消", null);
tv.setVisibility(View.GONE);
closeTopView();
V2XServiceManager.getV2XRefreshModel().cancelHelpSignal(new V2XRefreshCallback<BaseData>() {
@Override
public void onSuccess(BaseData result) {
tv.setVisibility(View.GONE);
closeTopView();
}
@Override
public void onFail(String msg) {
tv.setVisibility(View.VISIBLE);
showTopView();
}
});
mListener = null;

View File

@@ -53,7 +53,6 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
private Button mBtnTriggerRoadEvent;
private Button mBtnClearRoadEvent;
private Button mBtnTriggerPushEvent;
private Button mBtnTriggerWarningEvent;
private Button mBtnTriggerPushLiveCarEvent;
private Button mBtnTriggerAnimationEvent;
private Button mBtnbtnFrontCarLiveEvent;
@@ -117,7 +116,6 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
mBtnTriggerOpen = findViewById(R.id.btnTriggerOpen);
mBtnClearRoadEvent = findViewById(R.id.btnClearRoadEvent);
mBtnTriggerRoadEvent = findViewById(R.id.btnTriggerRoadEvent);
mBtnTriggerWarningEvent = findViewById(R.id.btnTriggerWarningEvent);
mBtnTriggerPushEvent = findViewById(R.id.btnTriggerPushEvent);
mBtnTriggerPushLiveCarEvent = findViewById(R.id.btnTriggerPushLiveCarEvent);
mBtnTriggerAnimationEvent = findViewById(R.id.btnTriggerAnimationEvent);
@@ -222,16 +220,6 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
});
//车路云—场景预警-V1.0 碰撞预警
mBtnTriggerWarningEvent.setOnClickListener(v -> {
V2XMessageEntity<V2XWarningEntity> v2XMessageEntity =
TestOnLineCarUtils.getV2XScenarioPushFrontWarningEventData();
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
});
mBtnTriggerPushEvent.setOnClickListener(v -> {
V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity =
TestOnLineCarUtils.getV2XScenarioPushEventData();

View File

@@ -42,7 +42,7 @@ import java.util.List;
* @description 车路云—场景预警-V1.0 前车/行人/摩托车/盲区碰撞预警
* @since: 2021/3/24
*/
public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopViewStatusListener , IMogoCarLocationChangedListener2 {
public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopViewStatusListener {
private int direction;
private V2XWarningEntity mMarkerEntity;
@@ -134,14 +134,4 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopV
}
@Override
public void onCarLocationChanged2(Location latLng) {
}
@Override
public void onCarLocationChanged(MogoLatLng latLng) {
mMarkerEntity.setCarLocation(latLng);
drawPOI();
}
}

View File

@@ -48,7 +48,7 @@ public class V2XWarningMarker implements IV2XMarker {
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
pointsBetween();
//绘制停止线
drawStopLines(fillPoints);
// drawStopLines(fillPoints);
drawSafeLine();
WorkThreadHandler.getInstance().postDelayed(() -> {
V2XServiceManager.getMarkerManager().removeMarkers(V2XConst.V2X_FRONT_STOP_LINE);
@@ -72,9 +72,9 @@ public class V2XWarningMarker implements IV2XMarker {
//根据到停止线的距离和方向角获取经纬度
MogoLatLng
stopLineLo = LocationUtils.getNewLocation(car, mMarkerEntity.getStopLineDistance(), mMarkerEntity.getAngle());
if (mMarkerEntity.getCollisionLat() > 0 && mMarkerEntity.getCollisionLon() > 0) {
drawLine(car, stopLineLo);
}
// if (mMarkerEntity.getCollisionLat() > 0 && mMarkerEntity.getCollisionLon() > 0) {
// drawLine(car, stopLineLo);
// }
} else {
Log.d(TAG, "自车位置没有拿到");
}
@@ -152,6 +152,7 @@ public class V2XWarningMarker implements IV2XMarker {
DrawLineInfo drawLineInfo = new DrawLineInfo();
drawLineInfo.setStartLocation(s);
drawLineInfo.setEndLocation(e);
drawLineInfo.setWidth(60);
V2XServiceManager.getMoGoWarnPolylineManager().drawWarnPolyline(mContext, drawLineInfo);
}

View File

@@ -135,7 +135,7 @@ public class EventTypeUtils {
break;
// 积水
case V2XPoiTypeEnum.FOURS_PONDING:
str = "前方道路积水道路积水";
str = "前方道路积水";
break;
// 浓雾
case V2XPoiTypeEnum.FOURS_FOG:

Binary file not shown.

After

Width:  |  Height:  |  Size: 847 B

View File

@@ -205,4 +205,82 @@
</LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_140"
android:background="@drawable/bg_v2x_event_bg"
android:visibility="gone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.mogo.service.imageloader.MogoImageView
android:id="@+id/iv_event"
android:layout_width="@dimen/dp_100"
android:layout_height="@dimen/dp_100"
android:layout_marginLeft="@dimen/dp_30"
android:scaleType="fitXY"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:miv_failureHolder="@drawable/v2x_icon_live_logo"
app:miv_overlayImageId="@drawable/v2x_icon_live_logo"
app:miv_placeHolder="@drawable/v2x_icon_live_logo"
app:miv_topLeftRadius="@dimen/dp_20" />
<LinearLayout
android:id="@+id/ll_event"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/iv_event"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/tv_event"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxWidth="@dimen/dp_480"
android:paddingLeft="@dimen/dp_40"
android:paddingRight="@dimen/dp_40"
android:textColor="@color/v2x_white"
android:textSize="@dimen/dp_32" />
<ImageView
android:id="@+id/iv_play"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/dp_40"
android:src="@drawable/icon_play"
android:visibility="gone" />
</LinearLayout>
<TextView
android:id="@+id/tv_line"
android:layout_width="@dimen/dp_0_5"
android:layout_height="@dimen/dp_70"
android:background="@color/v2x_white"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/tv_play"
app:layout_constraintStart_toEndOf="@+id/ll_event"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_play"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_140"
android:gravity="center"
android:paddingLeft="@dimen/dp_40"
android:paddingRight="@dimen/dp_40"
android:text="播放"
android:textColor="@color/v2x_event_play_text"
android:textSize="@dimen/dp_30"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -229,28 +229,45 @@
android:id="@+id/iv_event"
android:layout_width="@dimen/dp_100"
android:layout_height="@dimen/dp_100"
android:layout_marginLeft="@dimen/dp_30"
android:scaleType="fitXY"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginLeft="@dimen/dp_30"
app:miv_failureHolder="@drawable/v2x_icon_live_logo"
app:miv_overlayImageId="@drawable/v2x_icon_live_logo"
app:miv_placeHolder="@drawable/v2x_icon_live_logo"
app:miv_topLeftRadius="@dimen/dp_20" />
<TextView
android:id="@+id/tv_event"
<LinearLayout
android:id="@+id/ll_event"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxWidth="@dimen/dp_480"
android:paddingLeft="@dimen/dp_40"
android:paddingRight="@dimen/dp_40"
android:textColor="@color/v2x_white"
android:textSize="@dimen/dp_32"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/iv_event"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/tv_event"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxWidth="@dimen/dp_480"
android:paddingLeft="@dimen/dp_40"
android:paddingRight="@dimen/dp_40"
android:textColor="@color/v2x_white"
android:textSize="@dimen/dp_32" />
<ImageView
android:id="@+id/iv_play"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_6"
android:paddingLeft="@dimen/dp_42"
android:src="@drawable/icon_play"
android:visibility="gone" />
</LinearLayout>
<TextView
android:id="@+id/tv_line"
@@ -260,7 +277,7 @@
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/tv_play"
app:layout_constraintStart_toEndOf="@+id/tv_event"
app:layout_constraintStart_toEndOf="@+id/ll_event"
app:layout_constraintTop_toTopOf="parent" />
<TextView
@@ -271,9 +288,9 @@
android:paddingLeft="@dimen/dp_40"
android:paddingRight="@dimen/dp_40"
android:text="播放"
android:visibility="gone"
android:textColor="@color/v2x_event_play_text"
android:textSize="@dimen/dp_30"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />

View File

@@ -238,20 +238,6 @@
android:textSize="@dimen/dp_22"
android:textStyle="bold" />
<Button
android:id="@+id/btnTriggerWarningEvent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_10"
android:layout_marginBottom="@dimen/dp_10"
android:background="#FF0606"
android:padding="@dimen/dp_10"
android:text="前方碰撞预警"
android:textColor="#FFFFFF"
android:textSize="@dimen/dp_22"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<Button
android:id="@+id/btnTriggerPushEvent"
android:layout_width="wrap_content"

View File

@@ -1,5 +1,5 @@
{
"type": 2,
"type": 10013,
"lat": 39.977148,
"lon": 116.417478,
"distance": 2,
@@ -17,14 +17,12 @@
],
"from": 1,
"angle": 0,
"direction": 10014,
"direction": 1,
"speed": 11.108121,
"targetColor": "#FF4040",
"stopLineDistance": 30,
"stopLineLat": 39.977094,
"stopLineLon": 116.417634,
"stopLineDistance": 15,
"warningContent": "小心行人",
"heading": 30,
"heading": 0,
"showTime": 3000,
"roadwidth": 65.0
"roadwidth": 60.0
}

View File

@@ -20,6 +20,5 @@
<color name="v2x_event_play_text">#4C83FF</color>
<color name="v2x_FF3036">#FF3036</color>
<color name="v2x_car_for_help_cancel">#F63A35</color>
</resources>

View File

@@ -113,12 +113,11 @@ public interface IMogoADASController extends IProvider {
*
* @return
*/
List<ADASRecognizedResult> getLastADASRecognizedResult();
List< ADASRecognizedResult > getLastADASRecognizedResult();
/**
* 添加adas识别物体回调
*
*
* @param callback
*/
void addAdasRecognizedDataCallback( IMogoAdasRecognizedDataCallback callback );
@@ -139,6 +138,7 @@ public interface IMogoADASController extends IProvider {
/**
* 自动驾驶状态通知
*
* @param callback
*/
void addAdasOCHCallback( IMogoAdasOCHCallback callback );
@@ -152,6 +152,7 @@ public interface IMogoADASController extends IProvider {
/**
* 获取车辆自动驾驶状态
*
* @return
*/
int getAutopilotStatus();
@@ -160,18 +161,21 @@ public interface IMogoADASController extends IProvider {
/**
* 获取车身的定位纬度
*
* @return
*/
double getLastLat();
/**
* 获取车身定位经度
*
* @return
*/
double getLastLon();
/**
* 获取车身定位经度
*
* @return
*/
double getLastSpeed();
@@ -181,5 +185,9 @@ public interface IMogoADASController extends IProvider {
*/
void cancelAutopilot();
void mockAdasLoc(String json);
void mockAdasLoc( String json );
void mockAdasRecognized( List< ADASRecognizedResult > recognizedResults );
void mockAdasRecognized( String json );
}

View File

@@ -185,6 +185,8 @@ public class MogoADASController implements IMogoADASController {
model.setDataAccuracy( bean.getDataAccuracy() );
model.setDistance( bean.getDistance() );
data.add( model );
Logger.d( TAG, "识别距离x = %s, y = %s", model.getDistance_x(), model.getDistance_y() );
}
}
@@ -819,4 +821,21 @@ public class MogoADASController implements IMogoADASController {
mMogoAdasCarDataCallback.onAdasCarDataCallback( stateInf );
}
}
@Override
public void mockAdasRecognized( List< ADASRecognizedResult > recognizedResults ) {
if ( !mMogoAdasRecognizedDataCallbacks.isEmpty() ) {
for ( IMogoAdasRecognizedDataCallback callback : mMogoAdasRecognizedDataCallbacks ) {
if ( callback == null ) {
continue;
}
callback.onAdasDataCallback( recognizedResults );
}
}
}
@Override
public void mockAdasRecognized( String json ) {
mAutopolitDataCallBack.cameraEyeDetectResult( json );
}
}