添加画线

This commit is contained in:
liujing
2021-03-31 14:49:00 +08:00
parent aef0349f24
commit aaced2d740
4 changed files with 36 additions and 19 deletions

View File

@@ -1,10 +1,7 @@
package com.mogo.module.v2x.scenario.scene.warning;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.map.MogoLatLng;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.module.common.MogoApisHandler;
@@ -13,9 +10,9 @@ import com.mogo.module.common.drawer.marker.MapMarkerAdapter;
import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.MarkerShowEntity;
import com.mogo.module.common.entity.V2XWarningEntity;
import com.mogo.module.v2x.R;
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.scenario.view.IV2XMarker;
import com.mogo.utils.WorkThreadHandler;
@@ -41,7 +38,7 @@ public class V2XWarningMarker implements IV2XMarker {
markerShowEntity.setMarkerType(V2XConst.V2X_FRONT_WARNING_MARKER);
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
V2XServiceManager.getMarkerManager().removeMarkers(V2XConst.V2X_FRONT_WARNING_MARKER);
clearPOI();
WorkThreadHandler.getInstance().postDelayed(() -> {
MogoMarkerOptions options = new MogoMarkerOptions()
.object(markerShowEntity)
@@ -49,11 +46,17 @@ public class V2XWarningMarker implements IV2XMarker {
.longitude(markerShowEntity.getMarkerLocation().getLon());
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
options.icon3DRes(com.mogo.module.service.R.raw.people);
options.anchorColor("#DC143C");
options.anchorColor(mMarkerEntity.getTargetColor());
IMogoMarker marker = V2XServiceManager.getMarkerManager().addMarker(markerShowEntity.getMarkerType(), options);
iMarkerView.setMarker(marker);
marker.setToTop();
}, 1000);
}, 0);
//如果有预警碰撞点,识别物与预警碰撞点之间连线,并执行平移动画
if (mMarkerEntity.getCollisionLat() > 0 && mMarkerEntity.getCollisionLon() != 0) {
drawLine();
smooth();
}
} else {
}
@@ -63,8 +66,21 @@ public class V2XWarningMarker implements IV2XMarker {
}
@Override
public void clearPOI() {
public void drawLine() {
DrawLineInfo drawLineInfo = new DrawLineInfo();
MogoLatLng slatLng = new MogoLatLng(mMarkerEntity.getLat(), mMarkerEntity.getLon());
MogoLatLng endLatLng = new MogoLatLng(mMarkerEntity.getCollisionLat(), mMarkerEntity.getCollisionLon());
drawLineInfo.setStartLocation(slatLng);
drawLineInfo.setEndLocation(endLatLng);
V2XServiceManager.getMoGoWarnPolylineManager().drawableWarnPolyline(mContext, drawLineInfo);
}
public void smooth() {
}
@Override
public void clearPOI() {
V2XServiceManager.getMarkerManager().removeMarkers(V2XConst.V2X_FRONT_WARNING_MARKER);
}
}

View File

@@ -69,7 +69,7 @@ public class V2XWarningWindow extends V2XBasWindow implements IV2XWindow {
break;
case 1:
case 2:
typeImage.setImageResource(R.drawable.v2x_road_front_p_warning);
typeImage.setImageResource(R.drawable.v2x_road_front_m_warning);
break;
default:
break;
@@ -78,6 +78,7 @@ public class V2XWarningWindow extends V2XBasWindow implements IV2XWindow {
warningTextView.setText(mV2XWarningEntity.getWarningContent());
AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice(mV2XWarningEntity.getTts());
}
//3秒后移除提示弹框
if (runnableV2XEvent == null) {
runnableV2XEvent = () -> {
EXPIRE_TIMER = EXPIRE_TIMER - COUNT_DOWN_TIMER;

View File

@@ -1,18 +1,18 @@
{
"type":0,
"lat":39.977121,
"lon":116.417537,
"lat":39.977113,
"lon":116.417457,
"distance": 2.22,
"collisionLat": 39.9760799115429,
"collisionLon": 116.411360351446,
"collisionLat": 39.977139,
"collisionLon": 116.417607,
"from": 1,
"angle": 120,
"direction": 10014,
"speed":11.108121,
"targetColor": "#D8BFD8",
"targetColor": "#FF4040",
"stopLineDistance":20,
"stopLineLat": 39.977123,
"stopLineLon": 116.417537,
"warningContent": "小行人",
"warningContent": "小行人",
"heading": 30
}

View File

@@ -29,11 +29,11 @@ public class V2XManager implements IV2XProvider {
@Override
public void registerIntentListener(String intent, IV2XListener listener) {
if (listener == null || intent == null) {
Log.d("V2XManager","listener == null || intent == null");
Log.d("V2XManager", "listener == null || intent == null");
return;
}
if (!mListeners.containsKey(intent)) {
Log.d("V2XManager","intent=="+intent+"listener"+listener);
Log.d("V2XManager", "intent==" + intent + "listener" + listener);
mListeners.put(intent, new CopyOnWriteArrayList<>());
}
mListeners.get(intent).add(listener);