停止线绘制测试数据

This commit is contained in:
liujing
2021-04-12 12:21:57 +08:00
parent c7621f3780
commit c61ed0930d
3 changed files with 22 additions and 18 deletions

View File

@@ -47,6 +47,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
private static String TAG = "MoGoV2XCloundDataManager";
private boolean isSelfLineClear;
private List fillPoints = new ArrayList();//停止线经纬度合集
private static long showTime = 0;
@Override
public void init(Context context) {
@@ -59,6 +60,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
Log.d(V2XConst.LOG_NAME_WARN, "analysisV2XCloundDataEvent -----> ");
mCloundWarningInfo = cloundWarningInfo;
showTime = mCloundWarningInfo.getShowTime();
pointsBetween();
//发送预警提示
@@ -68,10 +70,10 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
Log.d(V2XConst.LOG_NAME_WARN, "direction = " + cloundWarningInfo.getDirection());
if (cloundWarningInfo.getDirection() == 1) { //前方
//停止线前方画线
MogoLatLng newLocation = LocationUtils.getNewLocation((MogoLatLng) fillPoints.get(0), 80, cloundWarningInfo.getAngle());
//停止线前方画线
WorkThreadHandler.getInstance().postDelayed(() -> {
//添加停止线marker
//添加停止线
drawStopLineWith2Resource();
//二轮车和行人的渲染和移动
V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo);
@@ -84,7 +86,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
V2XServiceManager.getMoGoStopPolylineManager().clearLine();
isSelfLineClear = true;
}, 8000);
}, showTime);
} else { //左侧或者右侧
WorkThreadHandler.getInstance().postDelayed(() -> {
@@ -98,9 +100,8 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
UiThreadHandler.postDelayed(() -> {
V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine();
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
isSelfLineClear = true;
}, 8000);
}, showTime);
}
}
@@ -124,10 +125,6 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
* 2D资源绘制停止线
* */
private void drawStopLineWith2Resource() {
//自车位置39.97665425796924--116.41769983329762
mCloundWarningInfo.setCarLocation(new MogoLatLng(39.97665425796924,116.41769983329762));//测试数据
MogoLatLng carlo = mCloundWarningInfo.getCarLocation();
if (carlo == null) {
double lon = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon();
@@ -136,11 +133,11 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
}
//自车行驶方向的前方*米的经纬度,该经纬度在停止线上
MogoLatLng drawStopLineLon = LocationUtils.getNewLocation(carlo, mCloundWarningInfo.getStopLineDistance(), mCloundWarningInfo.getAngle());
Log.d(TAG, "2D资源绘制停止线"+drawStopLineLon);
Log.d(TAG, "2D资源绘制停止线" + drawStopLineLon);
MogoMarkerOptions optionsRipple = new MogoMarkerOptions()
.latitude(drawStopLineLon.getLat())
.longitude(drawStopLineLon.getLon())
.anchor(0.5f, 0.5f)
.anchor(1.0f, 1.0f)
.zIndex(MarkerDrawer.MARKER_Z_INDEX_HIGH);
optionsRipple
@@ -148,9 +145,9 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
IMogoMarker stopLine = V2XServiceManager.getMarkerManager().addMarker(TYPE_MARKER_CLOUD_STOP_LINE_DATA, optionsRipple);
stopLine.setInfoWindowAdapter(new SimpleWindow3DAdapter(new V2XFrontTargetMarkerView(V2XServiceManager.getContext())));
stopLine.showInfoWindow();
// UiThreadHandler.postDelayed(() -> {
// stopLine.hideInfoWindow();
// }, 8000);
UiThreadHandler.postDelayed(() -> {
stopLine.hideInfoWindow();
}, showTime);
}
/**
@@ -302,7 +299,6 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
private MogoLatLng getMogoLat(MogoLatLng latlng) {
MogoLatLng newLocation = LocationUtils.getNewLocation(latlng, mCloundWarningInfo.getDistance(), mCloundWarningInfo.getDirection());
return newLocation;
}

View File

@@ -24,6 +24,7 @@ import com.mogo.module.v2x.marker.OptimalSpeedMarkerView;
import com.mogo.module.v2x.marker.V2XFrontTargetMarkerView;
import com.mogo.module.v2x.scenario.view.IV2XMarker;
import com.mogo.module.v2x.utils.LocationUtils;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.ViewUtils;
import com.mogo.utils.WorkThreadHandler;
@@ -65,6 +66,9 @@ public class V2XWarningMarker implements IV2XMarker {
optimalMarker = V2XServiceManager.getMarkerManager().addMarker(V2X_FRONT_WARNING_MARKER, optionsRipple);
optimalMarker.setInfoWindowAdapter(new SimpleWindow3DAdapter(new V2XFrontTargetMarkerView(mContext)));
optimalMarker.showInfoWindow();
UiThreadHandler.postDelayed(() -> {
optimalMarker.hideInfoWindow();
}, 8000);
} catch (Exception e) {