opt
This commit is contained in:
@@ -71,8 +71,8 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
|
||||
*/
|
||||
public void renderWarnData(V2XWarningEntity data) {
|
||||
MarkerLocation location = new MarkerLocation();
|
||||
location.setLat(data.getLat());
|
||||
location.setLon(data.getLon());
|
||||
location.setLat(data.getDirection() == 1 ? data.getStopLines().get(0).lat : data.getLat());
|
||||
location.setLon(data.getDirection() == 1 ? data.getStopLines().get(0).lon : data.getLon());
|
||||
|
||||
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
|
||||
markerShowEntity.setMarkerLocation(location);
|
||||
@@ -80,7 +80,9 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
|
||||
|
||||
IMogoMarker marker = drawMarker(markerShowEntity);
|
||||
Log.d("liyz", "renderWarnData marker != null ");
|
||||
marker.addDynamicAnchorPosition(new MogoLatLng(data.getCollisionLat(), data.getCollisionLon()), (float) data.getHeading(), 5000);
|
||||
marker.addDynamicAnchorPosition(new MogoLatLng(
|
||||
data.getDirection() == 1 ? data.getStopLines().get(1).lat : data.getCollisionLat(),
|
||||
data.getDirection() == 1 ? data.getStopLines().get(1).lon : data.getCollisionLon()), (float) data.getHeading(), 5000);
|
||||
|
||||
//移动完成以后,3s后消失
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
@@ -98,7 +100,6 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
|
||||
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
|
||||
options.icon3DRes(getModelRes(2)); //TODO
|
||||
|
||||
// options.anchorColor("#FF4040");
|
||||
options.anchorColor("#FB3C3CFF"); //红色#FF3036 蓝色:#256BFF
|
||||
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerShowEntity.getMarkerType(), options);
|
||||
iMarkerView.setMarker(marker);
|
||||
@@ -107,4 +108,44 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
|
||||
return marker;
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制停止线
|
||||
*
|
||||
* @param data
|
||||
*/
|
||||
public void renderStopLineData(V2XWarningEntity data) {
|
||||
MarkerLocation location = new MarkerLocation();
|
||||
location.setLat(data.getLat());
|
||||
location.setLon(data.getLon());
|
||||
|
||||
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
|
||||
markerShowEntity.setMarkerLocation(location);
|
||||
markerShowEntity.setMarkerType(TYPE_MARKER_CLOUD_WARN_DATA);
|
||||
|
||||
IMogoMarker marker = drawStopLineMarker(markerShowEntity);
|
||||
|
||||
//移动完成以后,3s后消失
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
marker.remove();
|
||||
}, 8000);
|
||||
|
||||
}
|
||||
|
||||
public IMogoMarker drawStopLineMarker(MarkerShowEntity markerShowEntity) {
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.object(markerShowEntity)
|
||||
.latitude(markerShowEntity.getMarkerLocation().getLat())
|
||||
.longitude(markerShowEntity.getMarkerLocation().getLon());
|
||||
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
|
||||
options.icon3DRes(getModelRes(1)); //TODO
|
||||
|
||||
options.anchorColor("#FB3C3CFF"); //红色#FF3036 蓝色:#256BFF
|
||||
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerShowEntity.getMarkerType(), options);
|
||||
iMarkerView.setMarker(marker);
|
||||
marker.setToTop();
|
||||
|
||||
return marker;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.drawer.V2XWarnDataDrawer;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XWarningEntity;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.receiver.MogoReceiver;
|
||||
import com.mogo.module.v2x.MoGoV2XServicePaths;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
@@ -57,42 +59,21 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
pointsBetween();
|
||||
|
||||
//发送预警提示
|
||||
V2XMessageEntity<V2XWarningEntity> v2xMessageEntity = new V2XMessageEntity<>();
|
||||
// 控制类型
|
||||
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_TOP);
|
||||
// 设置数据
|
||||
v2xMessageEntity.setContent(cloundWarningInfo);
|
||||
// 控制展示状态
|
||||
v2xMessageEntity.setShowState(true);
|
||||
|
||||
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
|
||||
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2xMessageEntity);
|
||||
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
|
||||
MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(cloundWarningInfo.getDirection(), MogoReceiver.ACTION_V2X_FRONT_WARNING);
|
||||
|
||||
isSelfLineClear = false;
|
||||
|
||||
Log.d(V2XConst.LOG_NAME_WARN, "direction = " + cloundWarningInfo.getDirection());
|
||||
if (cloundWarningInfo.getDirection() == 1) { //前方
|
||||
//添加停止线marker
|
||||
for (int i = 0; i < fillPoints.size(); i++) {
|
||||
V2XWarningEntity entity = new V2XWarningEntity();
|
||||
MogoLatLng latLng = (MogoLatLng) fillPoints.get(i);
|
||||
entity.setLat(latLng.lat);
|
||||
entity.setLat(latLng.lon);
|
||||
entity.setCollisionLat(cloundWarningInfo.getCollisionLat());
|
||||
entity.setCollisionLon(cloundWarningInfo.getCollisionLon());
|
||||
entity.heading = cloundWarningInfo.heading;
|
||||
V2XWarnDataDrawer.getInstance().renderWarnData(entity);
|
||||
}
|
||||
|
||||
//自车和停止线画线 定位
|
||||
|
||||
//停止线前方画线
|
||||
MogoLatLng newLocation = LocationUtils.getNewLocation((MogoLatLng) fillPoints.get(0), 80, cloundWarningInfo.heading);
|
||||
WorkThreadHandler.getInstance().postDelayed(() -> {
|
||||
//二轮车和行人的渲染和移动
|
||||
V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo);
|
||||
//绘制识别物与交汇点连线,并且更新连线数据
|
||||
drawStopLine(cloundWarningInfo, newLocation);
|
||||
|
||||
//添加停止线marker
|
||||
handleStopLine();
|
||||
}, 0);
|
||||
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
@@ -107,10 +88,8 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
WorkThreadHandler.getInstance().postDelayed(() -> {
|
||||
//绘制识别物与交汇点连线,并且更新连线数据
|
||||
drawOtherObjectLine(cloundWarningInfo);
|
||||
|
||||
//二轮车和行人的渲染和移动
|
||||
V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo);
|
||||
|
||||
}, 0);
|
||||
|
||||
//延迟3秒清理线
|
||||
@@ -124,6 +103,20 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void handleStopLine() {
|
||||
for (int i = 0; i < fillPoints.size(); i++) {
|
||||
V2XWarningEntity entity = new V2XWarningEntity();
|
||||
MogoLatLng latLng = (MogoLatLng) fillPoints.get(i);
|
||||
entity.setLat(latLng.lat);
|
||||
entity.setLat(latLng.lon);
|
||||
entity.setCollisionLat(mCloundWarningInfo.getCollisionLat());
|
||||
entity.setCollisionLon(mCloundWarningInfo.getCollisionLon());
|
||||
entity.heading = mCloundWarningInfo.heading;
|
||||
V2XWarnDataDrawer.getInstance().renderStopLineData(entity);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制停止线前方线 TODO 需要实时给行人当前位置
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user