侧方识别物与预碰撞点之间添加箭头marker

This commit is contained in:
liujing
2021-04-14 12:39:48 +08:00
parent 965ecb9f10
commit 8e9655a564
2 changed files with 31 additions and 2 deletions

View File

@@ -127,6 +127,19 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
return marker;
}
public void drawerMarkerWithLocation(MarkerShowEntity markerShowEntity, MogoLatLng location){
MogoMarkerOptions options = new MogoMarkerOptions()
.object(markerShowEntity)
.latitude(location.getLat())
.longitude(location.getLon());
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
options.icon3DRes(getModelRes(2)); //TODO
options.anchorColor("#FB3C3CFF"); //红色#FF3036 蓝色:#256BFF
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerShowEntity.getMarkerType(), options);
iMarkerView.setMarker(marker);
marker.setToTop();
}
/*
* 2D资源绘制marker底部的红色圆圈
* */

View File

@@ -11,6 +11,7 @@ import com.mogo.map.navi.IMogoCarLocationChangedListener2;
import com.mogo.map.overlay.IMogoPolyline;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.drawer.V2XWarnDataDrawer;
import com.mogo.module.common.entity.MarkerShowEntity;
import com.mogo.module.common.entity.V2XWarningEntity;
import com.mogo.module.common.utils.Trigonometric;
import com.mogo.module.service.MarkerServiceHandler;
@@ -119,7 +120,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
}
/**
* 绘制红色区域(停止线继续前行的预警区域) TODO 需要实时给行人当前位置
* 车辆行驶正前方绘制红色区域(停止线继续前行的预警区域) TODO 需要实时给行人当前位置
*/
private void drawStopLine(V2XWarningEntity info, MogoLatLng mogoLatLng) {
if (info != null) {
@@ -153,7 +154,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
/**
* 目标物与预碰撞点连线,并且更新数据 TODO 需要实时给行人当前位置
* 侧方目标物与预碰撞点连线,并且更新数据 TODO 需要实时给行人当前位置
*/
private void drawOtherObjectLine(V2XWarningEntity info) {
if (info != null) {
@@ -185,6 +186,21 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
}
}
//侧面目标物与碰撞点之间添加多个小箭头
private void addArrows(MogoLatLng startLatLng, MogoLatLng endLatLng) {
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
float distance = CoordinateUtils.calculateLineDistance(
startLatLng.lon, startLatLng.lat, endLatLng.lon, endLatLng.lat);
if (distance > 5) {
int count = (int) (distance / 5);
for (int i = 0; i < count; i++) {
MogoLatLng newLo = Trigonometric.getNewLocation(
startLatLng, 5 * i, mCloundWarningInfo.getAngle());
V2XWarnDataDrawer.getInstance().drawerMarkerWithLocation(markerShowEntity, newLo);
}
}
}
@Override
public void clearALLPOI() {