Merge remote-tracking branch 'origin/dev_merge_shunyi_vr_map' into dev_merge_shunyi_vr_map
# Conflicts: # modules/mogo-module-service/src/main/java/com/mogo/module/service/location/MogoRTKLocation.java
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
package com.mogo.module.v2x;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.SystemClock;
|
||||
@@ -30,6 +32,7 @@ import com.zhidao.mogo.module.obu.obu.bean.MogoObuEventInfo;
|
||||
import com.zhidao.mogo.module.obu.obu.bean.MogoObuLocationInfo;
|
||||
import com.zhidao.mogo.module.obu.obu.bean.MogoObuTrafficLightInfo;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -66,19 +69,24 @@ public class V2XObuManager implements IObuCallback, Handler.Callback {
|
||||
|
||||
private static final int MSG_HIDE_TRAFFIC_LIGHT = 1001;
|
||||
private static final long DEFAULT_HIDE_TRAFFIC_LIGHT_DELAY = 1500L;
|
||||
private Handler handler = new Handler(this);
|
||||
private final Handler handler = new Handler(this);
|
||||
private final ObuTypeExchangeReceiver obuTypeExchangeReceiver = new ObuTypeExchangeReceiver();
|
||||
private ObuManager obuManager;
|
||||
|
||||
public void init(Context context) {
|
||||
Logger.d(MODULE_NAME, "obuManager初始化--");
|
||||
ObuManager obuManager = new ObuManager();
|
||||
obuManager = new ObuManager();
|
||||
obuManager.init(context);
|
||||
obuManager.registerObuDataChangedListener(this);
|
||||
|
||||
IntentFilter filter = new IntentFilter("com.mogo.launcher.v2x.action.EXCHANGE_OBU_TYPE");
|
||||
context.registerReceiver(obuTypeExchangeReceiver, filter);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用来处理30秒内不重复播报的情况
|
||||
*/
|
||||
private Map<String, Long> intervalMap = new ArrayMap<>();
|
||||
private final Map<String, Long> intervalMap = new ArrayMap<>();
|
||||
|
||||
private int parseObuEvent(String type) {
|
||||
switch (type) {
|
||||
@@ -98,7 +106,7 @@ public class V2XObuManager implements IObuCallback, Handler.Callback {
|
||||
}
|
||||
}
|
||||
|
||||
private MogoLocation[] historyPath = new MogoLocation[2];
|
||||
private final MogoLocation[] historyPath = new MogoLocation[2];
|
||||
|
||||
private float computeCarAngle(MogoLocation location) {
|
||||
float angle = 0f;
|
||||
@@ -142,6 +150,10 @@ public class V2XObuManager implements IObuCallback, Handler.Callback {
|
||||
} else {
|
||||
json.put("surplusTime", trafficLightInfo.getSurplusTime());
|
||||
}
|
||||
JSONArray lightJsonArray = new JSONArray(trafficLightInfo.getLightArray());
|
||||
JSONArray surplusTimeJsonArray = new JSONArray(trafficLightInfo.getSurplusTimeArray());
|
||||
json.put("lightArray", lightJsonArray);
|
||||
json.put("surplusTimeArray", surplusTimeJsonArray);
|
||||
}
|
||||
String data = json.toString();
|
||||
Logger.d(MODULE_NAME, "发送红绿灯广播: " + data);
|
||||
@@ -172,7 +184,7 @@ public class V2XObuManager implements IObuCallback, Handler.Callback {
|
||||
}
|
||||
// int eventType = parseObuEvent(info.getTypeCode());
|
||||
int eventType = info.getMogoEventId();
|
||||
if (eventType == ObuConstant.TYPE_OPTIMAL_SPEED_ADVISORY&& DebugConfig.getObuType() == DebugConfig.OBU_TYPE_CIDI) {
|
||||
if (eventType == ObuConstant.TYPE_OPTIMAL_SPEED_ADVISORY && DebugConfig.getObuType() == DebugConfig.OBU_TYPE_CIDI) {
|
||||
// 加一个容错机制,如果已经驶过绿波车速路口,那么再收到绿波车速obu事件,就不再上报
|
||||
MogoLocation currentLocation = V2XLocationListener.getInstance().getLastCarLocation();
|
||||
double eventAngle = DrivingDirectionUtils.getDegreeOfCar2Poi(
|
||||
@@ -187,7 +199,7 @@ public class V2XObuManager implements IObuCallback, Handler.Callback {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (SystemClock.elapsedRealtime() - last > DEFAULT_INTERVAL_TIME||DebugConfig.getObuType() == DebugConfig.OBU_TYPE_HUALI) {
|
||||
if (SystemClock.elapsedRealtime() - last > DEFAULT_INTERVAL_TIME || DebugConfig.getObuType() == DebugConfig.OBU_TYPE_HUALI) {
|
||||
// 距离上次记录超过三十秒,继续相关逻辑,如果不超过三十秒,忽略此次事件
|
||||
// 华砺智行obu暂时去掉此判断
|
||||
intervalMap.put(info.getTypeCode(), SystemClock.elapsedRealtime());
|
||||
@@ -249,17 +261,17 @@ public class V2XObuManager implements IObuCallback, Handler.Callback {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
Logger.d(TAG,"未超过时限,不展示事件");
|
||||
} else {
|
||||
Logger.d(TAG, "未超过时限,不展示事件");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocationInfoCallback( MogoObuLocationInfo locationInfo) {
|
||||
public void onLocationInfoCallback(MogoObuLocationInfo locationInfo) {
|
||||
if (ObuConfig.useObuLocation) {
|
||||
MogoLocation currentLocation = new MogoLocation();
|
||||
|
||||
double coor[] = CoordinateUtils.transformFromWGSToGCJ( locationInfo.getLat(), locationInfo.getLon() );
|
||||
double coor[] = CoordinateUtils.transformFromWGSToGCJ(locationInfo.getLat(), locationInfo.getLon());
|
||||
|
||||
currentLocation.setLatitude(coor[0]);
|
||||
currentLocation.setLongitude(coor[1]);
|
||||
@@ -282,4 +294,12 @@ public class V2XObuManager implements IObuCallback, Handler.Callback {
|
||||
sendTrafficLightStatusToAdas(CALL_ADAS_SHOW_TRAFFIC_LIGHT, trafficLightInfo);
|
||||
}
|
||||
}
|
||||
|
||||
class ObuTypeExchangeReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
int obuType = intent.getIntExtra("obuType", DebugConfig.OBU_TYPE_CIDI);
|
||||
obuManager.resetObuType(obuType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,14 +4,17 @@ import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.common.drawer.MarkerDrawer;
|
||||
import com.mogo.module.common.drawer.marker.IMarkerView;
|
||||
import com.mogo.module.common.drawer.marker.MapMarkerAdapter;
|
||||
import com.mogo.module.common.drawer.marker.RoadConditionInfoWindow3DAdapter;
|
||||
import com.mogo.module.common.entity.MarkerCardResult;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerLocation;
|
||||
@@ -532,6 +535,13 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
|
||||
.longitude(roadEventEntity.getLocation().getLon());
|
||||
optionsRipple.anchor(0.5f, 0.5f);
|
||||
|
||||
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
|
||||
MarkerExploreWay markerExploreWay = roadEventEntity.getNoveltyInfo();
|
||||
markerShowEntity.setBindObj(markerExploreWay);
|
||||
markerShowEntity.setMarkerLocation(markerExploreWay.getLocation());
|
||||
markerShowEntity.setMarkerType(markerExploreWay.getPoiType());
|
||||
markerShowEntity.setTextContent(markerExploreWay.getPoiType());
|
||||
|
||||
// 由于性能问题,D车机不使用事件扩散动画
|
||||
if (!CarSeries.isF8xxSeries()) {
|
||||
optionsRipple.icon(V2XMarkerAdapter.getV2XRoadEventViewPng(context, roadEventEntity));
|
||||
@@ -539,8 +549,13 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
|
||||
optionsRipple.icons(V2XMarkerAdapter.getV2XRoadEventViewGif(context, roadEventEntity));
|
||||
optionsRipple.period(1);
|
||||
}
|
||||
|
||||
mAlarmInfoMarker = V2XServiceManager.getMarkerManager().addMarker(V2X_EVENT_ALARM_POI, optionsRipple);
|
||||
if (V2XServiceManager.getMoGoStatusManager().isVrMode()) {
|
||||
mAlarmInfoMarker = MarkerDrawer.getInstance().drawMapMarkerImpl(markerShowEntity, MarkerDrawer.MARKER_Z_INDEX_HIGH, clickListener);
|
||||
mAlarmInfoMarker.setInfoWindowAdapter(new RoadConditionInfoWindow3DAdapter(markerShowEntity, AbsMogoApplication.getApp(), mAlarmInfoMarker.getMogoMarkerOptions()));
|
||||
mAlarmInfoMarker.showInfoWindow();
|
||||
} else {
|
||||
mAlarmInfoMarker = V2XServiceManager.getMarkerManager().addMarker(V2X_EVENT_ALARM_POI, optionsRipple);
|
||||
}
|
||||
// 当前Marker设置为最上面
|
||||
mAlarmInfoMarker.setToTop();
|
||||
// 绘制连接线
|
||||
|
||||
@@ -106,6 +106,9 @@ public class V2XAnimationWindow extends ConstraintLayout implements IV2XWindow<V
|
||||
});
|
||||
vvCarAnimation.start();
|
||||
Logger.w(MODULE_NAME, "开始播放动画。。。。。");
|
||||
if (mV2XWindowStatusListener != null) {
|
||||
mV2XWindowStatusListener.onViewShow();
|
||||
}
|
||||
}
|
||||
if (tts != null) {
|
||||
AIAssist.getInstance(V2XServiceManager.getContext()).speakTTSVoice(tts);
|
||||
|
||||
Reference in New Issue
Block a user