停止线添加到CloundManager类

This commit is contained in:
liujing
2021-04-09 19:23:41 +08:00
parent d7599cc4f2
commit eaeafaed09
5 changed files with 24 additions and 28 deletions

1
.idea/gradle.xml generated
View File

@@ -91,7 +91,6 @@
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings>
</option>
</component>

View File

@@ -126,6 +126,14 @@ public class V2XWarningEntity implements Serializable {
this.speed = speed;
}
public long getShowTime() {
return showTime;
}
public void setShowTime(long showTime) {
this.showTime = showTime;
}
public void setStopLineDistance(double stopLineDistance) {
this.stopLineDistance = stopLineDistance;

View File

@@ -34,6 +34,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_STOP_LINE_DATA;
import static com.mogo.module.v2x.V2XConst.V2X_FRONT_WARNING_MARKER;
import static com.mogo.module.v2x.V2XServiceManager.getContext;
@@ -47,7 +48,6 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
private boolean isSelfLineClear;
private List fillPoints = new ArrayList();//停止线经纬度合集
@Override
public void init(Context context) {
MogoApisHandler.getInstance().getApis().getRegisterCenterApi()
@@ -69,7 +69,7 @@ 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.heading);
MogoLatLng newLocation = LocationUtils.getNewLocation((MogoLatLng) fillPoints.get(0), 80, cloundWarningInfo.getAngle());
WorkThreadHandler.getInstance().postDelayed(() -> {
//二轮车和行人的渲染和移动
V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo);
@@ -83,7 +83,6 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine();
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
V2XServiceManager.getMoGoStopPolylineManager().clearLine();
isSelfLineClear = true;
}, 8000);
@@ -125,15 +124,19 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
* 2D资源绘制停止线
* */
private void drawStopLineWith2Resource() {
mCloundWarningInfo.setCarLocation(new MogoLatLng(39.976866,116.417622));//测试数据
//自车位置39.97665425796924--116.41769983329762
mCloundWarningInfo.setCarLocation(new MogoLatLng(39.97665425796924,116.41769983329762));//测试数据
MogoLatLng carlo = mCloundWarningInfo.getCarLocation();
if (carlo == null){
if (carlo == null) {
double lon = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon();
double lat = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat();
carlo = new MogoLatLng(lat, lon);
}
//自车行驶方向的前方*米的经纬度,该经纬度在停止线上
MogoLatLng drawStopLineLon = LocationUtils.getNewLocation(carlo, mCloundWarningInfo.getStopLineDistance(), mCloundWarningInfo.getAngle());
Log.d(TAG, "2D资源绘制停止线"+drawStopLineLon);
MogoMarkerOptions optionsRipple = new MogoMarkerOptions()
.latitude(drawStopLineLon.getLat())
.longitude(drawStopLineLon.getLon())
@@ -142,9 +145,12 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
optionsRipple
.icon(ViewUtils.fromView(new EmptyMarkerView(V2XServiceManager.getContext())));
IMogoMarker stopLine = V2XServiceManager.getMarkerManager().addMarker(V2X_FRONT_WARNING_MARKER, optionsRipple);
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);
}
/**
@@ -224,6 +230,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
public void onCarLocationChanged2(Location latLng) {
Log.e(V2XConst.LOG_NAME_WARN, "onCarLocationChanged2 latLng = " + latLng.getLatitude() + "--" + latLng.getLongitude() + "---isSelfLineClear = " + isSelfLineClear);
//当行人经纬度交点 开始画线,否则清理
mCloundWarningInfo.setCarLocation(new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()));
drawSlefCarLine(latLng);
}

View File

@@ -60,13 +60,10 @@ public class V2XWarningMarker implements IV2XMarker {
.longitude(mMarkerEntity.getLon())
.anchor(0.5f, 0.5f)
.zIndex(MarkerDrawer.MARKER_Z_INDEX_HIGH);
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
}
optionsRipple
.icon(ViewUtils.fromView(new EmptyMarkerView(V2XServiceManager.getContext())));
.icon(ViewUtils.fromView(new EmptyMarkerView(mContext)));
optimalMarker = V2XServiceManager.getMarkerManager().addMarker(V2X_FRONT_WARNING_MARKER, optionsRipple);
optimalMarker.setInfoWindowAdapter(new SimpleWindow3DAdapter(new V2XFrontTargetMarkerView(V2XServiceManager.getContext())));
optimalMarker.setInfoWindowAdapter(new SimpleWindow3DAdapter(new V2XFrontTargetMarkerView(mContext)));
optimalMarker.showInfoWindow();
} catch (Exception e) {
@@ -76,21 +73,6 @@ public class V2XWarningMarker implements IV2XMarker {
}
private void drawMarkerWithLocation(MogoLatLng latLng, String tag) {
MogoMarkerOptions options = new MogoMarkerOptions()
.object(markerShowEntity)
.latitude(latLng.lat)
.longitude(latLng.lon);
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
options.icon3DRes(com.mogo.module.service.R.raw.people);
options.anchor(0.5f, 0.5f);
options.anchorColor("#FF4040");
IMogoMarker marker = V2XServiceManager.getMarkerManager().addMarker(tag, options);
iMarkerView.setMarker(marker);
marker.setToTop();
}
@Override
public void clearPOI() {
V2XServiceManager.getMarkerManager().removeMarkers(V2X_FRONT_WARNING_MARKER);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.7 KiB