fixed conflict

This commit is contained in:
lixiaopeng
2021-04-12 16:14:16 +08:00
parent be610701c7
commit ecfc07a771
2 changed files with 25 additions and 26 deletions

View File

@@ -47,6 +47,9 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
private static String TAG = "MoGoV2XCloundDataManager";
private boolean isSelfLineClear;
private List fillPoints = new ArrayList();//停止线经纬度合集
private boolean isFirstLocation = false;
private MogoLatLng mNewLocation;
private static long showTime = 0;
@Override
@@ -58,17 +61,15 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
@Override
public void analysisV2XCloundDataEvent(V2XWarningEntity cloundWarningInfo) {
Log.d(V2XConst.LOG_NAME_WARN, "analysisV2XCloundDataEvent -----> ");
mCloundWarningInfo = cloundWarningInfo;
showTime = mCloundWarningInfo.getShowTime();
pointsBetween();
//发送预警提示
MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(cloundWarningInfo.getType(), MogoReceiver.ACTION_V2X_FRONT_WARNING);
isSelfLineClear = false;
isFirstLocation = false;
Log.d(V2XConst.LOG_NAME_WARN, "direction = " + cloundWarningInfo.getDirection());
if (cloundWarningInfo.getDirection() == 1) { //前方
MogoLatLng newLocation = LocationUtils.getNewLocation((MogoLatLng) fillPoints.get(0), 80, cloundWarningInfo.getAngle());
//停止线前方画线
@@ -79,7 +80,9 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo);
//绘制识别物与交汇点连线,并且更新连线数据
drawStopLine(cloundWarningInfo, newLocation);
}, 200);
//添加停止线marker
handleStopLine();
}, 800);
UiThreadHandler.postDelayed(() -> {
V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine();
@@ -94,7 +97,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
drawOtherObjectLine(cloundWarningInfo);
//二轮车和行人的渲染和移动
V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo);
}, 200);
}, 500);
//延迟3秒清理线
UiThreadHandler.postDelayed(() -> {
@@ -103,7 +106,6 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
isSelfLineClear = true;
}, showTime);
}
}
@@ -111,7 +113,6 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
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());
@@ -158,20 +159,15 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
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.setPoints(Arrays.asList(new MogoLatLng(mNewLocation.lat, mNewLocation.lon),
new MogoLatLng(mogoLatLng.lat, mogoLatLng.lon)));
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 startLatlng = new MogoLatLng(mNewLocation.lat, mNewLocation.lon);
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);
Log.d(V2XConst.LOG_NAME_WARN, " drawStopLine endLatlng lon =" + endLatlng.lon + "--lat =" + endLatlng.lat
+ "--startLatlng lon = " + startLatlng.lon + "-lat = " + startLatlng.lat);
lineInfo.setStartLocation(startLatlng);
lineInfo.setEndLocation(endLatlng);
lineInfo.setHeading(info.heading);
@@ -198,7 +194,6 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
new MogoLatLng(info.getCollisionLat(), info.getCollisionLon())));
polyLine.setTransparency(0.5f);
} else {
Log.e(V2XConst.LOG_NAME_WARN, "polyLine == null");
DrawLineInfo lineInfo = new DrawLineInfo();
MogoLatLng startLatlng = new MogoLatLng(info.getLat(), info.getLon());
MogoLatLng endLatlng = new MogoLatLng(info.getCollisionLat(), info.getCollisionLon());
@@ -225,7 +220,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
*/
@Override
public void onCarLocationChanged2(Location latLng) {
Log.e(V2XConst.LOG_NAME_WARN, "onCarLocationChanged2 latLng = " + latLng.getLatitude() + "--" + latLng.getLongitude() + "---isSelfLineClear = " + isSelfLineClear);
// Log.d(V2XConst.LOG_NAME_WARN, "onCarLocationChanged2 latLng = " + latLng.getLatitude() + "--" + latLng.getLongitude() + "---isSelfLineClear = " + isSelfLineClear);
//当行人经纬度交点 开始画线,否则清理
mCloundWarningInfo.setCarLocation(new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()));
drawSlefCarLine(latLng);
@@ -243,17 +238,22 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
if (!isSelfLineClear) {
IMogoPolyline mogoPolyline = V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline();
if (mCloundWarningInfo != null) {
if (!isFirstLocation) {
mNewLocation = getMogoLat(new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()));
Log.d(V2XConst.LOG_NAME_WARN, "drawSlefCarLine lon = " + mNewLocation.lon + "---lat = " + mNewLocation.lat);
isFirstLocation = true;
}
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())));
new MogoLatLng(mCloundWarningInfo.getDirection() == 1 ? mNewLocation.lat : mCloundWarningInfo.getCollisionLat(),
mCloundWarningInfo.getDirection() == 1 ? mNewLocation.lon : mCloundWarningInfo.getCollisionLon())));
mogoPolyline.setTransparency(0.5f);
} else {
Log.e(V2XConst.LOG_NAME_WARN, "onCarLocationChanged2 mogoPolyline == null width = " + mCloundWarningInfo.getRoadwidth());
// 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());
MogoLatLng endLatlng = new MogoLatLng(mCloundWarningInfo.getDirection() == 1 ? mNewLocation.lat : mCloundWarningInfo.getCollisionLat(),
mCloundWarningInfo.getDirection() == 1 ? mNewLocation.lon : mCloundWarningInfo.getCollisionLon());
info.setHeading(latLng.getBearing());
info.setStartLocation(startLatlng);
info.setEndLocation(endLatlng);
@@ -294,7 +294,6 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
} catch (Exception e) {
e.printStackTrace();
}
}
private MogoLatLng getMogoLat(MogoLatLng latlng) {