fixed conflict

This commit is contained in:
lixiaopeng
2021-04-15 18:47:21 +08:00
parent 1fec99bfc3
commit 1b1c70a6a1
2 changed files with 27 additions and 12 deletions

View File

@@ -10,6 +10,7 @@ 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.MarkerDrawer;
import com.mogo.module.common.constants.AdasRecognizedType;
import com.mogo.module.common.drawer.V2XWarnDataDrawer;
import com.mogo.module.common.entity.MarkerShowEntity;
@@ -22,6 +23,7 @@ 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.listener.V2XLocationListener;
import com.mogo.module.v2x.manager.IMoGoV2XCloundDataManager;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.WorkThreadHandler;
@@ -50,6 +52,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
private MogoLatLng middleLocationInStopLine;
private static long showTime = 0;
private float bearing;
@Override
public void init(Context context) {
@@ -64,6 +67,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
mCloundWarningInfo = cloundWarningInfo;
showTime = mCloundWarningInfo.getShowTime();
pointsBetween();
bearing = V2XLocationListener.getInstance().getLastCarLocation().getBearing();
//预警蒙层
MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(cloundWarningInfo.getType(), MogoReceiver.ACTION_V2X_FRONT_WARNING);
@@ -81,6 +85,11 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
drawStopLine(cloundWarningInfo, middleLocationInStopLine, warningLocation);
//添加停止线marker
handleStopLine();
//自车画线
// drawSlefCarLine(MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon(),
// MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat(),
// bearing);
}, 500);
UiThreadHandler.postDelayed(() -> {
@@ -96,6 +105,12 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
drawOtherObjectLine(cloundWarningInfo);
//二轮车和行人的渲染和移动
V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo);
//车辆静止的时候 TODO
// drawSlefCarLine(MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon(),
// MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat(),
// bearing);
}, 500);
//延迟3秒清理线
@@ -149,7 +164,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
lineInfo.setLocations(locations);
lineInfo.setHeading(info.heading);
Log.d(V2XConst.LOG_NAME_WARN, "drawStopLine width = " + info.getRoadwidth());
lineInfo.setWidth(info.getRoadwidth() * 10 + 5);
lineInfo.setWidth(info.getRoadwidth() * 13 + 5);
V2XServiceManager.getMoGoStopPolylineManager().drawStopPolyline(getContext(), lineInfo);
}
} else {
@@ -182,7 +197,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
lineInfo.setLocations(locations);
lineInfo.setHeading(info.heading);
Log.d(V2XConst.LOG_NAME_WARN, "drawOtherObjectLine width = " + info.getRoadwidth());
lineInfo.setWidth(info.getRoadwidth() * 10 + 5);
lineInfo.setWidth(info.getRoadwidth() * 13 + 5);
V2XServiceManager.getMoGoPersonWarnPolylineManager().drawPersonWarnPolyline(getContext(), lineInfo);
//识别物到预碰撞点之间的箭头
addArrows(startLatlng, endLatlng);
@@ -218,32 +233,32 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
}
/**
* 自车定位 移动完成需要 3s消失,这里何时清理,应该是没有数据的时候
*/
@Override
public void onCarLocationChanged2(Location latLng) {
// Log.d(V2XConst.LOG_NAME_WARN, "onCarLocationChanged2 latLng = " + latLng.getLatitude() + "--" + latLng.getLongitude() + "---isSelfLineClear = " + isSelfLineClear);
// Log.d(V2XConst.LOG_NAME_WARN, "onCarLocationChanged2 lat = " + latLng.getLatitude() + "--lon =" + latLng.getLongitude() + "---isSelfLineClear = " + isSelfLineClear);
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
//当行人经纬度交点 开始画线,否则清理
if (mCloundWarningInfo != null) {
mCloundWarningInfo.setCarLocation(new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()));
}
drawSlefCarLine(latLng);
drawSlefCarLine(latLng.getLongitude(), latLng.getLatitude(), latLng.getBearing());
}
carLocation = new MogoLatLng(latLng.getLatitude(), latLng.getLongitude());
drawSlefCarLine(latLng);
}
@Override
public void onCarLocationChanged(MogoLatLng latLng) {
Log.d("liyz", "latLng -- lon = " + latLng.lon + "----lat = " + latLng.lat);
}
/**
* 绘制安全区域,自车与碰撞点之间的蓝色线
*/
private void drawSlefCarLine(Location latLng) {
private void drawSlefCarLine(double lon, double lat, float bearing) {
if (!isSelfLineClear) {
IMogoPolyline mogoPolyline = V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline();
if (mCloundWarningInfo != null) {
@@ -251,9 +266,8 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
MogoLatLng endLatlng = null;
MogoLatLng addMiddleLoc = null;
if (!isFirstLocation) {
//自车位置
startLatlng = new MogoLatLng(latLng.getLatitude(), latLng.getLongitude());
carLocation = getMogoLat(new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()));
startLatlng = new MogoLatLng(lat, lon);
carLocation = getMogoLat(new MogoLatLng(lat, lon));
endLatlng = new MogoLatLng(mCloundWarningInfo.getDirection() == 1 ? carLocation.lat : mCloundWarningInfo.getCollisionLat(),
mCloundWarningInfo.getDirection() == 1 ? carLocation.lon : mCloundWarningInfo.getCollisionLon());
float distance = CoordinateUtils.calculateLineDistance(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat);
@@ -272,8 +286,8 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
locations.add(addMiddleLoc);
locations.add(endLatlng);
info.setLocations(locations);
info.setHeading(latLng.getBearing());
info.setWidth(mCloundWarningInfo.getRoadwidth() * 10 + 5);
info.setHeading(bearing);
info.setWidth(mCloundWarningInfo.getRoadwidth() * 13 + 5);
info.setDirection(mCloundWarningInfo.getDirection());
V2XServiceManager.getMoGoWarnPolylineManager().drawWarnPolyline(getContext(), info);
}