完成了对向来车的测试方案
This commit is contained in:
@@ -7,6 +7,8 @@ import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.common.entity.V2XPoiTypeEnum;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.utils.ImageUtil;
|
||||
import com.mogo.module.v2x.utils.V2XUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -146,4 +148,15 @@ public class V2XMarkerAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* TODO 都是模拟数据
|
||||
* 获取VR道路事件
|
||||
*/
|
||||
public static Bitmap getV2XVRRoadEventViewPng() {
|
||||
Bitmap bitmap = ImageUtil.createBitmap(V2XUtils.getApp(),R.drawable.v2x_duixiang_laiche_che_xian);
|
||||
return bitmap;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package com.mogo.module.v2x.scenario.scene.pushVR;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.marker.V2XMarkerAdapter;
|
||||
import com.mogo.module.v2x.scenario.view.IV2XMarker;
|
||||
import com.mogo.module.v2x.utils.MarkerUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -13,6 +15,8 @@ import com.mogo.utils.logger.Logger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.mogo.module.v2x.V2XConst.V2X_EVENT_ALARM_POI;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
@@ -25,6 +29,10 @@ public class V2XPushVREventMarker implements IV2XMarker<V2XPushMessageEntity> {
|
||||
|
||||
private static IMogoPolyline mMogoPolyline;
|
||||
|
||||
// 上次的道路事件的预警Marker
|
||||
private static IMogoMarker mAlarmInfoMarker;
|
||||
|
||||
|
||||
@Override
|
||||
public void drawPOI(V2XPushMessageEntity entity) {
|
||||
Logger.w(V2XConst.MODULE_NAME + "_" + TAG, "drawPOI 绘制VR Marker");
|
||||
@@ -38,31 +46,43 @@ public class V2XPushVREventMarker implements IV2XMarker<V2XPushMessageEntity> {
|
||||
mMogoPolyline.remove();
|
||||
}
|
||||
|
||||
// 连接线参数
|
||||
MogoPolylineOptions options = new MogoPolylineOptions();
|
||||
|
||||
// 渐变色
|
||||
List<Integer> colors = new ArrayList<>();
|
||||
colors.add(0xFFFA8C34);
|
||||
colors.add(0xFFBD6D36);
|
||||
colors.add(0xFFFA8C34);
|
||||
|
||||
// 线条粗细,渐变,渐变色值
|
||||
options.width(10).useGradient(true).colorValues(colors);
|
||||
|
||||
for (double[] doubles : entity.getPolyline()) {
|
||||
options.add(doubles[0],doubles[1]);
|
||||
}
|
||||
|
||||
// 绘制线的对象
|
||||
mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options);
|
||||
// 道路事件,或者水波纹扩散效果
|
||||
MogoMarkerOptions optionsRipple = new MogoMarkerOptions()
|
||||
.object(entity)
|
||||
.latitude(entity.getLat())
|
||||
.longitude(entity.getLon());
|
||||
optionsRipple.anchor(0.5f, 0.5f);
|
||||
|
||||
optionsRipple.icon(V2XMarkerAdapter.getV2XVRRoadEventViewPng());
|
||||
mAlarmInfoMarker = V2XServiceManager.getMarkerManager().addMarker(V2X_EVENT_ALARM_POI, optionsRipple);
|
||||
|
||||
drawablePloyLine(entity);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
void drawablePloyLine(V2XPushMessageEntity entity) {
|
||||
// 连接线参数
|
||||
MogoPolylineOptions options = new MogoPolylineOptions();
|
||||
|
||||
// 渐变色
|
||||
List<Integer> colors = new ArrayList<>();
|
||||
colors.add(0xFFFA8C34);
|
||||
colors.add(0xFFBD6D36);
|
||||
colors.add(0xFFFA8C34);
|
||||
|
||||
// 线条粗细,渐变,渐变色值
|
||||
options.width(10).useGradient(true).colorValues(colors);
|
||||
|
||||
for (double[] doubles : entity.getPolyline()) {
|
||||
options.add(doubles[0], doubles[1]);
|
||||
}
|
||||
|
||||
// 绘制线的对象
|
||||
mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearPOI() {
|
||||
// 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随
|
||||
@@ -70,11 +90,17 @@ public class V2XPushVREventMarker implements IV2XMarker<V2XPushMessageEntity> {
|
||||
// 移除线
|
||||
clearLine();
|
||||
// 移除事件POI
|
||||
V2XServiceManager.getMoGoV2XMarkerManager().clearAlarmPOI();
|
||||
clearAlarmPOI();
|
||||
// 绘制上次的数据
|
||||
V2XServiceManager.getMoGoV2XMarkerManager().drawableLastAllPOI();
|
||||
}
|
||||
|
||||
void clearAlarmPOI() {
|
||||
if (mAlarmInfoMarker != null) {
|
||||
mAlarmInfoMarker.remove();
|
||||
}
|
||||
}
|
||||
|
||||
public void clearLine() {
|
||||
if (mMogoPolyline != null) {
|
||||
mMogoPolyline.remove();
|
||||
|
||||
@@ -42,7 +42,7 @@ public class V2XPushVREventWindow implements IV2XWindow<V2XPushMessageEntity> {
|
||||
IMogoEntranceButtonController.NOTICE_TYPE_CONGESTION_RECOMMENDED,
|
||||
R.drawable.module_v2x_left_notice_seek_help,
|
||||
entity.getAlarmContent());
|
||||
countDownV2XEvent();
|
||||
//countDownV2XEvent();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -75,4 +75,16 @@ public class ImageUtil {
|
||||
}
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static Bitmap createBitmap(Context context, int resId) {
|
||||
if (resId != 0) {
|
||||
BitmapFactory.Options opts = new BitmapFactory.Options();
|
||||
BitmapFactory.decodeResource(context.getResources(), resId, opts);
|
||||
Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), resId, opts);
|
||||
return bitmap;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 50 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
@@ -11,8 +11,8 @@
|
||||
"tts": "前车急刹注意减速",
|
||||
"zoom": false,
|
||||
"zoomScale": 15,
|
||||
"lat": 40.196512,
|
||||
"lon": 116.736461,
|
||||
"lat": 40.195206,
|
||||
"lon": 116.727433,
|
||||
"userHead": "",
|
||||
"msgImgUrl": "",
|
||||
"polyline": [
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
"zoomScale": 15,
|
||||
"userHead": "",
|
||||
"msgImgUrl": "",
|
||||
"lat": 40.196512,
|
||||
"lon": 116.736461,
|
||||
"lat": 40.195571,
|
||||
"lon": 116.729344,
|
||||
"polyline": [
|
||||
[
|
||||
116.725092,
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
"tts": "对向来车注意减速",
|
||||
"zoom": false,
|
||||
"zoomScale": 15,
|
||||
"lat": 40.196512,
|
||||
"lon": 116.736461,
|
||||
"lat": 40.196175,
|
||||
"lon": 116.731011,
|
||||
"userHead": "",
|
||||
"msgImgUrl": "",
|
||||
"polyline": [
|
||||
|
||||
Reference in New Issue
Block a user