diff --git a/gradle.properties b/gradle.properties index 73f8f9dadb..2172a6f8a0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -145,7 +145,7 @@ MOGO_OCH_TAXI_VERSION=1.0.0 ######## 外部依赖引用 # 车聊聊 -CARCHATTING_VERSION=2.2.77 +CARCHATTING_VERSION=2.2.311 # 车聊聊接口 CARCHATTINGPROVIDER_VERSION=1.1.11 # websocket diff --git a/libraries/map-custom/build.gradle b/libraries/map-custom/build.gradle index 8a8e49cbfe..2ac43dc030 100644 --- a/libraries/map-custom/build.gradle +++ b/libraries/map-custom/build.gradle @@ -67,7 +67,7 @@ dependencies { implementation project(':foudations:mogo-commons') } - implementation 'com.zhidaoauto.machine:map:1.0.0-vr-8.5.1' + implementation 'com.zhidaoauto.machine:map:1.0.0-vr-8.5.2' // implementation 'com.zhidaoauto.machine:map:1.0.0-vr-test-3.4' } diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XWarningEntity.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XWarningEntity.java index df3e48319a..9f294af585 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XWarningEntity.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XWarningEntity.java @@ -58,40 +58,11 @@ public class V2XWarningEntity implements Serializable { //自组字段 //tts播报 private String tts; - //打点位置 - private MarkerLocation location; + //自车位置 + private MogoLatLng carLocation; - public void setLocation(MarkerLocation location) { - this.location = location; - } - - public MarkerLocation getLocation() { - if (location == null) { - MarkerLocation location = new MarkerLocation(); - location.setLat(getLat()); - location.setLon(getLon()); - setLocation(location); - } - return location; - } - - - public void setTipContent(int type) { - switch (type) { - case 0: - this.warningContent = "行人碰撞预警"; - break; - case 1: - case 3: - case 4: - this.warningContent = "前车碰撞预警"; - break; - case 2: - this.warningContent = "摩托车碰撞预警"; - break; - default: - break; - } + public MogoLatLng getCarLocation() { + return carLocation; } public void setTts(int type) { @@ -167,6 +138,10 @@ public class V2XWarningEntity implements Serializable { this.stopLines = stopLines; } + public void setCarLocation(MogoLatLng carLocation) { + this.carLocation = carLocation; + } + public int getType() { return type; } @@ -212,9 +187,6 @@ public class V2XWarningEntity implements Serializable { } public String getWarningContent() { - if (this.warningContent == null) { - setTipContent(type); - } return warningContent; } @@ -270,7 +242,7 @@ public class V2XWarningEntity implements Serializable { ", systemTime=" + systemTime + ", satelliteTime=" + satelliteTime + ", tts='" + tts + '\'' + - ", location=" + location + + ", carLocation=" + carLocation + '}'; } } diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/TopView.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/TopView.java index 0f98f21a68..a883d44ad8 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/TopView.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/TopView.java @@ -43,15 +43,17 @@ public class TopView extends FrameLayout { return super.onTouchEvent(event); } - private float originY; + private float originX,originY; @Override public boolean onInterceptTouchEvent(MotionEvent ev) { if (ev.getAction() == MotionEvent.ACTION_DOWN) { originY = ev.getY(); + originX = ev.getY(); } else if (ev.getAction() == MotionEvent.ACTION_MOVE) { // 垂直滑动,事件拦截 - return Math.abs(originY - ev.getY()) > ViewConfiguration.get(getContext()).getScaledTouchSlop(); + return Math.abs(originY - ev.getY()) > ViewConfiguration.get(getContext()).getScaledTouchSlop() + ||Math.abs(originX - ev.getX()) > ViewConfiguration.get(getContext()).getScaledTouchSlop(); } return false; } diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/ShareControl.java b/modules/mogo-module-share/src/main/java/com/mogo/module/share/ShareControl.java index c9a7816550..5c04289638 100644 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/ShareControl.java +++ b/modules/mogo-module-share/src/main/java/com/mogo/module/share/ShareControl.java @@ -301,9 +301,9 @@ public class ShareControl implements IMogoShareManager, Handler.Callback { } break; case VOICE_CMD_PUB_TROUBLE_HELP: - if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) { - return; - } +// if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) { +// return; +// } if (needAuth()) { goAuth(STEP_AFTER_AUTH_TYPE_SEEK_HELP, TYPE_DENSE_FOG, false); } else { diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XConst.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XConst.java index 4d03e6cf94..1430bf8fa2 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XConst.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XConst.java @@ -145,6 +145,10 @@ public class V2XConst { * */ public static final String V2X_FRONT_WARNING_MARKER = "V2X_FRONT_WARNING_MARKER"; + /* + *V2X 车路云前方预警 + * */ + public static final String V2X_FRONT_STOP_LINE = "V2X_FRONT_STOP_LINE"; /** * V2X预警日志tag */ diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XLocationListener.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XLocationListener.java index 9181b64e38..411ee5efba 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XLocationListener.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XLocationListener.java @@ -89,12 +89,12 @@ public class V2XLocationListener implements IMogoLocationListener, CarStatusList loc.setAltitude( location.getAltitude() ); loc.setBearing( location.getBearing() ); loc.setProvider( location.getProvider() ); -// onLocationChangedImpl( loc ); + onLocationChangedImpl( loc ); } @Override public void onLocationChanged(MogoLocation location) { - onLocationChangedImpl(location); +// onLocationChangedImpl(location); } private void onLocationChangedImpl(MogoLocation location){ diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/impl/V2XScenarioManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/impl/V2XScenarioManager.java index 5ed3162f4d..1eaf187abb 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/impl/V2XScenarioManager.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/impl/V2XScenarioManager.java @@ -16,8 +16,8 @@ import com.mogo.module.v2x.scenario.scene.livecar.V2XPushLiveCarScenario; import com.mogo.module.v2x.scenario.scene.livecar.V2XVoiceCallLiveScenario; import com.mogo.module.v2x.scenario.scene.park.V2XIllegalParkScenario; import com.mogo.module.v2x.scenario.scene.push.V2XPushEventScenario; -import com.mogo.module.v2x.scenario.scene.route.V2XOptimalRouteVREventScenario; import com.mogo.module.v2x.scenario.scene.road.V2XRoadEventScenario; +import com.mogo.module.v2x.scenario.scene.route.V2XOptimalRouteVREventScenario; import com.mogo.module.v2x.scenario.scene.seek.V2XSeekHelpScenario; import com.mogo.module.v2x.scenario.scene.ugc.V2XEventUgcScenario; import com.mogo.module.v2x.scenario.scene.warning.V2XFrontWarningScenario; @@ -106,6 +106,8 @@ public class V2XScenarioManager implements IV2XScenarioManager { case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_VR_SHOW: if (V2XServiceManager.getMoGoStatusManager().isVrMode()) { mV2XScenario = new V2XOptimalRouteVREventScenario(); + } else { + mV2XScenario = null; } break; case V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_TOP: diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XCarForHelpScenario.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XCarForHelpScenario.java index b558ffa800..e1f35a4d4c 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XCarForHelpScenario.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XCarForHelpScenario.java @@ -2,6 +2,8 @@ package com.mogo.module.v2x.scenario.scene.help; import android.content.Intent; import android.os.CountDownTimer; +import android.view.View; +import android.view.ViewGroup; import android.widget.TextView; import androidx.annotation.Nullable; @@ -11,6 +13,7 @@ import com.mogo.module.v2x.R; import com.mogo.module.v2x.V2XConst; import com.mogo.module.v2x.V2XServiceManager; import com.mogo.module.v2x.scenario.impl.AbsV2XScenario; +import com.mogo.module.v2x.scenario.scene.seek.V2XSeekHelpWindow; import com.mogo.module.v2x.utils.V2XUtils; import com.mogo.module.v2x.voice.V2XVoiceCallbackListener; import com.mogo.module.v2x.voice.V2XVoiceConstants; @@ -44,6 +47,7 @@ public class V2XCarForHelpScenario extends AbsV2XScenario 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); @@ -57,6 +61,14 @@ public class V2XCarForHelpScenario extends AbsV2XScenario implements IM } setV2XMessageEntity(v2XMessageEntity); Boolean isShow = getV2XMessageEntity().getContent(); + if (V2XServiceManager.getMoGoStatusManager().isVrMode()) { + if (isShow) { + showWindow(); + } else { + closeWindow(); + } + // return; + } if (isShow) { showButton(); mySeekHelpCountDownTimerCancel(); @@ -84,12 +96,20 @@ public class V2XCarForHelpScenario extends AbsV2XScenario implements IM @Override public void showWindow() { - //无window + 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() { - //无window + if (getV2XWindow() != null) { + getV2XWindow().close(); + } } private V2XVoiceCallbackListener cancelCb = null; diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XCarForHelpWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XCarForHelpWindow.java new file mode 100644 index 0000000000..84b1c8081d --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XCarForHelpWindow.java @@ -0,0 +1,102 @@ +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 { + 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() { + @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) { + + } +} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/route/V2XOptimalRouteVREventMarker.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/route/V2XOptimalRouteVREventMarker.java index 0702296ea3..4dd538fe59 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/route/V2XOptimalRouteVREventMarker.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/route/V2XOptimalRouteVREventMarker.java @@ -54,12 +54,11 @@ public class V2XOptimalRouteVREventMarker implements IV2XMarker colors = new ArrayList<>(); + colors.add(0xFFF95959); - colors.add(0xFF942B48); - colors.add(0xFFCB253A); // 线条粗细,渐变,渐变色值 - options.width(30).useGradient(true).colorValues(colors); + options.width(20).useGradient(true).colorValues(colors); for (double[] doubles : entity.getRecommendPolyline()) { options.add(doubles[0], doubles[1]); diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XFrontWarningScenario.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XFrontWarningScenario.java index 4b58b04e90..2355cc0096 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XFrontWarningScenario.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XFrontWarningScenario.java @@ -2,6 +2,7 @@ package com.mogo.module.v2x.scenario.scene.warning; import android.content.Context; import android.content.Intent; +import android.location.Location; import android.util.Log; import android.view.View; import android.view.ViewGroup; @@ -9,7 +10,9 @@ import android.view.ViewGroup; import androidx.annotation.Nullable; import com.alibaba.android.arouter.facade.annotation.Route; +import com.mogo.map.MogoLatLng; import com.mogo.map.marker.IMogoMarker; +import com.mogo.map.navi.IMogoCarLocationChangedListener2; import com.mogo.module.common.MogoApisHandler; import com.mogo.module.common.entity.V2XMessageEntity; import com.mogo.module.common.entity.V2XPoiTypeEnum; @@ -39,7 +42,7 @@ import java.util.List; * @description 车路云—场景预警-V1.0 前车/行人/摩托车/盲区碰撞预警 * @since: 2021/3/24 */ -public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopViewStatusListener { +public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopViewStatusListener , IMogoCarLocationChangedListener2 { private int direction; private V2XWarningEntity mMarkerEntity; @@ -130,4 +133,15 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopV public void beforeViewRemoveAnim(View view) { } + + @Override + public void onCarLocationChanged2(Location latLng) { + + } + + @Override + public void onCarLocationChanged(MogoLatLng latLng) { + mMarkerEntity.setCarLocation(latLng); + drawPOI(); + } } diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java index cb6c5decb6..90eb63254b 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java @@ -24,12 +24,14 @@ import java.util.List; /** * @author liujing - * @description 描述 + * @description 前方预警marker打点 绘制安全线和预警线 * @since: 2021/3/30 */ public class V2XWarningMarker implements IV2XMarker { private V2XWarningEntity mMarkerEntity; + private MarkerShowEntity markerShowEntity = new MarkerShowEntity(); private Context mContext = V2XServiceManager.getContext(); + private List fillPoints = new ArrayList();//停止线经纬度合集 @Override public void drawPOI(Object entity) { @@ -39,32 +41,52 @@ public class V2XWarningMarker implements IV2XMarker { location.setLat(mMarkerEntity.getLat()); location.setLon(mMarkerEntity.getLon()); - MarkerShowEntity markerShowEntity = new MarkerShowEntity(); markerShowEntity.setMarkerLocation(location); - markerShowEntity.setMarkerType(V2XConst.V2X_FRONT_WARNING_MARKER); if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) { - clearPOI(); + pointsBetween(); + //绘制停止线 + drawStopLines(fillPoints); + drawSafeLine(); WorkThreadHandler.getInstance().postDelayed(() -> { - IMogoMarker marker = drawMarkerAndReturn(markerShowEntity); - //如果有预警碰撞点,识别物与预警碰撞点之间连线,并执行平移动画 - if (mMarkerEntity.getCollisionLat() > 0 && mMarkerEntity.getCollisionLon() != 0) { - drawLine(); - smooth(marker); - } - }, 0); - - } else { - + V2XServiceManager.getMarkerManager().removeMarkers(V2XConst.V2X_FRONT_STOP_LINE); + V2XServiceManager.getMoGoWarnPolylineManager().clearLine(); + }, 6_000); } + } catch (Exception e) { } } + //绘制安全距离 + private void drawSafeLine() { + clearPOI(); + WorkThreadHandler.getInstance().postDelayed(() -> { + //自车位置 + MogoLatLng car = mMarkerEntity.getCarLocation(); + if (car == null) { + double lon = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon(); + double lat = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat(); + car = new MogoLatLng(lat, lon); + car = new MogoLatLng(39.977709,116.417703); + } + if (car != null) { + //根据到停止线的距离和方向角获取经纬度 + MogoLatLng + stopLineLo = LocationUtils.getNewLocation(car, mMarkerEntity.getStopLineDistance(), mMarkerEntity.getAngle()); + if (mMarkerEntity.getCollisionLat() > 0 && mMarkerEntity.getCollisionLon() > 0) { + drawLine(car, stopLineLo); + } + } + }, 0); + } + + //补点后的停止线经纬度合集 public void pointsBetween() { try { + fillPoints.clear(); List stopLines = mMarkerEntity.getStopLines(); if (stopLines.size() > 1) { MogoLatLng x = mMarkerEntity.getStopLines().get(0); @@ -75,11 +97,12 @@ public class V2XWarningMarker implements IV2XMarker { //两点间的角度 double angle = LocationUtils.getAngle(x.lon, x.lat, y.lon, y.lat); //根据距离和角度获取下个点的经纬度 - List replenish = new ArrayList(); + fillPoints.add(x); for (int i = 1; i < 3; i++) { MogoLatLng newLocation = LocationUtils.getNewLocation(x, average * i, angle); - replenish.add(newLocation); + fillPoints.add(newLocation); } + fillPoints.add(y); } } catch (Exception e) { @@ -87,7 +110,31 @@ public class V2XWarningMarker implements IV2XMarker { } - //绘制marker + //绘制停止线-通过打点的方式实现 + private void drawStopLines(List points) { + clearPOI(); + V2XServiceManager.getMarkerManager().removeMarkers(V2XConst.V2X_FRONT_STOP_LINE); + for (int i = 0; i < points.size(); i++) { + MogoLatLng latLng = (MogoLatLng) points.get(i); + drawMarkerWithLocation(latLng, V2XConst.V2X_FRONT_STOP_LINE); + } + } + + private void drawMarkerWithLocation(MogoLatLng latLng, String tag) { + MogoMarkerOptions options = new MogoMarkerOptions() + .object(markerShowEntity) + .latitude(latLng.lat) + .longitude(latLng.lon); + IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options); + options.icon3DRes(com.mogo.module.service.R.raw.people); + options.anchor(0.5f, 0.5f); + options.anchorColor("#FF4040"); + IMogoMarker marker = V2XServiceManager.getMarkerManager().addMarker(tag, options); + iMarkerView.setMarker(marker); + marker.setToTop(); + } + + //绘制并返回marker public IMogoMarker drawMarkerAndReturn(MarkerShowEntity markerShowEntity) { MogoMarkerOptions options = new MogoMarkerOptions() .object(markerShowEntity) @@ -96,19 +143,17 @@ public class V2XWarningMarker implements IV2XMarker { IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options); options.icon3DRes(com.mogo.module.service.R.raw.people); options.anchorColor("#FF4040"); - IMogoMarker marker = V2XServiceManager.getMarkerManager().addMarker(markerShowEntity.getMarkerType(), options); + IMogoMarker marker = V2XServiceManager.getMarkerManager().addMarker(V2XConst.V2X_FRONT_WARNING_MARKER, options); iMarkerView.setMarker(marker); marker.setToTop(); return marker; } //绘制线 - public void drawLine() { + public void drawLine(MogoLatLng s, MogoLatLng e) { DrawLineInfo drawLineInfo = new DrawLineInfo(); - MogoLatLng slatLng = new MogoLatLng(mMarkerEntity.getLat(), mMarkerEntity.getLon()); - MogoLatLng endLatLng = new MogoLatLng(mMarkerEntity.getCollisionLat(), mMarkerEntity.getCollisionLon()); - drawLineInfo.setStartLocation(slatLng); - drawLineInfo.setEndLocation(endLatLng); + drawLineInfo.setStartLocation(s); + drawLineInfo.setEndLocation(e); V2XServiceManager.getMoGoWarnPolylineManager().drawWarnPolyline(mContext, drawLineInfo); } @@ -134,4 +179,5 @@ public class V2XWarningMarker implements IV2XMarker { public void clearLine() { V2XServiceManager.getMoGoWarnPolylineManager().clearLine(); } + } diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningWindow.java index 3983091eaf..14e2ee8528 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningWindow.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningWindow.java @@ -1,6 +1,7 @@ package com.mogo.module.v2x.scenario.scene.warning; import android.content.Context; +import android.location.Location; import android.os.Handler; import android.util.AttributeSet; import android.view.LayoutInflater; @@ -10,6 +11,10 @@ import android.widget.TextView; import com.mogo.commons.voice.AIAssist; import com.mogo.commons.voice.VoicePreemptType; +import com.mogo.map.MogoLatLng; +import com.mogo.map.navi.IMogoCarLocationChangedListener; +import com.mogo.map.navi.IMogoCarLocationChangedListener2; +import com.mogo.module.common.MogoApisHandler; import com.mogo.module.common.entity.V2XWarningEntity; import com.mogo.module.v2x.R; import com.mogo.module.v2x.V2XServiceManager; @@ -120,6 +125,5 @@ public class V2XWarningWindow extends V2XBasWindow implements IV2XWindow { V2XServiceManager .getMogoTopViewManager() .removeView(this); - } } diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_car_for_help.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_car_for_help.png new file mode 100644 index 0000000000..6244ee2b2f Binary files /dev/null and b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_car_for_help.png differ diff --git a/modules/mogo-module-v2x/src/main/res/layout/window_carforhelp_detail.xml b/modules/mogo-module-v2x/src/main/res/layout/window_carforhelp_detail.xml new file mode 100644 index 0000000000..267d6b20fe --- /dev/null +++ b/modules/mogo-module-v2x/src/main/res/layout/window_carforhelp_detail.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/layout/window_test_console.xml b/modules/mogo-module-v2x/src/main/res/layout/window_test_console.xml index 98db0c3e37..85c806cb25 100644 --- a/modules/mogo-module-v2x/src/main/res/layout/window_test_console.xml +++ b/modules/mogo-module-v2x/src/main/res/layout/window_test_console.xml @@ -246,7 +246,7 @@ android:layout_marginBottom="@dimen/dp_10" android:background="#FF0606" android:padding="@dimen/dp_10" - android:text="前车碰撞预警" + android:text="前方碰撞预警" android:textColor="#FFFFFF" android:textSize="@dimen/dp_22" app:layout_constraintBottom_toBottomOf="parent" diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_event_data_yongdu_gongsi.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_event_data_yongdu_gongsi.json index 7eac88ddd5..c4a47a5b64 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_event_data_yongdu_gongsi.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_event_data_yongdu_gongsi.json @@ -1,7 +1,7 @@ { "sceneId": "200008", "alarmContent": "拥堵路线推荐", - "expireTime": 20000, + "expireTime": 10000, "sceneCategory": 0, "sceneDescription": "拥堵路线推荐", "sceneName": "拥堵路线推荐", diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json index 06b468f7d1..91f29e6187 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json @@ -2,25 +2,25 @@ "type": 2, "lat": 39.977148, "lon": 116.417478, - "distance": 2.22, + "distance": 2, "collisionLat": 39.977094, "collisionLon": 116.417634, - "stopLines":[ + "stopLines": [ { - "lat": 39.977082, - "lon": 116.417553 + "lat": 39.976858, + "lon": 116.417651 }, { - "lat": 39.977078, - "lon": 116.417666 + "lat": 39.976874, + "lon": 116.417757 } ], "from": 1, - "angle": 120, + "angle": 0, "direction": 10014, "speed": 11.108121, "targetColor": "#FF4040", - "stopLineDistance": 20, + "stopLineDistance": 30, "stopLineLat": 39.977094, "stopLineLon": 116.417634, "warningContent": "小心行人", diff --git a/modules/mogo-module-v2x/src/main/res/values/colors.xml b/modules/mogo-module-v2x/src/main/res/values/colors.xml index cb5b32ca4c..f3c8c733f3 100644 --- a/modules/mogo-module-v2x/src/main/res/values/colors.xml +++ b/modules/mogo-module-v2x/src/main/res/values/colors.xml @@ -20,4 +20,6 @@ #4C83FF #FF3036 + + #F63A35 \ No newline at end of file