This commit is contained in:
lixiaopeng
2021-03-31 18:31:28 +08:00
parent fdcec442db
commit 1b46bfbc4d
3 changed files with 84 additions and 8 deletions

View File

@@ -15,6 +15,7 @@ import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.R;
import com.mogo.module.common.api.CallChatApi;
import com.mogo.module.common.constants.DataTypes;
import com.mogo.module.common.entity.V2XWarningEntity;
import com.mogo.module.common.utils.SimpleHandlerThreadPool;
import com.mogo.realtime.entity.CloudRoadData;
import com.mogo.realtime.entity.MogoSnapshotSetData;
@@ -136,6 +137,70 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
return false;
}
/**
* 绘制 marker
*
* @param data 道路数据
* @return {@link IMogoMarker}
*/
// public IMogoMarker drawWarnDataMarker( V2XWarningEntity data ) {
// if ( data == null ) {
// return null;
// }
//
// MogoMarkerOptions options = new MogoMarkerOptions()
// .owner( DataTypes.TYPE_MARKER_CLOUD_DATA )
// .anchor( 0.5f, 0.5f )
// .rotate( ( float ) data.getHeading() )
// .object( data )
// .gps( true )
// .controlAngle( true )
// .position( new MogoLatLng( data.getWgslat(), data.getWgslon() ) );
// String resIdVal = null;
// if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
// options.set3DMode( true );
// // TODO: 2021/3/23 后端算法提供显示颜色
// options.anchorColor( getModelRenderColor( data.getType(), data.getSpeed(), data.getWgslon(), data.getWgslat(), data.getHeading() ) );
// int resId = getModelRes( data.getType() );
// resIdVal = resId + "";
// options.resName( mMarkerCachesResMd5Values.get( resIdVal ) );
// options.icon3DRes( resId );
// } else {
// options.set3DMode( false );
// View view = inflateView( data );
// options.icon( view );
// resIdVal = view.getId() + "";
// }
// IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( mContext ).addMarker( DataTypes.TYPE_MARKER_CLOUD_DATA, options );
// cacheMarkerIconResMd5Val( resIdVal, marker );
//
// if ( !TextUtils.isEmpty( data.getSn() ) ) {
// bindClickListener( marker );
// }
//
// return marker;
// }
/**
*
* @param data
*/
// public void renderWarnData(V2XWarningEntity data ) {
//
// IMogoMarker marker = drawWarnDataMarker(data);
//
// if ( marker == null ) {
// continue;
// }
//
//
// renderSnapshotOneFrame( marker, uniqueKey, cloudRoadData, newMarkersCaches );
//
//
// }
/**
* mogo 他车、mogo 他车识别的社会车辆、路边单元识别的车辆
*

View File

@@ -57,7 +57,7 @@ public class MoGoPersonWarnPolylineManager implements IMoGoPersonWarnPolylineMan
options.add(info.getEndLocation());
// 绘制线的对象
mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options);
mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options);
} catch (Exception e) {
e.printStackTrace();

View File

@@ -29,6 +29,10 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager {
@Override
public void drawWarnPolyline(Context context, DrawLineInfo info) {
if (info == null) {
return;
}
try {
if (mMogoPolyline != null) {
mMogoPolyline.remove();
@@ -37,22 +41,29 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager {
// 连接线参数
MogoPolylineOptions options = new MogoPolylineOptions();
float roadWidth = V2XServiceManager.getMapUIController().getRoadWidth(info.getStartLocation().lon,
info.getStartLocation().lat, (float) info.getHeading(), true, true);
// float roadWidth = V2XServiceManager.getMapUIController().getRoadWidth(info.getStartLocation().lon,
// info.getStartLocation().lat, (float) info.getHeading(), true, true);
List<Integer> colors = new ArrayList<>();
if (info.getType().equals("1")) { //预警 TODO
colors.add(0xFFFFA31A);
colors.add(0xFFFFA31A);
if (info.getType() != null) {
if (info.getType().equals("1")) { //预警 TODO
colors.add(0xFFFFA31A);
colors.add(0xFFFFA31A);
} else {
colors.add(0xFFE32F46);
colors.add(0xFFE32F46);
}
} else {
Log.e(V2XConst.LOG_NAME_WARN, "info.getType() == null ");
colors.add(0xFFE32F46);
colors.add(0xFFE32F46);
}
Log.d(V2XConst.LOG_NAME_WARN, "MoGoWarnPolylineManager roadWidth = " + roadWidth);
// Log.d(V2XConst.LOG_NAME_WARN, "MoGoWarnPolylineManager roadWidth = " + roadWidth);
// 线条粗细,渐变,渐变色值
options.width(roadWidth).useGradient(true).colorValues(colors);
options.width(60).useGradient(true).colorValues(colors);
// options.width(roadWidth).useGradient(true).colorValues(colors);
// 当前车辆位置
options.add(info.getStartLocation());
// 目标车辆位置