add push and opt

This commit is contained in:
lixiaopeng
2021-04-16 17:54:03 +08:00
parent b72c490664
commit b675432059
5 changed files with 20 additions and 24 deletions

View File

@@ -111,7 +111,7 @@ public class V2XWaringManager {
if (v2XWarnMessageListener != null) {
V2XServiceManager
.getMoGoSocketManager()
.unregisterOnMessageListener(10116, v2XWarnMessageListener);
.unregisterOnMessageListener(401018, v2XWarnMessageListener);
}
}
@@ -123,7 +123,7 @@ public class V2XWaringManager {
V2XServiceManager
.getMoGoSocketManager()
.registerOnMessageListener(
10116,
401018,
v2XWarnMessageListener );
}

View File

@@ -10,6 +10,7 @@ import com.mogo.service.connection.IMogoOnMessageListener;
/**
* desc: 下发的云端预警数据
*
*/
public class V2XWarnMessageListener implements IMogoOnMessageListener<V2XWarningEntity> {

View File

@@ -12,14 +12,10 @@ import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
import com.mogo.map.overlay.IMogoPolyline;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.drawer.MarkerDrawer;
import com.mogo.module.common.constants.AdasRecognizedType;
import com.mogo.module.common.drawer.V2XWarnDataDrawer;
import com.mogo.module.common.entity.MarkerShowEntity;
import com.mogo.module.common.entity.V2XWarningEntity;
import com.mogo.module.common.utils.Trigonometric;
import com.mogo.module.service.MarkerServiceHandler;
import com.mogo.module.service.ServiceConst;
import com.mogo.module.service.receiver.MogoReceiver;
import com.mogo.module.v2x.MoGoV2XServicePaths;
import com.mogo.module.v2x.V2XConst;
@@ -52,6 +48,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat(),
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon()
);
/*
* 自车前方的点,在停止线上--通过自车位置与距离停止线之间的距离计算
* */
@@ -71,7 +68,6 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
@Override
public void analysisV2XCloundDataEvent(V2XWarningEntity cloundWarningInfo) {
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
Log.d(V2XConst.LOG_NAME_WARN, "analysisV2XCloundDataEvent -----> ");
mCloundWarningInfo = cloundWarningInfo;
showTime = mCloundWarningInfo.getShowTime();
pointsBetween();
@@ -274,33 +270,31 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
* 自车为起点绘制(根据设计,前方行人/弱势交通参与者预警 getDirection() == 1 自车与停止线之间为蓝色预警;其他侧方预警自车与预碰撞点之间显示红色预警)
*/
private void drawSlefCarLine(double lon, double lat, float bearing) {
// Log.d("liyz", "-------1-------- isSelfLineClear = " + isSelfLineClear + "--lon =" + lon + "---lat = " + lat);
if (!isSelfLineClear) {
IMogoPolyline mogoPolyline = V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline();
if (mCloundWarningInfo != null) {
MogoLatLng startLatlng = null;
MogoLatLng endLatlng = null;
MogoLatLng addMiddleLoc = null;
if (!isFirstLocation) {
//自车位置
startLatlng = new MogoLatLng(lat, lon);
carLocation = getMogoLat(new MogoLatLng(lat, lon));
endLatlng = new MogoLatLng(mCloundWarningInfo.getDirection() == 1 ? middleLocationInStopLine.lat : mCloundWarningInfo.getCollisionLat(),
mCloundWarningInfo.getDirection() == 1 ? middleLocationInStopLine.lon : mCloundWarningInfo.getCollisionLon());
float distance = CoordinateUtils.calculateLineDistance(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat);
addMiddleLoc = Trigonometric.getNewLocation(startLatlng, distance / 2, Trigonometric.getAngle(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat));
Log.d(TAG, "自车为起点绘制 自车;" + startLatlng.lat + "," + startLatlng.lon +
"中间扩展点" + addMiddleLoc.lon + "," + addMiddleLoc.lat + "终点:" + endLatlng.lon + "," + endLatlng.lat);
if (!isFirstLocation) {
carLocation = getMogoLat(new MogoLatLng(lat, lon));
isFirstLocation = true;
}
//自车位置
endLatlng = new MogoLatLng(mCloundWarningInfo.getDirection() == 1 ? middleLocationInStopLine.lat : mCloundWarningInfo.getCollisionLat(),
mCloundWarningInfo.getDirection() == 1 ? middleLocationInStopLine.lon : mCloundWarningInfo.getCollisionLon());
startLatlng = new MogoLatLng(lat, lon);
float distance = CoordinateUtils.calculateLineDistance(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat);
addMiddleLoc = Trigonometric.getNewLocation(startLatlng, distance / 2, Trigonometric.getAngle(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat));
Log.d(TAG, "自车为起点绘制 自车;" + startLatlng.lat + "," + startLatlng.lon +
"中间扩展点" + addMiddleLoc.lon + "," + addMiddleLoc.lat + "终点:" + endLatlng.lon + "," + endLatlng.lat);
if (mogoPolyline != null) {
// Log.d("liyz", "-------2-------- lon =" + lon + "---lat = " + lat);
mogoPolyline.setPoints(Arrays.asList(startLatlng, addMiddleLoc, endLatlng));
mogoPolyline.setTransparency(0.5f);
} else {
// Log.d("liyz", "-------3-------- lon =" + lon + "---lat = " + lat);
DrawLineInfo info = new DrawLineInfo(); // 对象
Log.d(TAG, "安全区域的画线点为" + "起点:" + startLatlng + "中间点:" + addMiddleLoc + "终点:" + endLatlng);
List locations = new ArrayList();

View File

@@ -56,7 +56,6 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager {
// 线条粗细,渐变,渐变色值
// 当前车辆位置
options.width(info.getWidth() == 0.0 ? 60 : info.getWidth()).useGradient(true).colorValues(colors);
// options.width(60).useGradient(true).colorValues(colors);
List<MogoLatLng> locations = info.getLocations();
for (int i = 0; i < locations.size(); i++) {
options.add(locations.get(i));

View File

@@ -95,7 +95,7 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopV
.getMogoTopViewManager()
.addView(getV2XWindow().getView(), layoutParams, this);
getV2XWindow().show(mMarkerEntity);
getV2XMarker().drawPOI(mMarkerEntity);
// getV2XMarker().drawPOI(mMarkerEntity);
}
}
@@ -116,8 +116,10 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopV
@Override
public void drawPOI() {
getV2XMarker().drawPOI(mMarkerEntity);
Log.d(TAG, "drawPOI");
if (getV2XMarker() != null) {
getV2XMarker().drawPOI(mMarkerEntity);
Log.d(TAG, "drawPOI");
}
}
@Override