Merge branch 'dev2_aiSdk' of http://gitlab.zhidaoauto.com/ecos/yycp-service/Launcher into dev2_aiSdk
This commit is contained in:
1
.idea/gradle.xml
generated
1
.idea/gradle.xml
generated
@@ -91,7 +91,6 @@
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
<option name="useQualifiedModuleNames" value="true" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
|
||||
2
.idea/inspectionProfiles/Project_Default.xml
generated
2
.idea/inspectionProfiles/Project_Default.xml
generated
@@ -30,7 +30,7 @@
|
||||
<option name="IGNORE_JAVADOC_PERIOD" value="true" />
|
||||
<option name="IGNORE_DUPLICATED_THROWS" value="false" />
|
||||
<option name="IGNORE_POINT_TO_ITSELF" value="false" />
|
||||
<option name="myAdditionalJavadocTags" value="description,since:" />
|
||||
<option name="myAdditionalJavadocTags" value="description,since:,date" />
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
||||
@@ -34,6 +34,16 @@ public interface MarkerPoiTypeEnum {
|
||||
String FOURS_PARKING = "10012";
|
||||
//事故
|
||||
String FOURS_ACCIDENT = "10013";
|
||||
//重大事故
|
||||
String FOURS_ACCIDENT_01 = "1001301";
|
||||
//特大事故
|
||||
String FOURS_ACCIDENT_02 = "1001302";
|
||||
//较大事故
|
||||
String FOURS_ACCIDENT_03 = "1001303";
|
||||
//一般事故
|
||||
String FOURS_ACCIDENT_04 = "1001304";
|
||||
//轻微事故
|
||||
String FOURS_ACCIDENT_05 = "1001305";
|
||||
//身边
|
||||
String FOURS_NEALY = "10014";
|
||||
//实时路况
|
||||
|
||||
@@ -96,6 +96,11 @@ public class V2XRoadEventEntity implements Serializable {
|
||||
break;
|
||||
// 事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT:
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_01: // 重大事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_02: // 特大事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_03: // 较大事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_04: // 一般事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_05: // 轻微事故
|
||||
tts += "交通事故";
|
||||
break;
|
||||
default:
|
||||
@@ -156,6 +161,11 @@ public class V2XRoadEventEntity implements Serializable {
|
||||
break;
|
||||
// 事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT:
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_01: // 重大事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_02: // 特大事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_03: // 较大事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_04: // 一般事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_05: // 轻微事故
|
||||
tts += "交通事故";
|
||||
break;
|
||||
default:
|
||||
@@ -222,6 +232,11 @@ public class V2XRoadEventEntity implements Serializable {
|
||||
break;
|
||||
// 事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT:
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_01: // 重大事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_02: // 特大事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_03: // 较大事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_04: // 一般事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_05: // 轻微事故
|
||||
alarmContent = "前方交通事故";
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -126,6 +126,14 @@ public class V2XWarningEntity implements Serializable {
|
||||
this.speed = speed;
|
||||
}
|
||||
|
||||
public long getShowTime() {
|
||||
return showTime;
|
||||
}
|
||||
|
||||
public void setShowTime(long showTime) {
|
||||
this.showTime = showTime;
|
||||
}
|
||||
|
||||
|
||||
public void setStopLineDistance(double stopLineDistance) {
|
||||
this.stopLineDistance = stopLineDistance;
|
||||
|
||||
@@ -23,7 +23,8 @@ public class CloudPoiManager {
|
||||
|
||||
private Map<String, PoiWrapper> poiWrapper = new ArrayMap<>();
|
||||
private static CloudPoiManager instance = null;
|
||||
public static CloudPoiManager getInstance(){
|
||||
|
||||
public static CloudPoiManager getInstance() {
|
||||
if (instance == null) {
|
||||
synchronized (CloudPoiManager.class) {
|
||||
if (instance == null) {
|
||||
@@ -34,43 +35,53 @@ public class CloudPoiManager {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void generateDefault(){
|
||||
public void generateDefault() {
|
||||
if (poiWrapper.isEmpty()) {
|
||||
poiWrapper.put(MarkerPoiTypeEnum.GAS_STATION, new PoiWrapper(MarkerPoiTypeEnum.GAS_STATION,R.drawable.module_common_icon_map_marker_refuel,
|
||||
poiWrapper.put(MarkerPoiTypeEnum.GAS_STATION, new PoiWrapper(MarkerPoiTypeEnum.GAS_STATION, R.drawable.module_common_icon_map_marker_refuel,
|
||||
R.drawable.module_common_icon_map_marker_refuel, "加油站"));
|
||||
poiWrapper.put(MarkerPoiTypeEnum.TRAFFIC_CHECK, new PoiWrapper(MarkerPoiTypeEnum.TRAFFIC_CHECK,
|
||||
R.drawable.module_common_icon_map_marker_road_check2,R.drawable.module_common_icon_map_marker_road_check2_white, "交通检查"));
|
||||
R.drawable.module_common_icon_map_marker_road_check2, R.drawable.module_common_icon_map_marker_road_check2_white, "交通检查"));
|
||||
poiWrapper.put(MarkerPoiTypeEnum.ROAD_CLOSED, new PoiWrapper(MarkerPoiTypeEnum.ROAD_CLOSED,
|
||||
R.drawable.module_common_icon_map_marker_road_block_off2,R.drawable.module_common_icon_map_marker_road_block_off2_white, "封路"));
|
||||
R.drawable.module_common_icon_map_marker_road_block_off2, R.drawable.module_common_icon_map_marker_road_block_off2_white, "封路"));
|
||||
poiWrapper.put(MarkerPoiTypeEnum.SHOP_DISCOUNT, new PoiWrapper(MarkerPoiTypeEnum.SHOP_DISCOUNT,
|
||||
R.drawable.module_common_icon_map_marker_shop_discount,R.drawable.module_common_icon_map_marker_shop_discount, "商场打折"));
|
||||
R.drawable.module_common_icon_map_marker_shop_discount, R.drawable.module_common_icon_map_marker_shop_discount, "商场打折"));
|
||||
poiWrapper.put(MarkerPoiTypeEnum.FOURS_4S, new PoiWrapper(MarkerPoiTypeEnum.FOURS_4S,
|
||||
R.drawable.module_common_icon_map_marker_4s,R.drawable.module_common_icon_map_marker_4s, "4S店"));
|
||||
R.drawable.module_common_icon_map_marker_4s, R.drawable.module_common_icon_map_marker_4s, "4S店"));
|
||||
poiWrapper.put(MarkerPoiTypeEnum.FOURS_ROAD_WORK, new PoiWrapper(MarkerPoiTypeEnum.FOURS_ROAD_WORK,
|
||||
R.drawable.module_common_icon_map_marker_road_work2,R.drawable.module_common_icon_map_marker_road_work2_white, "施工"));
|
||||
R.drawable.module_common_icon_map_marker_road_work2, R.drawable.module_common_icon_map_marker_road_work2_white, "施工"));
|
||||
poiWrapper.put(MarkerPoiTypeEnum.FOURS_BLOCK_UP, new PoiWrapper(MarkerPoiTypeEnum.FOURS_BLOCK_UP,
|
||||
R.drawable.module_common_icon_map_marker_road_block_up2,R.drawable.module_common_icon_map_marker_road_block_up2_white, "拥堵"));
|
||||
R.drawable.module_common_icon_map_marker_road_block_up2, R.drawable.module_common_icon_map_marker_road_block_up2_white, "拥堵"));
|
||||
poiWrapper.put(MarkerPoiTypeEnum.FOURS_PONDING, new PoiWrapper(MarkerPoiTypeEnum.FOURS_PONDING,
|
||||
R.drawable.module_common_icon_map_marker_pondingl2,R.drawable.module_common_icon_map_marker_pondingl2_white, "积水"));
|
||||
R.drawable.module_common_icon_map_marker_pondingl2, R.drawable.module_common_icon_map_marker_pondingl2_white, "积水"));
|
||||
poiWrapper.put(MarkerPoiTypeEnum.FOURS_SHOP_FREE, new PoiWrapper(MarkerPoiTypeEnum.FOURS_SHOP_FREE,
|
||||
R.drawable.module_common_icon_map_marker_shop,R.drawable.module_common_icon_map_marker_shop, "超时打折"));
|
||||
R.drawable.module_common_icon_map_marker_shop, R.drawable.module_common_icon_map_marker_shop, "超时打折"));
|
||||
poiWrapper.put(MarkerPoiTypeEnum.FOURS_FOG, new PoiWrapper(MarkerPoiTypeEnum.FOURS_FOG,
|
||||
R.drawable.module_common_ic_rc_dark_frog2,R.drawable.module_common_ic_rc_dark_frog2_white, "浓雾"));
|
||||
R.drawable.module_common_ic_rc_dark_frog2, R.drawable.module_common_ic_rc_dark_frog2_white, "浓雾"));
|
||||
poiWrapper.put(MarkerPoiTypeEnum.FOURS_ICE, new PoiWrapper(MarkerPoiTypeEnum.FOURS_ICE,
|
||||
R.drawable.module_common_ic_rc_freeze2,R.drawable.module_common_ic_rc_freeze2_white, "结冰"));
|
||||
R.drawable.module_common_ic_rc_freeze2, R.drawable.module_common_ic_rc_freeze2_white, "结冰"));
|
||||
poiWrapper.put(MarkerPoiTypeEnum.FOURS_PARKING, new PoiWrapper(MarkerPoiTypeEnum.FOURS_PARKING,
|
||||
R.drawable.module_common_ic_rc_parking2,R.drawable.module_common_ic_rc_parking2, "停车场"));
|
||||
R.drawable.module_common_ic_rc_parking2, R.drawable.module_common_ic_rc_parking2, "停车场"));
|
||||
poiWrapper.put(MarkerPoiTypeEnum.FOURS_ACCIDENT, new PoiWrapper(MarkerPoiTypeEnum.FOURS_ACCIDENT,
|
||||
R.drawable.module_common_ic_rc_accident3,R.drawable.module_common_ic_rc_accident3_white, "事故"));
|
||||
R.drawable.module_common_ic_rc_accident3, R.drawable.module_common_ic_rc_accident3_white, "事故"));
|
||||
poiWrapper.put(MarkerPoiTypeEnum.FOURS_ACCIDENT_01, new PoiWrapper(MarkerPoiTypeEnum.FOURS_ACCIDENT_01,
|
||||
R.drawable.module_common_ic_rc_accident3, R.drawable.module_common_ic_rc_accident3_white, "重大事故"));
|
||||
poiWrapper.put(MarkerPoiTypeEnum.FOURS_ACCIDENT_02, new PoiWrapper(MarkerPoiTypeEnum.FOURS_ACCIDENT_02,
|
||||
R.drawable.module_common_ic_rc_accident3, R.drawable.module_common_ic_rc_accident3_white, "特大事故"));
|
||||
poiWrapper.put(MarkerPoiTypeEnum.FOURS_ACCIDENT_03, new PoiWrapper(MarkerPoiTypeEnum.FOURS_ACCIDENT_03,
|
||||
R.drawable.module_common_ic_rc_accident3, R.drawable.module_common_ic_rc_accident3_white, "较大事故"));
|
||||
poiWrapper.put(MarkerPoiTypeEnum.FOURS_ACCIDENT_04, new PoiWrapper(MarkerPoiTypeEnum.FOURS_ACCIDENT_04,
|
||||
R.drawable.module_common_ic_rc_accident3, R.drawable.module_common_ic_rc_accident3_white, "一般事故"));
|
||||
poiWrapper.put(MarkerPoiTypeEnum.FOURS_ACCIDENT_05, new PoiWrapper(MarkerPoiTypeEnum.FOURS_ACCIDENT_05,
|
||||
R.drawable.module_common_ic_rc_accident3, R.drawable.module_common_ic_rc_accident3_white, "轻微事故"));
|
||||
poiWrapper.put(MarkerPoiTypeEnum.FOURS_NEALY, new PoiWrapper(MarkerPoiTypeEnum.FOURS_NEALY,
|
||||
R.drawable.module_common_icon_map_marker_shear_news,R.drawable.module_common_icon_map_marker_shear_news, "身边"));
|
||||
R.drawable.module_common_icon_map_marker_shear_news, R.drawable.module_common_icon_map_marker_shear_news, "身边"));
|
||||
poiWrapper.put(MarkerPoiTypeEnum.FOURS_LIVING, new PoiWrapper(MarkerPoiTypeEnum.FOURS_LIVING,
|
||||
R.drawable.module_common_icon_map_marker_living,R.drawable.module_common_icon_map_marker_living_white, "实时路况"));
|
||||
R.drawable.module_common_icon_map_marker_living, R.drawable.module_common_icon_map_marker_living_white, "实时路况"));
|
||||
poiWrapper.put(MarkerPoiTypeEnum.ILLEGAL_PARK_LIVING, new PoiWrapper(MarkerPoiTypeEnum.ILLEGAL_PARK_LIVING,
|
||||
R.drawable.module_common_ic_rc_illegal_park,R.drawable.module_common_ic_rc_illegal_park_white, "违章停车"));
|
||||
R.drawable.module_common_ic_rc_illegal_park, R.drawable.module_common_ic_rc_illegal_park_white, "违章停车"));
|
||||
// 分享里用到的故障求助
|
||||
poiWrapper.put("9999", new PoiWrapper("9999",
|
||||
R.drawable.module_common_icon_seek_help,R.drawable.module_common_icon_seek_help, "故障求助"));
|
||||
R.drawable.module_common_icon_seek_help, R.drawable.module_common_icon_seek_help, "故障求助"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,13 +92,13 @@ public class CloudPoiManager {
|
||||
if (!config.isEmpty()) {
|
||||
List<PoiWrapper> configWrappers = GsonUtil.arrayFromJson(config, PoiWrapper.class);
|
||||
Logger.d(TAG, "config: " + configWrappers);
|
||||
if(configWrappers!=null) {
|
||||
if (configWrappers != null) {
|
||||
for (PoiWrapper wrapper : configWrappers) {
|
||||
wrapper.setIconInfoRes(R.drawable.module_common_icon_map_marker_road_block_up2_white);
|
||||
wrapper.setIconRes(R.drawable.module_common_icon_map_marker_road_block_up2);
|
||||
if(poiWrapper.containsKey(wrapper.getPoiType())) {
|
||||
if (poiWrapper.containsKey(wrapper.getPoiType())) {
|
||||
PoiWrapper defWrapper = poiWrapper.get(wrapper.getPoiType());
|
||||
if(defWrapper!=null) {
|
||||
if (defWrapper != null) {
|
||||
wrapper.setIconRes(defWrapper.getIconRes());
|
||||
wrapper.setIconInfoRes(defWrapper.getIconInfoRes());
|
||||
}
|
||||
@@ -95,7 +106,7 @@ public class CloudPoiManager {
|
||||
Logger.d(TAG, "put===" + wrapper);
|
||||
poiWrapper.put(wrapper.getPoiType(), wrapper);
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
Logger.e(TAG, "解析configWrapper异常: " + config);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class V2XStatusManager {
|
||||
if (mLocation == null) {
|
||||
mLocation = new MogoLocation();
|
||||
}
|
||||
//Logger.d(V2XConst.MODULE_NAME, "当前车辆位置:" + mLocation.toString());
|
||||
Logger.d(V2XConst.MODULE_NAME, "当前车辆位置:" + mLocation.toString());
|
||||
return mLocation;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.module.common.entity.MarkerPoiTypeEnum;
|
||||
import com.mogo.module.common.entity.V2XPoiTypeEnum;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.adapter.holder.V2XSurroundingViewHolder;
|
||||
import com.mogo.module.v2x.entity.panel.SurroundingConstruction;
|
||||
@@ -130,6 +131,11 @@ public class V2XSurroundingAdapter extends RecyclerView.Adapter<V2XSurroundingVi
|
||||
resId = R.drawable.mogo_image_nongwu_small;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT:
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT_01: // 重大事故
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT_02: // 特大事故
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT_03: // 较大事故
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT_04: // 一般事故
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT_05: // 轻微事故
|
||||
resId = R.drawable.mogo_image_accident_small;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_LIVING:
|
||||
@@ -167,6 +173,11 @@ public class V2XSurroundingAdapter extends RecyclerView.Adapter<V2XSurroundingVi
|
||||
resId = R.drawable.mogo_image_nongwu_nor;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT:
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT_01: // 重大事故
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT_02: // 特大事故
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT_03: // 较大事故
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT_04: // 一般事故
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT_05: // 轻微事故
|
||||
resId = R.drawable.mogo_image_jiaotongshigu_nor;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_LIVING:
|
||||
@@ -195,6 +206,11 @@ public class V2XSurroundingAdapter extends RecyclerView.Adapter<V2XSurroundingVi
|
||||
typeName = "交通检查";
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT:
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT_01: // 重大事故
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT_02: // 特大事故
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT_03: // 较大事故
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT_04: // 一般事故
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT_05: // 轻微事故
|
||||
typeName = "交通事故";
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_BLOCK_UP:
|
||||
|
||||
@@ -151,6 +151,11 @@ public class V2XSurroundingDetailAdapter extends RecyclerView.Adapter<V2XSurroun
|
||||
typeName = "交通检查";
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT:
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT_01: // 重大事故
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT_02: // 特大事故
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT_03: // 较大事故
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT_04: // 一般事故
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT_05: // 轻微事故
|
||||
typeName = "交通事故";
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_BLOCK_UP:
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.mogo.module.v2x.entity.net;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
* @date 4/8/21 4:52 PM
|
||||
* 最优路线推荐
|
||||
*/
|
||||
public class V2XRouteRes {
|
||||
private String sn;//车机SN
|
||||
private String roadId;//当前道路唯一标识
|
||||
private int laneNum;//当前车道唯一标识
|
||||
private int mostLaneNum;//最优车道号
|
||||
private double mostSpeed;//最优车道平均速度
|
||||
private List locusList;//线性经纬度轨迹列表
|
||||
private double locusLat;
|
||||
private double locusLon;
|
||||
|
||||
private double heading;// 车头朝向
|
||||
private long satelliteTime;//定位卫星时间
|
||||
private long showTime;//展示时间
|
||||
|
||||
private int warningType;// 1-最优车道,2-安全距离,3-交通预警
|
||||
|
||||
|
||||
}
|
||||
@@ -53,6 +53,11 @@ public class SurroundingConstruction implements Serializable {
|
||||
typeName += "交通检查";
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT:
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT_01: // 重大事故
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT_02: // 特大事故
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT_03: // 较大事故
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT_04: // 一般事故
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT_05: // 轻微事故
|
||||
typeName += "交通事故";
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_BLOCK_UP:
|
||||
|
||||
@@ -23,6 +23,8 @@ import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.alarm.V2XAlarmServer;
|
||||
import com.mogo.module.v2x.network.V2XRefreshCallback;
|
||||
import com.mogo.module.v2x.observer.CarLocationSubject;
|
||||
import com.mogo.module.v2x.observer.V2XOptimalRouteObserver;
|
||||
import com.mogo.module.v2x.scenario.impl.V2XScenarioManager;
|
||||
import com.mogo.module.v2x.scenario.scene.obu.V2XObuEventScenario;
|
||||
import com.mogo.module.v2x.utils.ADASUtils;
|
||||
@@ -50,7 +52,10 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
* desc : V2X中用到的位置监听。处理刷新频率,以及位置改变是否触发道路事件警报
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XLocationListener implements IMogoLocationListener, CarStatusListener, IMogoCarLocationChangedListener2 {
|
||||
public class V2XLocationListener
|
||||
implements IMogoLocationListener,
|
||||
CarStatusListener,
|
||||
IMogoCarLocationChangedListener2 {
|
||||
private String TAG = "V2XLocationListener";
|
||||
|
||||
private MogoLocation mLastCarLocation;
|
||||
@@ -61,7 +66,14 @@ public class V2XLocationListener implements IMogoLocationListener, CarStatusList
|
||||
|
||||
private static V2XLocationListener mV2XLocationListener;
|
||||
|
||||
private CarLocationSubject mCarLocationSubject;
|
||||
|
||||
private V2XLocationListener() {
|
||||
mCarLocationSubject = new CarLocationSubject();
|
||||
// 注册最优路线的推荐观察者
|
||||
mCarLocationSubject.registerObserver(
|
||||
V2XOptimalRouteObserver.TYPE,
|
||||
V2XOptimalRouteObserver.getInstance());
|
||||
}
|
||||
|
||||
public synchronized static V2XLocationListener getInstance() {
|
||||
@@ -74,22 +86,22 @@ public class V2XLocationListener implements IMogoLocationListener, CarStatusList
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged( MogoLatLng latLng ) {
|
||||
public void onCarLocationChanged(MogoLatLng latLng) {
|
||||
// do not impl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged2( Location location ) {
|
||||
public void onCarLocationChanged2(Location location) {
|
||||
MogoLocation loc = new MogoLocation();
|
||||
loc.setTime( loc.getTime());
|
||||
loc.setAccuracy( location.getAccuracy() );
|
||||
loc.setSpeed( location.getSpeed());
|
||||
loc.setLongitude( location.getLongitude() );
|
||||
loc.setLatitude( location.getLatitude() );
|
||||
loc.setAltitude( location.getAltitude() );
|
||||
loc.setBearing( location.getBearing() );
|
||||
loc.setProvider( location.getProvider() );
|
||||
onLocationChangedImpl( loc );
|
||||
loc.setTime(loc.getTime());
|
||||
loc.setAccuracy(location.getAccuracy());
|
||||
loc.setSpeed(location.getSpeed());
|
||||
loc.setLongitude(location.getLongitude());
|
||||
loc.setLatitude(location.getLatitude());
|
||||
loc.setAltitude(location.getAltitude());
|
||||
loc.setBearing(location.getBearing());
|
||||
loc.setProvider(location.getProvider());
|
||||
onLocationChangedImpl(loc);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -97,8 +109,9 @@ public class V2XLocationListener implements IMogoLocationListener, CarStatusList
|
||||
// onLocationChangedImpl(location);
|
||||
}
|
||||
|
||||
private void onLocationChangedImpl(MogoLocation location){
|
||||
private void onLocationChangedImpl(MogoLocation location) {
|
||||
try {
|
||||
mCarLocationSubject.setCarLocation(location);
|
||||
//Logger.d(V2XConst.MODULE_NAME, "V2X预警--onLocationChanged: " + GsonUtil.jsonFromObject(location));
|
||||
// 刷新角度
|
||||
getCurrentCarAngle(location);
|
||||
@@ -143,8 +156,12 @@ public class V2XLocationListener implements IMogoLocationListener, CarStatusList
|
||||
if (mMogoPolyline != null && (V2XServiceManager.getMoGoV2XStatusManager().isRoadEventPOIShow()
|
||||
|| V2XServiceManager.getMoGoV2XStatusManager().isOtherSeekHelpPOIShow())
|
||||
&& V2XServiceManager.getV2XStatusManager().getTargetMoGoLatLng() != null) {
|
||||
mMogoPolyline.setPoints(Arrays.asList(new MogoLatLng(location.getLatitude(), location.getLongitude()),
|
||||
V2XServiceManager.getV2XStatusManager().getTargetMoGoLatLng()));
|
||||
|
||||
// 取出原有的绘制线的经纬度点
|
||||
List<MogoLatLng> pointsOdl = mMogoPolyline.getPoints();
|
||||
// 重新设置第一个坐标,也就是当前车辆位置
|
||||
pointsOdl.set(0, new MogoLatLng(location.getLatitude(), location.getLongitude()));
|
||||
mMogoPolyline.setPoints(pointsOdl);
|
||||
|
||||
float zoomLevel = V2XServiceManager.getMapUIController().getZoomLevel();
|
||||
//Logger.d(V2XConst.MODULE_NAME, "当前地图的缩放比例为:" + zoomLevel);
|
||||
|
||||
@@ -6,6 +6,8 @@ import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
|
||||
@@ -34,6 +34,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_STOP_LINE_DATA;
|
||||
import static com.mogo.module.v2x.V2XConst.V2X_FRONT_WARNING_MARKER;
|
||||
import static com.mogo.module.v2x.V2XServiceManager.getContext;
|
||||
|
||||
@@ -46,7 +47,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
private static String TAG = "MoGoV2XCloundDataManager";
|
||||
private boolean isSelfLineClear;
|
||||
private List fillPoints = new ArrayList();//停止线经纬度合集
|
||||
|
||||
private static long showTime = 0;
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
@@ -59,6 +60,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
Log.d(V2XConst.LOG_NAME_WARN, "analysisV2XCloundDataEvent -----> ");
|
||||
|
||||
mCloundWarningInfo = cloundWarningInfo;
|
||||
showTime = mCloundWarningInfo.getShowTime();
|
||||
pointsBetween();
|
||||
|
||||
//发送预警提示
|
||||
@@ -68,24 +70,23 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
|
||||
Log.d(V2XConst.LOG_NAME_WARN, "direction = " + cloundWarningInfo.getDirection());
|
||||
if (cloundWarningInfo.getDirection() == 1) { //前方
|
||||
MogoLatLng newLocation = LocationUtils.getNewLocation((MogoLatLng) fillPoints.get(0), 80, cloundWarningInfo.getAngle());
|
||||
//停止线前方画线
|
||||
MogoLatLng newLocation = LocationUtils.getNewLocation((MogoLatLng) fillPoints.get(0), 80, cloundWarningInfo.heading);
|
||||
WorkThreadHandler.getInstance().postDelayed(() -> {
|
||||
//添加停止线
|
||||
drawStopLineWith2Resource();
|
||||
//二轮车和行人的渲染和移动
|
||||
V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo);
|
||||
//绘制识别物与交汇点连线,并且更新连线数据
|
||||
drawStopLine(cloundWarningInfo, newLocation);
|
||||
//添加停止线marker
|
||||
drawStopLineWith2Resource();
|
||||
}, 200);
|
||||
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine();
|
||||
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
|
||||
V2XServiceManager.getMoGoStopPolylineManager().clearLine();
|
||||
|
||||
isSelfLineClear = true;
|
||||
}, 8000);
|
||||
}, showTime);
|
||||
|
||||
} else { //左侧或者右侧
|
||||
WorkThreadHandler.getInstance().postDelayed(() -> {
|
||||
@@ -99,9 +100,8 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine();
|
||||
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
|
||||
|
||||
isSelfLineClear = true;
|
||||
}, 8000);
|
||||
}, showTime);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -125,26 +125,29 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
* 2D资源绘制停止线
|
||||
* */
|
||||
private void drawStopLineWith2Resource() {
|
||||
mCloundWarningInfo.setCarLocation(new MogoLatLng(39.976866,116.417622));//测试数据
|
||||
MogoLatLng carlo = mCloundWarningInfo.getCarLocation();
|
||||
if (carlo == null){
|
||||
if (carlo == null) {
|
||||
double lon = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon();
|
||||
double lat = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat();
|
||||
carlo = new MogoLatLng(lat, lon);
|
||||
}
|
||||
//自车行驶方向的前方*米的经纬度,该经纬度在停止线上
|
||||
MogoLatLng drawStopLineLon = LocationUtils.getNewLocation(carlo, mCloundWarningInfo.getStopLineDistance(), mCloundWarningInfo.getAngle());
|
||||
|
||||
Log.d(TAG, "2D资源绘制停止线" + drawStopLineLon);
|
||||
MogoMarkerOptions optionsRipple = new MogoMarkerOptions()
|
||||
.latitude(drawStopLineLon.getLat())
|
||||
.longitude(drawStopLineLon.getLon())
|
||||
.anchor(0.5f, 0.5f)
|
||||
.anchor(1.0f, 1.0f)
|
||||
.zIndex(MarkerDrawer.MARKER_Z_INDEX_HIGH);
|
||||
|
||||
optionsRipple
|
||||
.icon(ViewUtils.fromView(new EmptyMarkerView(V2XServiceManager.getContext())));
|
||||
IMogoMarker stopLine = V2XServiceManager.getMarkerManager().addMarker(V2X_FRONT_WARNING_MARKER, optionsRipple);
|
||||
IMogoMarker stopLine = V2XServiceManager.getMarkerManager().addMarker(TYPE_MARKER_CLOUD_STOP_LINE_DATA, optionsRipple);
|
||||
stopLine.setInfoWindowAdapter(new SimpleWindow3DAdapter(new V2XFrontTargetMarkerView(V2XServiceManager.getContext())));
|
||||
stopLine.showInfoWindow();
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
stopLine.hideInfoWindow();
|
||||
}, showTime);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -224,6 +227,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
public void onCarLocationChanged2(Location latLng) {
|
||||
Log.e(V2XConst.LOG_NAME_WARN, "onCarLocationChanged2 latLng = " + latLng.getLatitude() + "--" + latLng.getLongitude() + "---isSelfLineClear = " + isSelfLineClear);
|
||||
//当行人经纬度交点 开始画线,否则清理
|
||||
mCloundWarningInfo.setCarLocation(new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()));
|
||||
drawSlefCarLine(latLng);
|
||||
}
|
||||
|
||||
@@ -295,7 +299,6 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
|
||||
private MogoLatLng getMogoLat(MogoLatLng latlng) {
|
||||
MogoLatLng newLocation = LocationUtils.getNewLocation(latlng, mCloundWarningInfo.getDistance(), mCloundWarningInfo.getDirection());
|
||||
|
||||
return newLocation;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerLocation;
|
||||
import com.mogo.module.common.entity.MarkerNoveltyInfo;
|
||||
import com.mogo.module.common.entity.MarkerOnlineCar;
|
||||
import com.mogo.module.common.entity.MarkerPoiTypeEnum;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.common.entity.V2XPoiTypeEnum;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
@@ -395,6 +396,11 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
|
||||
case V2XPoiTypeEnum.FOURS_ICE:
|
||||
case V2XPoiTypeEnum.FOURS_FOG:
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT:
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT_01: // 重大事故
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT_02: // 特大事故
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT_03: // 较大事故
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT_04: // 一般事故
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT_05: // 轻微事故
|
||||
drawableMarker(
|
||||
V2XServiceManager.getContext(),
|
||||
markerShowEntity,
|
||||
|
||||
@@ -6,10 +6,10 @@ import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||
import com.mogo.module.v2x.MoGoV2XServicePaths;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.common.entity.V2XPoiTypeEnum;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.v2x.MoGoV2XServicePaths;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.manager.IMoGoV2XPolylineManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -66,7 +66,7 @@ public class MoGoV2XPolylineManager implements IMoGoV2XPolylineManager {
|
||||
} else {
|
||||
options.add(V2XServiceManager.getV2XStatusManager().getLocation());
|
||||
}
|
||||
// 目标车辆位置
|
||||
// 目标车辆、道路事件位置
|
||||
options.add(V2XServiceManager.getV2XStatusManager().getTargetMoGoLatLng());
|
||||
|
||||
// 绘制线的对象
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.mogo.module.v2x.observer;
|
||||
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
* @date 4/9/21 2:14 PM
|
||||
* 当前车辆位置观察者接口
|
||||
*/
|
||||
public abstract class CarLocationObserver {
|
||||
// 更新状态
|
||||
public abstract void update(MogoLocation carLocation);
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.mogo.module.v2x.observer;
|
||||
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
* @date 4/9/21 2:12 PM
|
||||
* 当前车辆订阅
|
||||
*/
|
||||
public class CarLocationSubject {
|
||||
|
||||
// 车辆位置
|
||||
public MogoLocation carLocation;
|
||||
// 观察者集合
|
||||
private HashMap<String, CarLocationObserver> observers = new HashMap<String, CarLocationObserver>();
|
||||
|
||||
|
||||
/**
|
||||
* 设置新的车辆位置
|
||||
*
|
||||
* @param carLocation 车辆位置
|
||||
*/
|
||||
public void setCarLocation(MogoLocation carLocation) {
|
||||
this.carLocation = carLocation;
|
||||
notifyAllObservers();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加观察者
|
||||
*
|
||||
* @param observerType 观察者类型
|
||||
* @param observer 新的观察者
|
||||
*/
|
||||
public void registerObserver(String observerType, CarLocationObserver observer) {
|
||||
observers.put(observerType, observer);
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除指定类型的观察者
|
||||
*
|
||||
* @param observerType 观察者类型
|
||||
*/
|
||||
public void removeObserver(String observerType) {
|
||||
observers.remove(observerType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通知所有观察者更新
|
||||
*/
|
||||
private void notifyAllObservers() {
|
||||
Set<String> keySet = observers.keySet();
|
||||
for (String s : keySet) {
|
||||
CarLocationObserver observer = observers.get(s);
|
||||
if (observer != null) {
|
||||
observer.update(carLocation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.mogo.module.v2x.observer;
|
||||
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.module.v2x.overlay.V2XOptimalRouteOverlay;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
* @date 4/9/21 2:38 PM
|
||||
* 最优路线推荐
|
||||
*/
|
||||
public class V2XOptimalRouteObserver extends CarLocationObserver {
|
||||
public static String TYPE = "V2XOptimalRouteObserver";
|
||||
|
||||
private static V2XOptimalRouteObserver v2XOptimalRouteObserver;
|
||||
//最优路线覆盖物绘制
|
||||
private V2XOptimalRouteOverlay mV2XOptimalRouteOverlay;
|
||||
// 要绘制的数据
|
||||
private List<double[]> polylinePoint;
|
||||
|
||||
public static V2XOptimalRouteObserver getInstance() {
|
||||
if (v2XOptimalRouteObserver == null) {
|
||||
synchronized (V2XOptimalRouteObserver.class) {
|
||||
if (v2XOptimalRouteObserver == null) {
|
||||
v2XOptimalRouteObserver = new V2XOptimalRouteObserver();
|
||||
}
|
||||
}
|
||||
}
|
||||
return v2XOptimalRouteObserver;
|
||||
}
|
||||
|
||||
private V2XOptimalRouteObserver() {
|
||||
mV2XOptimalRouteOverlay = new V2XOptimalRouteOverlay();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置推荐路线
|
||||
*
|
||||
* @param polylinePoint 推荐的路线
|
||||
*/
|
||||
public void setPolylinePoint(List<double[]> polylinePoint) {
|
||||
this.polylinePoint = polylinePoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(MogoLocation carLocation) {
|
||||
mV2XOptimalRouteOverlay.draw(carLocation, polylinePoint);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.mogo.module.v2x.overlay;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.utils.LocationUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 最优路线推荐的图覆盖物
|
||||
*
|
||||
* @author donghongyu
|
||||
* @date 4/8/21 6:06 PM
|
||||
*/
|
||||
public class V2XOptimalRouteOverlay {
|
||||
private IMogoPolyline mMoGoPolyline;
|
||||
// 连接线参数
|
||||
private MogoPolylineOptions mPolylineOptions;
|
||||
// 线路径集合
|
||||
private List<MogoLatLng> mPolylinePointList;
|
||||
|
||||
public V2XOptimalRouteOverlay() {
|
||||
mPolylineOptions = new MogoPolylineOptions();
|
||||
// 渐变色
|
||||
List<Integer> colors = new ArrayList<>();
|
||||
colors.add(0xFFF95959);
|
||||
// 线条粗细,渐变,渐变色值
|
||||
mPolylineOptions.width(25).useGradient(true).colorValues(colors);
|
||||
// 绘制路径集合
|
||||
mPolylinePointList = new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制最优路线
|
||||
*
|
||||
* @param polylinePoint 要绘制的经纬度度集合
|
||||
*/
|
||||
public IMogoPolyline draw(MogoLocation carLocal, List<double[]> polylinePoint) {
|
||||
if (mMoGoPolyline != null) {
|
||||
mMoGoPolyline.remove();
|
||||
mPolylinePointList.clear();
|
||||
}
|
||||
if (polylinePoint != null) {
|
||||
// 将当前车辆位置放进去
|
||||
mPolylinePointList.add(new MogoLatLng(carLocal.getLatitude(), carLocal.getLongitude()));
|
||||
// 过滤后台推送的推荐路线集合
|
||||
for (double[] polyline : polylinePoint) {
|
||||
MogoLatLng pointMoGoLatLng = new MogoLatLng(polyline[1], polyline[0]);
|
||||
//需要剔除已经行驶过的经纬度,这里需要比对推荐路线集合中的点是否在当前车辆行驶方向前面如果不在则抛弃
|
||||
if (LocationUtils.isPointOnCarFront(carLocal, pointMoGoLatLng)) {
|
||||
mPolylinePointList.add(pointMoGoLatLng);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 替换路径集合
|
||||
mPolylineOptions.points(mPolylinePointList);
|
||||
// 绘制线
|
||||
mMoGoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(mPolylineOptions);
|
||||
return mMoGoPolyline;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -104,11 +104,12 @@ public class V2XScenarioManager implements IV2XScenarioManager {
|
||||
mV2XScenario = new V2XRecommendRouteScenario();
|
||||
break;
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_VR_SHOW:
|
||||
if (V2XServiceManager.getMoGoStatusManager().isVrMode()) {
|
||||
mV2XScenario = new V2XOptimalRouteVREventScenario();
|
||||
} else {
|
||||
mV2XScenario = null;
|
||||
}
|
||||
// if (V2XServiceManager.getMoGoStatusManager().isVrMode()) {
|
||||
//
|
||||
// } else {
|
||||
// mV2XScenario = null;
|
||||
// }
|
||||
mV2XScenario = new V2XOptimalRouteVREventScenario();
|
||||
break;
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_TOP:
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_LEFT:
|
||||
|
||||
@@ -12,6 +12,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.PagerSnapHelper;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.module.common.entity.MarkerPoiTypeEnum;
|
||||
import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XPoiTypeEnum;
|
||||
@@ -179,6 +180,11 @@ public class V2XRoadEventWindow extends V2XBasWindow
|
||||
case V2XPoiTypeEnum.FOURS_FOG://浓雾
|
||||
case V2XPoiTypeEnum.FOURS_ICE://结冰
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT://事故
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT_01: // 重大事故
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT_02: // 特大事故
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT_03: // 较大事故
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT_04: // 一般事故
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT_05: // 轻微事故
|
||||
case V2XPoiTypeEnum.FOURS_LIVING://实时路况
|
||||
case V2XPoiTypeEnum.FOURS_NEALY://身边
|
||||
// 展示道路事件本身详情
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
package com.mogo.module.v2x.scenario.scene.route;
|
||||
|
||||
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.observer.V2XOptimalRouteObserver;
|
||||
import com.mogo.module.v2x.scenario.view.IV2XMarker;
|
||||
import com.mogo.module.v2x.utils.MarkerUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
@@ -22,8 +18,6 @@ import java.util.List;
|
||||
public class V2XOptimalRouteVREventMarker implements IV2XMarker<V2XPushMessageEntity> {
|
||||
private final String TAG = "V2XPushVREventMarker";
|
||||
|
||||
private static IMogoPolyline mMogoPolyline;
|
||||
|
||||
@Override
|
||||
public void drawPOI(V2XPushMessageEntity entity) {
|
||||
Logger.w(V2XConst.MODULE_NAME + "_" + TAG, "drawPOI 绘制VR Marker");
|
||||
@@ -32,10 +26,6 @@ public class V2XOptimalRouteVREventMarker implements IV2XMarker<V2XPushMessageEn
|
||||
// 清除道路事件
|
||||
V2XServiceManager
|
||||
.getMoGoV2XMarkerManager().clearALLPOI();
|
||||
|
||||
if (mMogoPolyline != null) {
|
||||
mMogoPolyline.remove();
|
||||
}
|
||||
// 绘制引导线
|
||||
drawableRecommendPolyline(entity);
|
||||
} catch (Exception e) {
|
||||
@@ -49,23 +39,7 @@ public class V2XOptimalRouteVREventMarker implements IV2XMarker<V2XPushMessageEn
|
||||
* @param entity
|
||||
*/
|
||||
void drawableRecommendPolyline(V2XPushMessageEntity entity) {
|
||||
// 连接线参数
|
||||
MogoPolylineOptions options = new MogoPolylineOptions();
|
||||
|
||||
// 渐变色
|
||||
List<Integer> colors = new ArrayList<>();
|
||||
|
||||
colors.add(0xFFF95959);
|
||||
|
||||
// 线条粗细,渐变,渐变色值
|
||||
options.width(20).useGradient(true).colorValues(colors);
|
||||
|
||||
for (double[] doubles : entity.getRecommendPolyline()) {
|
||||
options.add(doubles[0], doubles[1]);
|
||||
}
|
||||
|
||||
// 绘制线的对象
|
||||
mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options);
|
||||
V2XOptimalRouteObserver.getInstance().setPolylinePoint(entity.getRecommendPolyline());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -79,10 +53,6 @@ public class V2XOptimalRouteVREventMarker implements IV2XMarker<V2XPushMessageEn
|
||||
}
|
||||
|
||||
public void clearLine() {
|
||||
if (mMogoPolyline != null) {
|
||||
mMogoPolyline.remove();
|
||||
mMogoPolyline = null;
|
||||
V2XServiceManager.getV2XStatusManager().setAlarmInfo(null);
|
||||
}
|
||||
V2XOptimalRouteObserver.getInstance().setPolylinePoint(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.mogo.module.v2x.marker.OptimalSpeedMarkerView;
|
||||
import com.mogo.module.v2x.marker.V2XFrontTargetMarkerView;
|
||||
import com.mogo.module.v2x.scenario.view.IV2XMarker;
|
||||
import com.mogo.module.v2x.utils.LocationUtils;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.ViewUtils;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
|
||||
@@ -60,14 +61,14 @@ public class V2XWarningMarker implements IV2XMarker {
|
||||
.longitude(mMarkerEntity.getLon())
|
||||
.anchor(0.5f, 0.5f)
|
||||
.zIndex(MarkerDrawer.MARKER_Z_INDEX_HIGH);
|
||||
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
}
|
||||
optionsRipple
|
||||
.icon(ViewUtils.fromView(new EmptyMarkerView(V2XServiceManager.getContext())));
|
||||
.icon(ViewUtils.fromView(new EmptyMarkerView(mContext)));
|
||||
optimalMarker = V2XServiceManager.getMarkerManager().addMarker(V2X_FRONT_WARNING_MARKER, optionsRipple);
|
||||
optimalMarker.setInfoWindowAdapter(new SimpleWindow3DAdapter(new V2XFrontTargetMarkerView(V2XServiceManager.getContext())));
|
||||
optimalMarker.setInfoWindowAdapter(new SimpleWindow3DAdapter(new V2XFrontTargetMarkerView(mContext)));
|
||||
optimalMarker.showInfoWindow();
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
optimalMarker.hideInfoWindow();
|
||||
}, 8000);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -76,21 +77,6 @@ public class V2XWarningMarker implements IV2XMarker {
|
||||
}
|
||||
|
||||
|
||||
private void drawMarkerWithLocation(MogoLatLng latLng, String tag) {
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.object(markerShowEntity)
|
||||
.latitude(latLng.lat)
|
||||
.longitude(latLng.lon);
|
||||
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
|
||||
options.icon3DRes(com.mogo.module.service.R.raw.people);
|
||||
options.anchor(0.5f, 0.5f);
|
||||
options.anchorColor("#FF4040");
|
||||
IMogoMarker marker = V2XServiceManager.getMarkerManager().addMarker(tag, options);
|
||||
iMarkerView.setMarker(marker);
|
||||
marker.setToTop();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void clearPOI() {
|
||||
V2XServiceManager.getMarkerManager().removeMarkers(V2X_FRONT_WARNING_MARKER);
|
||||
|
||||
@@ -70,6 +70,11 @@ public class EventTypeUtils {
|
||||
break;
|
||||
// 事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT:
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_01: // 重大事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_02: // 特大事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_03: // 较大事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_04: // 一般事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_05: // 轻微事故
|
||||
str = "交通事故";
|
||||
break;
|
||||
// 实时路况
|
||||
@@ -113,6 +118,11 @@ public class EventTypeUtils {
|
||||
break;
|
||||
// 事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT:
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_01: // 重大事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_02: // 特大事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_03: // 较大事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_04: // 一般事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_05: // 轻微事故
|
||||
src = R.drawable.v2x_icon_jiaotongshigu_vr;
|
||||
break;
|
||||
// 交通检查
|
||||
@@ -151,6 +161,11 @@ public class EventTypeUtils {
|
||||
break;
|
||||
// 事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT:
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_01: // 重大事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_02: // 特大事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_03: // 较大事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_04: // 一般事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_05: // 轻微事故
|
||||
str = "前方交通事故";
|
||||
break;
|
||||
// 交通检查
|
||||
@@ -189,6 +204,11 @@ public class EventTypeUtils {
|
||||
case V2XPoiTypeEnum.FOURS_FOG: // 浓雾
|
||||
case V2XPoiTypeEnum.FOURS_ICE: // 结冰
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT: // 事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_01: // 重大事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_02: // 特大事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_03: // 较大事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_04: // 一般事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_05: // 轻微事故
|
||||
strBg = V2XServiceManager.getMoGoStatusManager().isVrMode() ? R.drawable.bg_v2x_event_type_red_vr : R.drawable.bg_v2x_event_type_read;
|
||||
break;
|
||||
default:
|
||||
@@ -220,6 +240,11 @@ public class EventTypeUtils {
|
||||
case V2XPoiTypeEnum.FOURS_FOG: // 浓雾
|
||||
case V2XPoiTypeEnum.FOURS_ICE: // 结冰
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT: // 事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_01: // 重大事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_02: // 特大事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_03: // 较大事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_04: // 一般事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_05: // 轻微事故
|
||||
strBg = R.drawable.bg_v2x_event_type_read;
|
||||
break;
|
||||
default:
|
||||
@@ -247,6 +272,11 @@ public class EventTypeUtils {
|
||||
case V2XPoiTypeEnum.FOURS_FOG://浓雾
|
||||
case V2XPoiTypeEnum.FOURS_ICE://结冰
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT://事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_01: // 重大事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_02: // 特大事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_03: // 较大事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_04: // 一般事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_05: // 轻微事故
|
||||
isRoadEvent = true;
|
||||
break;
|
||||
}
|
||||
@@ -268,6 +298,11 @@ public class EventTypeUtils {
|
||||
case V2XPoiTypeEnum.FOURS_ROAD_WORK://施工
|
||||
case V2XPoiTypeEnum.FOURS_BLOCK_UP://拥堵
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT://事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_01: // 重大事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_02: // 特大事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_03: // 较大事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_04: // 一般事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_05: // 轻微事故
|
||||
isRoadEvent = true;
|
||||
break;
|
||||
}
|
||||
@@ -309,6 +344,11 @@ public class EventTypeUtils {
|
||||
break;
|
||||
// 事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT:
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_01: // 重大事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_02: // 特大事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_03: // 较大事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_04: // 一般事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT_05: // 轻微事故
|
||||
str[0] = "你刚经过 #### \n有事故发生吗?";
|
||||
str[1] = "你刚路过的路段有交通事故吗?您可以直接对我说有事故、或者没有事故。";
|
||||
str[2] = R.drawable.v_to_x_event_ugc_shigu;
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package com.mogo.module.v2x.utils;
|
||||
|
||||
import android.location.Location;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.search.geo.IMogoGeoSearchListener;
|
||||
import com.mogo.map.search.geo.MogoGeocodeResult;
|
||||
import com.mogo.map.search.geo.MogoPoiItem;
|
||||
import com.mogo.map.search.geo.MogoRegeocodeResult;
|
||||
import com.mogo.map.search.geo.query.MogoRegeocodeQuery;
|
||||
import com.mogo.map.search.poisearch.IMogoPoiSearch;
|
||||
import com.mogo.map.search.poisearch.IMogoPoiSearchListener;
|
||||
@@ -69,6 +68,11 @@ public class LocationUtils {
|
||||
poiSearch.searchPOIAsyn();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前位置
|
||||
*
|
||||
* @return 当前位置
|
||||
*/
|
||||
public static MogoLatLng getCurrentLatLon() {
|
||||
MogoLatLng latLon = V2XServiceManager.getNavi().getCarLocation();
|
||||
if (latLon == null) {
|
||||
@@ -89,9 +93,9 @@ public class LocationUtils {
|
||||
return latLon;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* 计算两点间的角度
|
||||
* */
|
||||
*/
|
||||
public static double getAngle(double lon1, double lat1, double lon2,
|
||||
double lat2) {
|
||||
double fLat = Math.PI * (lat1) / 180.0;
|
||||
@@ -108,9 +112,9 @@ public class LocationUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* 根据角度获取指定距离点的经纬度
|
||||
* */
|
||||
*/
|
||||
public static MogoLatLng getNewLocation(MogoLatLng st, double distance, double angle) {
|
||||
mRadLo = st.getLon() * Math.PI / 180.;
|
||||
mRadLa = st.getLat() * Math.PI / 180.;
|
||||
@@ -124,4 +128,31 @@ public class LocationUtils {
|
||||
return new MogoLatLng(lat_new, lon_new);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取传入的经纬度在车辆的什么位置
|
||||
*
|
||||
* @return 顺时针,true-前,false-后
|
||||
*/
|
||||
public static boolean isPointOnCarFront(MogoLocation carLocal, MogoLatLng pointLocal) {
|
||||
double carLon = carLocal.getLongitude();
|
||||
double carLat = carLocal.getLatitude();
|
||||
double poiLon = pointLocal.getLon();
|
||||
double poiLat = pointLocal.getLat();
|
||||
float carAngle = carLocal.getBearing();
|
||||
|
||||
// 计算车辆与点之间的夹角
|
||||
int diffAngle = DrivingDirectionUtils.getDegreeOfCar2Poi(
|
||||
carLon, carLat, poiLon, poiLat, (int) carAngle);
|
||||
|
||||
if (diffAngle <= 90) {
|
||||
Log.i(TAG, "目标点在车辆--前方");
|
||||
return true;
|
||||
} else {
|
||||
Log.i(TAG, "目标点在车辆--后方");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -430,7 +430,7 @@ public class TestOnLineCarUtils {
|
||||
try {
|
||||
InputStream inputStream = V2XUtils.getApp()
|
||||
.getResources()
|
||||
.openRawResource(R.raw.scenario_push_vr_event_data_yongdu_gongsi);
|
||||
.openRawResource(R.raw.scenario_push_vr_event_data_yongdu_gongsi_1);
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
int len = -1;
|
||||
byte[] buffer = new byte[1024];
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 8.7 KiB |
@@ -34,6 +34,12 @@
|
||||
],
|
||||
[
|
||||
116.424272,39.983397
|
||||
],
|
||||
[
|
||||
116.425948,39.983465
|
||||
],
|
||||
[
|
||||
116.42628,39.983399
|
||||
]
|
||||
],
|
||||
"recommendPolyline": [
|
||||
@@ -54,6 +60,12 @@
|
||||
],
|
||||
[
|
||||
116.424272,39.983397
|
||||
],
|
||||
[
|
||||
116.425948,39.983465
|
||||
],
|
||||
[
|
||||
116.42628,39.983399
|
||||
]
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"sceneId": "200008",
|
||||
"alarmContent": "拥堵路线推荐",
|
||||
"expireTime": 10000,
|
||||
"sceneCategory": 0,
|
||||
"sceneDescription": "拥堵路线推荐",
|
||||
"sceneName": "拥堵路线推荐",
|
||||
"sceneLevel": 0,
|
||||
"videoUrl": "",
|
||||
"videoChannel": "",
|
||||
"videoSn": "",
|
||||
"tts": "发现前方拥堵,最优路线快6分钟",
|
||||
"zoom": false,
|
||||
"zoomScale": 15,
|
||||
"userHead": "",
|
||||
"msgImgUrl": "",
|
||||
"lat":39.969088,
|
||||
"lon":116.41808,
|
||||
"polyline": [
|
||||
[
|
||||
116.417388,39.983351
|
||||
],
|
||||
[
|
||||
116.417351,39.9841
|
||||
],
|
||||
[
|
||||
116.417286,39.985423
|
||||
],
|
||||
[
|
||||
116.417233,39.98673
|
||||
],
|
||||
[
|
||||
116.417179,39.988156
|
||||
],
|
||||
[
|
||||
116.417158,39.988493
|
||||
],
|
||||
[
|
||||
116.417142,39.989245
|
||||
],
|
||||
[
|
||||
116.417174,39.990199
|
||||
]
|
||||
],
|
||||
"recommendPolyline": [
|
||||
[
|
||||
116.417388,39.983351
|
||||
],
|
||||
[
|
||||
116.417351,39.9841
|
||||
],
|
||||
[
|
||||
116.417286,39.985423
|
||||
],
|
||||
[
|
||||
116.417233,39.98673
|
||||
],
|
||||
[
|
||||
116.417179,39.988156
|
||||
],
|
||||
[
|
||||
116.417158,39.988493
|
||||
],
|
||||
[
|
||||
116.417142,39.989245
|
||||
],
|
||||
[
|
||||
116.417174,39.990199
|
||||
]
|
||||
]
|
||||
}
|
||||
@@ -20,9 +20,13 @@
|
||||
"direction": 1,
|
||||
"speed": 11.108121,
|
||||
"targetColor": "#FF4040",
|
||||
"stopLineDistance": 15,
|
||||
"stopLineDistance": 20,
|
||||
"warningContent": "小心行人",
|
||||
"heading": 0,
|
||||
"showTime": 3000,
|
||||
"roadwidth": 60.0
|
||||
"showTime": 8000,
|
||||
"roadwidth": 60.0,
|
||||
"carLocation": {
|
||||
"lat": 39.97665425,
|
||||
"lon": 116.41769983
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user