日志,存在停止线状态的预警线
This commit is contained in:
@@ -77,22 +77,21 @@ public class V2XWarningMarker implements IV2XMarker {
|
||||
|
||||
public void drawLineWithEntity() {
|
||||
showTime = mCloundWarningInfo.getShowTime() > 0 ? mCloundWarningInfo.getShowTime() * 1000 : 6000;
|
||||
Log.d(TAG, "显示时间为++" + String.valueOf(showTime) + "识别物类型:" +
|
||||
String.valueOf(mCloundWarningInfo.getType()));
|
||||
|
||||
fillPointOnStopLine();
|
||||
bearing = V2XLocationListener.getInstance().getLastCarLocation().getBearing();
|
||||
isSelfLineClear = false;
|
||||
isFirstLocation = false;
|
||||
if (fillPoints.size() > 0) {
|
||||
//存在停止线的情况 自车与停止线之间绘制蓝色安全线 停止线向前50m绘制红色预警线
|
||||
//先获取自车与停止线之间的点
|
||||
middleLocationInStopLine = getMiddleLocationInStopLine();
|
||||
//获取停止线前方50m坐标点
|
||||
MogoLatLng warningLocation = Trigonometric.getNewLocation(middleLocationInStopLine,
|
||||
50, mCloundWarningInfo.getAngle());
|
||||
//停止线前方画线
|
||||
WorkThreadHandler.getInstance().postDelayed(() -> {
|
||||
if (carLocation.lat != 0 && carLocation.lon != 0) {
|
||||
//自车与停止线直线绘制蓝色预警线
|
||||
//在自车与停止线直线绘制蓝色预警线
|
||||
drawSelfCarLine(carLocation.lon, carLocation.lat, bearing);
|
||||
} else {
|
||||
Log.d(TAG, "自车定位数据为空carLocation == null");
|
||||
@@ -106,7 +105,8 @@ public class V2XWarningMarker implements IV2XMarker {
|
||||
//添加停止线marker
|
||||
handleStopLine();
|
||||
}, 0);
|
||||
|
||||
Log.d(TAG, "显示时间为++" + String.valueOf(showTime) + "识别物类型:" +
|
||||
String.valueOf(mCloundWarningInfo.getType()));
|
||||
clearAllLine();
|
||||
|
||||
} else { //无停止线
|
||||
@@ -132,6 +132,10 @@ public class V2XWarningMarker implements IV2XMarker {
|
||||
(mCloundWarningInfo.getDirection(), MogoReceiver.ACTION_V2X_FRONT_WARNING);
|
||||
}
|
||||
|
||||
/*绘制停止线前方50m的红色预警线
|
||||
* startLatLng: 划线起点=停止线上的坐标点
|
||||
* mogoLatLng: 停止线前方50m坐标点
|
||||
* */
|
||||
private void drawRedWarningLineFrontOfStopLine(V2XWarningEntity info, MogoLatLng
|
||||
startLatLng, MogoLatLng mogoLatLng) {
|
||||
if (info != null) {
|
||||
@@ -141,9 +145,6 @@ public class V2XWarningMarker implements IV2XMarker {
|
||||
endLatlng.lon, endLatlng.lat);
|
||||
MogoLatLng addMiddleLoc = Trigonometric.getNewLocation(startLatLng, distance / 2,
|
||||
mCloundWarningInfo.getAngle());
|
||||
Log.d(TAG, "停止线前方50m区域的三个坐标点是:" + startLatLng.lon + "," + startLatLng.lat +
|
||||
"中间点坐标:" + addMiddleLoc.lon + "," + addMiddleLoc.lat
|
||||
+ "终点" + endLatlng.lon + "," + endLatlng.lat);
|
||||
if (polyLine != null) {
|
||||
Log.d(V2XConst.LOG_NAME_WARN, "drawStopLine polyLine != null");
|
||||
polyLine.setPoints(Arrays.asList(startLatLng, addMiddleLoc, endLatlng));
|
||||
@@ -161,6 +162,9 @@ public class V2XWarningMarker implements IV2XMarker {
|
||||
V2XServiceManager.getMoGoStopPolylineManager().drawStopPolyline(getContext(), lineInfo);
|
||||
}
|
||||
clearAllLine();
|
||||
Log.d(TAG, "停止线前方50m区域的三个坐标点是:" + startLatLng.lon + "," + startLatLng.lat +
|
||||
"中间点坐标:" + addMiddleLoc.lon + "," + addMiddleLoc.lat
|
||||
+ "终点" + endLatlng.lon + "," + endLatlng.lat);
|
||||
} else {
|
||||
clearAllLine();
|
||||
}
|
||||
@@ -168,7 +172,7 @@ public class V2XWarningMarker implements IV2XMarker {
|
||||
|
||||
public void clearAllLine() {
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
Log.d(TAG, "清除所有预警线的时间是:" + String.valueOf(System.currentTimeMillis()));
|
||||
Log.d(TAG, "清除所有预警线的时间是:" + String.valueOf(showTime));
|
||||
//清除识别物到碰撞点预警线
|
||||
V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine();
|
||||
//清除车到碰撞点预警线
|
||||
@@ -241,16 +245,16 @@ public class V2XWarningMarker implements IV2XMarker {
|
||||
}
|
||||
|
||||
/*
|
||||
* 自车前方的点,在停止线上--通过自车位置与距离停止线之间的距离计算
|
||||
* 自车前方的点,落点在停止线上--通过自车位置与距离停止线之间的距离计算
|
||||
* */
|
||||
private MogoLatLng getMiddleLocationInStopLine() {
|
||||
Log.d(TAG, "计算停止线上的某个点" + String.valueOf(carLocation.lat + "," +
|
||||
String.valueOf(carLocation.lon)));
|
||||
if (carLocation.lat == 0 || carLocation.lon == 0) {
|
||||
Log.d(TAG, "获取不到车的位置");
|
||||
}
|
||||
MogoLatLng newLocation = Trigonometric.getNewLocation(carLocation, mCloundWarningInfo.getStopLineDistance(),
|
||||
mCloundWarningInfo.getAngle());
|
||||
Log.d(TAG, "计算停止线上的某个点" + String.valueOf(carLocation.lat + "," +
|
||||
String.valueOf(carLocation.lon)));
|
||||
return newLocation;
|
||||
}
|
||||
|
||||
@@ -282,15 +286,12 @@ public class V2XWarningMarker implements IV2XMarker {
|
||||
//扩展点为了渐变色添加
|
||||
addMiddleLoc = Trigonometric.getNewLocation(startLatlng, distance / 2,
|
||||
Trigonometric.getAngle(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat));
|
||||
Log.d(TAG, "自车为起点绘制 自车;" + startLatlng.lon + "," + startLatlng.lat +
|
||||
"中间扩展点" + addMiddleLoc.lon + "," + addMiddleLoc.lat + "终点:" + endLatlng.lon + "," + endLatlng.lat);
|
||||
|
||||
if (mogoPolyline != null) {
|
||||
mogoPolyline.setPoints(Arrays.asList(startLatlng, addMiddleLoc, endLatlng));
|
||||
mogoPolyline.setTransparency(0.5f);
|
||||
} else {
|
||||
DrawLineInfo info = new DrawLineInfo(); // 对象
|
||||
Log.d(TAG, "安全区域蓝色预警线" + "起点:" + startLatlng + "中间点:" + addMiddleLoc + "终点:" + endLatlng);
|
||||
List locations = new ArrayList();
|
||||
locations.add(startLatlng);
|
||||
locations.add(addMiddleLoc);
|
||||
@@ -299,9 +300,12 @@ public class V2XWarningMarker implements IV2XMarker {
|
||||
info.setHeading(bearing);
|
||||
info.setWidth(mCloundWarningInfo.getRoadwidth() * 14 + 5);
|
||||
info.setDirection(mCloundWarningInfo.getDirection());
|
||||
Log.d(TAG, "绘制自车与碰撞点之间的预警线+time=" + String.valueOf(System.currentTimeMillis()));
|
||||
V2XServiceManager.getMoGoWarnPolylineManager().drawWarnPolyline(getContext(), info);
|
||||
Log.d(TAG, "安全区域蓝色预警线" + "起点:" + startLatlng + "中间点:" + addMiddleLoc + "终点:" + endLatlng);
|
||||
Log.d(TAG, "绘制自车与碰撞点之间的预警线+time=" + String.valueOf(System.currentTimeMillis()));
|
||||
}
|
||||
Log.d(TAG, "自车为起点绘制 自车;" + startLatlng.lon + "," + startLatlng.lat +
|
||||
"中间扩展点" + addMiddleLoc.lon + "," + addMiddleLoc.lat + "终点:" + endLatlng.lon + "," + endLatlng.lat);
|
||||
clearAllLine();
|
||||
} else {
|
||||
clearAllLine();
|
||||
@@ -328,16 +332,16 @@ public class V2XWarningMarker implements IV2XMarker {
|
||||
//识别物到预碰撞点之间的箭头
|
||||
addArrows(startLatlng, endLatlng);
|
||||
DrawLineInfo lineInfo = new DrawLineInfo();
|
||||
Log.d(TAG, "目标物与预碰撞点画线点为" + "起点:" + startLatlng + "中间点:" + addMiddleLoc + "终点:" + endLatlng);
|
||||
List locations = new ArrayList();
|
||||
locations.add(startLatlng);
|
||||
locations.add(addMiddleLoc);
|
||||
locations.add(endLatlng);
|
||||
lineInfo.setLocations(locations);
|
||||
lineInfo.setHeading(info.heading);
|
||||
Log.d(V2XConst.LOG_NAME_WARN, "drawOtherObjectLine width = " + info.getRoadwidth());
|
||||
lineInfo.setWidth(info.getRoadwidth() * 14 + 5);
|
||||
V2XServiceManager.getMoGoPersonWarnPolylineManager().drawPersonWarnPolyline(getContext(), lineInfo);
|
||||
Log.d(TAG, "道路宽度为" + info.getRoadwidth());
|
||||
Log.d(TAG, "目标物与预碰撞点画线点为" + "起点:" + startLatlng + "中间点:" + addMiddleLoc + "终点:" + endLatlng);
|
||||
}
|
||||
} else {
|
||||
Log.e(V2XConst.LOG_NAME_WARN, "info == null");
|
||||
@@ -356,17 +360,17 @@ public class V2XWarningMarker implements IV2XMarker {
|
||||
for (int i = 0; i < count; i++) {
|
||||
MogoLatLng newLo = Trigonometric.getNewLocation(
|
||||
startLatLng, 5 * (i + 1), Trigonometric.getAngle(startLatLng.lon, startLatLng.lat, endLatLng.lon, endLatLng.lat));
|
||||
Log.d(TAG, "小箭头位置" + newLo);
|
||||
V2XWarnDataDrawer.getInstance().drawerArrowsMarkerWithLocation(newLo, WARNING_ARROWS, 10, new Double(rotate).intValue());
|
||||
Log.d(TAG, "小箭头位置" + newLo);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//线随车动
|
||||
public void onCarLocationChanged2(Location latLng) {
|
||||
carLocation = new MogoLatLng(latLng.getLatitude(), latLng.getLongitude());
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() && isSelfLineClear == false) {
|
||||
//当行人经纬度交点 开始画线,否则清理
|
||||
if (mCloundWarningInfo != null) {
|
||||
mCloundWarningInfo.setCarLocation(new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user