diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 4ff10f68a5..83405b8de1 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -91,7 +91,6 @@
-
diff --git a/gradle.properties b/gradle.properties
index 83e6ee4f59..1d9227fd21 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -155,19 +155,19 @@ LOGLIB_VERSION = 1.0.4
######## MogoAiCloudSDK Version
# 网络请求
-MOGO_NETWORK_VERSION=1.0.67
+MOGO_NETWORK_VERSION=1.0.69
# 鉴权
-MOGO_PASSPORT_VERSION=1.0.67
+MOGO_PASSPORT_VERSION=1.0.69
# 常链接
-MOGO_SOCKET_VERSION=1.0.67
+MOGO_SOCKET_VERSION=1.0.69
# 数据采集
-MOGO_REALTIME_VERSION=1.0.67
+MOGO_REALTIME_VERSION=1.0.69
# 探路,道路事件发布,获取
-MOGO_TANLU_VERSION=1.0.67
+MOGO_TANLU_VERSION=1.0.69
# 直播推流
-MOGO_LIVE_VERSION=1.0.67
+MOGO_LIVE_VERSION=1.0.69
# 直播拉流
-MOGO_TRAFFICLIVE_VERSION=1.0.67
+MOGO_TRAFFICLIVE_VERSION=1.0.69
######## Foundation MogoAiCloud Module
# mogoAiCloud apk services
diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/TanluManager.java b/modules/mogo-module-share/src/main/java/com/mogo/module/share/TanluManager.java
index 9b62ffc657..e88a3a9680 100644
--- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/TanluManager.java
+++ b/modules/mogo-module-share/src/main/java/com/mogo/module/share/TanluManager.java
@@ -12,8 +12,8 @@ import android.view.animation.AccelerateInterpolator;
import android.view.animation.Interpolator;
import android.view.animation.LinearInterpolator;
-import com.mogo.cloud.tanlu.bean.MarkerExploreWay;
-import com.mogo.cloud.tanlu.bean.location.MarkerLocation;
+import com.mogo.cloud.tanlu.bean.MarkerExploreWayCloud;
+import com.mogo.cloud.tanlu.bean.MarkerExploreWayItemCloud;
import com.mogo.commons.voice.AIAssist;
import com.mogo.map.MogoLatLng;
import com.mogo.map.location.MogoLocation;
@@ -33,8 +33,11 @@ import com.mogo.map.search.poisearch.IMogoPoiSearchListener;
import com.mogo.map.search.poisearch.MogoPoiResult;
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
import com.mogo.map.uicontroller.IMogoMapUIController;
-//import com.mogo.module.common.entity.MarkerExploreWay;
+import com.mogo.module.common.entity.MarkerExploreWay;
+import com.mogo.module.common.entity.MarkerExploreWayItem;
+import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.MarkerShowEntity;
+import com.mogo.module.common.entity.MarkerUserInfo;
import com.mogo.module.share.bean.VoiceCmdData;
import com.mogo.module.share.bean.event.MarkerInfo;
import com.mogo.module.share.callback.RoadInfoCallback;
@@ -290,14 +293,15 @@ public class TanluManager implements IMogoMarkerClickListener,
if (voiceData != null) {
mTanluModelData.queryRodeInfo(mContext, mKeywords, voiceData, new RoadInfoCallback() {
@Override
- public void onQueryRoadInfoSuccess(@NotNull List extends MarkerExploreWay> roadInfoList) {
+ public void onQueryRoadInfoSuccess(@NotNull List extends MarkerExploreWayCloud> roadInfoList) {
if (roadInfoList == null || (roadInfoList != null && roadInfoList.size() <= 0)) {
+ Logger.e(TAG, "onQueryRoadInfoSuccess roadInfoList == null ");
if (TextUtils.equals(mKeywords, "附近")) {
speakFailVoice("未发现附近的特殊路况");
} else {
speakFailVoice("未发现" + mKeywords + "附近的特殊路况");
}
- moveToMarcker(currentLat, currentLon);
+ moveToMarker(currentLat, currentLon);
return;
}
Logger.d(TAG, "onQueryRoadInfoSuccess roadInfoList.size() = " + roadInfoList.size()
@@ -306,7 +310,8 @@ public class TanluManager implements IMogoMarkerClickListener,
if (location != null) {
mCity = location.getCityName();
}
- addMarkersAction((List) roadInfoList, currentLat, currentLon);
+
+ addMarkersAction(convertMarkerExploreWayList((List) roadInfoList), currentLat, currentLon);
}
@Override
@@ -318,7 +323,7 @@ public class TanluManager implements IMogoMarkerClickListener,
} else {
speakFailVoice("未发现" + mKeywords + "附近的特殊路况");
}
- moveToMarcker(currentLat, currentLon);
+ moveToMarker(currentLat, currentLon);
}
@Override
@@ -330,6 +335,79 @@ public class TanluManager implements IMogoMarkerClickListener,
}
}
+
+ /**
+ * 列表转换
+ * @param list
+ * @return
+ */
+ private List convertMarkerExploreWayList(List list) {
+ List convertList = new ArrayList<>();
+ if (list != null && list.size() != 0) {
+ Log.d(TAG, "--------1--------");
+ for (int i = 0; i < list.size(); i++) {
+ MarkerExploreWayCloud exploreWayCloud = list.get(i);
+ Log.d(TAG, "--------2--------");
+ if (exploreWayCloud != null) {
+ Log.d(TAG, "--------3--------");
+ MarkerExploreWay exploreWay = new MarkerExploreWay();
+ exploreWay.setInfoId(exploreWayCloud.getInfoId());
+ exploreWay.setType(exploreWayCloud.getType());
+ exploreWay.setPoiType(exploreWayCloud.getPoiType());
+ exploreWay.setSn(exploreWayCloud.getSn());
+
+ MarkerLocation location = new MarkerLocation();
+ location.setLon(exploreWayCloud.getLocation().getLon());
+ location.setLat(exploreWayCloud.getLocation().getLat());
+ exploreWay.setLocation(location);
+ exploreWay.setDirection((int)exploreWayCloud.getDirection());
+ exploreWay.setCanLive(exploreWayCloud.getCanLive());
+ exploreWay.setFileType((int)exploreWayCloud.getFileType());
+ exploreWay.setAddr(exploreWayCloud.getAddr());
+ exploreWay.setGenerateTime(exploreWayCloud.getGenerateTime());
+ exploreWay.setCityName(exploreWayCloud.getCityName());
+ exploreWay.setDistance(exploreWayCloud.getDistance());
+ exploreWay.setFabulous(exploreWayCloud.isFabulous());
+ exploreWay.setInfoCheckNode(exploreWayCloud.getInfoCheckNode());
+ exploreWay.setUploadType(exploreWayCloud.getUploadType());
+
+ MarkerUserInfo userInfo = new MarkerUserInfo();
+ userInfo.setAge(Integer.valueOf(exploreWayCloud.getUserInfo().getAge()));
+ userInfo.setGender(exploreWayCloud.getUserInfo().getGender());
+ userInfo.setLastActiveweekAvgscore(exploreWayCloud.getUserInfo().getLastActiveweekAvgscore());
+ userInfo.setSafeLabel(exploreWayCloud.getUserInfo().getSafeLabel());
+ userInfo.setSn(exploreWayCloud.getUserInfo().getSn());
+ userInfo.setUserHead(exploreWayCloud.getUserInfo().getUserHead());
+ userInfo.setUserId(exploreWayCloud.getUserInfo().getUserId());
+ userInfo.setUserName(exploreWayCloud.getUserInfo().getUserName());
+ exploreWay.setUserInfo(userInfo);
+
+ List items = new ArrayList<>();
+ if (exploreWayCloud.getItems() != null && exploreWayCloud.getItems().size() > 0) {
+ Log.d(TAG, "--------4----------");
+ for (int j = 0; j < exploreWayCloud.getItems().size(); j++) {
+ MarkerExploreWayItemCloud cloudItem = exploreWayCloud.getItems().get(j);
+ MarkerExploreWayItem item = new MarkerExploreWayItem();
+ item.setContent(cloudItem.getContent());
+ item.setIllegalCount(cloudItem.getIllegalCount());
+ item.setThumbnail(cloudItem.getThumbnail());
+ item.setUrl(cloudItem.getUrl());
+ items.add(item);
+ }
+ }
+ convertList.add(exploreWay);
+ }
+ }
+
+ markerExploreWayList.addAll(convertList);
+ Log.d(TAG, "--------5--------- markerExploreWayList.size() =" + markerExploreWayList.size());
+ } else {
+ Logger.e(TAG, "convertMarkerExploreWayList list == null ");
+ }
+
+ return convertList;
+ }
+
/**
* 添加marker
*/
@@ -341,7 +419,7 @@ public class TanluManager implements IMogoMarkerClickListener,
if (mMogoStatusManager != null) {
mMogoStatusManager.setUserInteractionStatus(ShareConstants.MODEL_NAME, true, true);
}
- moveToMarcker(lat, lon);
+ moveToMarker(lat, lon);
inputlon = lon;
inputlat = lat;
@@ -364,7 +442,7 @@ public class TanluManager implements IMogoMarkerClickListener,
markerShowEntity.setBindObj(markerExploreWayList.get(i));
markerShowEntity.setTextContent(list.get(i).getAddr());
- markerShowEntity.setMarkerLocation(getLocation(markerExploreWayList.get(i).getLocation()));
+ markerShowEntity.setMarkerLocation(markerExploreWayList.get(i).getLocation());
markerShowEntity.setMarkerType(ShareConstants.MODEL_NAME);
TanluServiceManager.getServiceApis().getMarkerService().drawMarker(markerShowEntity);
@@ -383,16 +461,6 @@ public class TanluManager implements IMogoMarkerClickListener,
//直接使用当前数据list,作为切换的数据源,切换左侧列表到最新的数据
}
- private com.mogo.module.common.entity.MarkerLocation getLocation(MarkerLocation location) {
- com.mogo.module.common.entity.MarkerLocation markerLocation = new com.mogo.module.common.entity.MarkerLocation();
- markerLocation.setLat(location.getLat());
- markerLocation.setLon(location.getLon());
- markerLocation.setAddress(location.getAddress());
- markerLocation.setAngle(location.getAngle());
-
- return markerLocation;
-
- }
/**
* marker动画
@@ -426,7 +494,7 @@ public class TanluManager implements IMogoMarkerClickListener,
}, delay);
}
- private void moveToMarcker(double lat, double lon) {
+ private void moveToMarker(double lat, double lon) {
Logger.d(TAG, "moveToMarcker lat = " + lat + " >>>>lon = " + lon);
MogoLatLng latLng = new MogoLatLng(lat, lon);
mMogoStatusManager.setUserInteractionStatus(TAG, true, false);
diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/callback/RoadInfoCallback.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/callback/RoadInfoCallback.kt
index 5c56223851..91d4456bb8 100644
--- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/callback/RoadInfoCallback.kt
+++ b/modules/mogo-module-share/src/main/java/com/mogo/module/share/callback/RoadInfoCallback.kt
@@ -1,13 +1,11 @@
package com.mogo.module.share.callback
-//import com.mogo.module.common.entity.MarkerExploreWay
-
-import com.mogo.cloud.tanlu.bean.MarkerExploreWay
+import com.mogo.cloud.tanlu.bean.MarkerExploreWayCloud
interface RoadInfoCallback {
fun onLocatSuccess(lat: Double, lon: Double)
- fun onQueryRoadInfoSuccess(roadInfoList:List)
+ fun onQueryRoadInfoSuccess(roadInfoList:List)
fun onQueryRoadInfoFail(msg: String, code: Int)
}
\ No newline at end of file
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/model/DrawLineInfo.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/model/DrawLineInfo.java
index f2d9fe9e43..0033028dd1 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/model/DrawLineInfo.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/model/DrawLineInfo.java
@@ -2,6 +2,8 @@ package com.mogo.module.v2x.entity.model;
import com.mogo.map.MogoLatLng;
+import java.util.List;
+
/**
* @author lixiaopeng
@@ -14,9 +16,13 @@ public class DrawLineInfo {
// 起点位置
private MogoLatLng startLocation;
+
//结束点位置
private MogoLatLng endLocation;
+ //绘制线的多个点位置
+ private List locations;
+
private double heading;
private float width;
@@ -70,4 +76,12 @@ public class DrawLineInfo {
public void setDirection(int direction) {
this.direction = direction;
}
+
+ public List getLocations() {
+ return locations;
+ }
+
+ public void setLocations(List locations) {
+ this.locations = locations;
+ }
}
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoPersonWarnPolylineManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoPersonWarnPolylineManager.java
index d2d42ead25..db40465730 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoPersonWarnPolylineManager.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoPersonWarnPolylineManager.java
@@ -4,6 +4,7 @@ import android.content.Context;
import android.util.Log;
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;
@@ -13,6 +14,7 @@ import com.mogo.module.v2x.entity.model.DrawLineInfo;
import com.mogo.module.v2x.manager.IMoGoPersonWarnPolylineManager;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
/**
@@ -39,17 +41,17 @@ public class MoGoPersonWarnPolylineManager implements IMoGoPersonWarnPolylineMan
// 渐变色
List colors = new ArrayList<>();
- colors.add(0xFFE32F46);
- colors.add(0xFFE32F46);
+ colors.add(0x0DE32F46);
+ colors.add(0xD9E32F46);
+ colors.add(0x0DE32F46);
// 线条粗细,渐变,渐变色值
Log.d(V2XConst.LOG_NAME_WARN, "MoGoPersonWarnPolylineManager width = " + info.getWidth());
options.width(info.getWidth()).useGradient(true).colorValues(colors);
- // 当前车辆位置
- options.add(info.getStartLocation());
- // 目标车辆位置
- options.add(info.getEndLocation());
-
+ List locations = info.getLocations();
+ for (int i = 0; i < locations.size(); i++) {
+ options.add(locations.get(i));
+ }
// 绘制线的对象
mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options);
mMogoPolyline.setTransparency(0.5f);
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoStopPolylineManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoStopPolylineManager.java
index 1e957b2199..45c31da68c 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoStopPolylineManager.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoStopPolylineManager.java
@@ -4,6 +4,7 @@ import android.content.Context;
import android.util.Log;
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;
@@ -38,17 +39,18 @@ public class MoGoStopPolylineManager implements IMoGoStopPolylineManager {
// 连接线参数
MogoPolylineOptions options = new MogoPolylineOptions();
List colors = new ArrayList<>();
- colors.add(0xFFE32F46);
- colors.add(0xFFE32F46);
+ colors.add(0x0DE32F46);
+ colors.add(0xD9E32F46);
+ colors.add(0x0DE32F46);
Log.d(V2XConst.LOG_NAME_WARN, "MoGoStopPolylineManager roadWidth = " + info.getWidth());
// 线条粗细,渐变,渐变色值
// 当前车辆位置
options.width(info.getWidth() == 0.0 ? 60 : info.getWidth()).useGradient(true).colorValues(colors);
- options.add(info.getStartLocation());
- // 目标车辆位置
- options.add(info.getEndLocation());
-
+ List locations = info.getLocations();
+ for (int i = 0; i < locations.size(); i++) {
+ options.add(locations.get(i));
+ }
// 绘制线的对象
mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options);
mMogoPolyline.setTransparency(0.5f);
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XCloundDataManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XCloundDataManager.java
index 3550dad486..6e4b115c29 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XCloundDataManager.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XCloundDataManager.java
@@ -7,15 +7,10 @@ import android.util.Log;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.map.MogoLatLng;
-import com.mogo.map.marker.IMogoMarker;
-import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
import com.mogo.map.overlay.IMogoPolyline;
import com.mogo.module.common.MogoApisHandler;
-import com.mogo.module.common.drawer.MarkerDrawer;
import com.mogo.module.common.drawer.V2XWarnDataDrawer;
-import com.mogo.module.common.drawer.marker.EmptyMarkerView;
-import com.mogo.module.common.drawer.marker.SimpleWindow3DAdapter;
import com.mogo.module.common.entity.V2XWarningEntity;
import com.mogo.module.service.MarkerServiceHandler;
import com.mogo.module.service.receiver.MogoReceiver;
@@ -24,18 +19,14 @@ import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.entity.model.DrawLineInfo;
import com.mogo.module.v2x.manager.IMoGoV2XCloundDataManager;
-import com.mogo.module.v2x.marker.V2XFrontTargetMarkerView;
import com.mogo.module.v2x.utils.LocationUtils;
import com.mogo.utils.UiThreadHandler;
-import com.mogo.utils.ViewUtils;
import com.mogo.utils.WorkThreadHandler;
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;
/**
@@ -48,7 +39,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
private boolean isSelfLineClear;
private List fillPoints = new ArrayList();//停止线经纬度合集
private boolean isFirstLocation = false;
- private MogoLatLng mNewLocation;
+ private MogoLatLng carLocation;
private static long showTime = 0;
@@ -65,7 +56,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
showTime = mCloundWarningInfo.getShowTime();
pointsBetween();
- //发送预警提示
+ //预警蒙层
MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(cloundWarningInfo.getType(), MogoReceiver.ACTION_V2X_FRONT_WARNING);
isSelfLineClear = false;
isFirstLocation = false;
@@ -74,8 +65,6 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
MogoLatLng newLocation = LocationUtils.getNewLocation((MogoLatLng) fillPoints.get(0), 80, cloundWarningInfo.getAngle());
//停止线前方画线
WorkThreadHandler.getInstance().postDelayed(() -> {
- //添加停止线
- drawStopLineWith2Resource();
//二轮车和行人的渲染和移动
V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo);
//绘制识别物与交汇点连线,并且更新连线数据
@@ -122,57 +111,32 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
}
}
- /*
- * 2D资源绘制停止线
- * */
- private void drawStopLineWith2Resource() {
- MogoLatLng carlo = mCloundWarningInfo.getCarLocation();
- 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(1.0f, 1.0f)
- .zIndex(MarkerDrawer.MARKER_Z_INDEX_HIGH);
-
- optionsRipple
- .icon(ViewUtils.fromView(new EmptyMarkerView(V2XServiceManager.getContext())));
- 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);
- }
-
/**
- * 绘制停止线前方线 TODO 需要实时给行人当前位置
+ * 绘制红色区域(停止线继续前行的预警区域) TODO 需要实时给行人当前位置
*/
private void drawStopLine(V2XWarningEntity info, MogoLatLng mogoLatLng) {
IMogoPolyline polyLine = V2XServiceManager.getMoGoStopPolylineManager().getMogoStopPolyline();
+ MogoLatLng startLatlng = new MogoLatLng(carLocation.lat, carLocation.lon);
+ MogoLatLng endLatlng = new MogoLatLng(mogoLatLng.lat, mogoLatLng.lon);
+ Log.d(V2XConst.LOG_NAME_WARN, " drawStopLine endLatlng lon =" + endLatlng.lon + "--lat =" + endLatlng.lat
+ + "--startLatlng lon = " + startLatlng.lon + "-lat = " + startLatlng.lat);
+ float distance = CoordinateUtils.calculateLineDistance(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat);
+ MogoLatLng addMiddleLoc = LocationUtils.getNewLocation(startLatlng, distance / 2, mCloundWarningInfo.getAngle());
if (info != null) {
if (polyLine != null) {
Log.d(V2XConst.LOG_NAME_WARN, "drawStopLine polyLine != null");
- polyLine.setPoints(Arrays.asList(new MogoLatLng(mNewLocation.lat, mNewLocation.lon),
- new MogoLatLng(mogoLatLng.lat, mogoLatLng.lon)));
+ polyLine.setPoints(Arrays.asList(startLatlng, addMiddleLoc, endLatlng));
polyLine.setTransparency(0.5f);
} else {
DrawLineInfo lineInfo = new DrawLineInfo();
- MogoLatLng startLatlng = new MogoLatLng(mNewLocation.lat, mNewLocation.lon);
- MogoLatLng endLatlng = new MogoLatLng(mogoLatLng.lat, mogoLatLng.lon);
- Log.d(V2XConst.LOG_NAME_WARN, " drawStopLine endLatlng lon =" + endLatlng.lon + "--lat =" + endLatlng.lat
- + "--startLatlng lon = " + startLatlng.lon + "-lat = " + startLatlng.lat);
- lineInfo.setStartLocation(startLatlng);
- lineInfo.setEndLocation(endLatlng);
+ List locations = new ArrayList();
+ locations.add(startLatlng);
+ locations.add(addMiddleLoc);
+ locations.add(endLatlng);
+ lineInfo.setLocations(locations);
lineInfo.setHeading(info.heading);
Log.d(V2XConst.LOG_NAME_WARN, "drawStopLine width = " + info.getRoadwidth());
- lineInfo.setWidth(info.getRoadwidth());
+ lineInfo.setWidth(info.getRoadwidth() * 10 + 5);
V2XServiceManager.getMoGoStopPolylineManager().drawStopPolyline(getContext(), lineInfo);
}
} else {
@@ -183,25 +147,30 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
/**
- * 绘制行人和二轮车连线,并且更新数据 TODO 需要实时给行人当前位置
+ * 目标物与预碰撞点连线,并且更新数据 TODO 需要实时给行人当前位置
*/
private void drawOtherObjectLine(V2XWarningEntity info) {
IMogoPolyline polyLine = V2XServiceManager.getMoGoPersonWarnPolylineManager().getMogoPersonWarnPolyline();
+ MogoLatLng startLatlng = new MogoLatLng(info.getLat(), info.getLon());
+ MogoLatLng endLatlng = new MogoLatLng(info.getCollisionLat(), info.getCollisionLon());
+ float distance = CoordinateUtils.calculateLineDistance(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat);
+ MogoLatLng addMiddleLoc = LocationUtils.getNewLocation(startLatlng, distance / 2, mCloundWarningInfo.getAngle());
if (info != null) {
if (polyLine != null) {
Log.d(V2XConst.LOG_NAME_WARN, "polyLine != null");
- polyLine.setPoints(Arrays.asList(new MogoLatLng(info.getLat(), info.getLon()),
- new MogoLatLng(info.getCollisionLat(), info.getCollisionLon())));
+ polyLine.setPoints(Arrays.asList(startLatlng, addMiddleLoc, endLatlng));
polyLine.setTransparency(0.5f);
} else {
DrawLineInfo lineInfo = new DrawLineInfo();
- MogoLatLng startLatlng = new MogoLatLng(info.getLat(), info.getLon());
- MogoLatLng endLatlng = new MogoLatLng(info.getCollisionLat(), info.getCollisionLon());
- lineInfo.setStartLocation(startLatlng);
- lineInfo.setEndLocation(endLatlng);
+ Log.d(TAG, "目标物与预碰撞点画线点为" + "起点:" + startLatlng + "中间点:" + addMiddleLoc + "终点:" + endLatlng);
+ List locations = new ArrayList();
+ locations.add(startLatlng);
+ locations.add(addMiddleLoc);
+ locations.add(endLatlng);
+ lineInfo.setLocations(locations);
lineInfo.setHeading(info.heading);
Log.d(V2XConst.LOG_NAME_WARN, "drawOtherObjectLine width = " + info.getRoadwidth());
- lineInfo.setWidth(info.getRoadwidth());
+ lineInfo.setWidth(info.getRoadwidth() * 10 + 5);
V2XServiceManager.getMoGoPersonWarnPolylineManager().drawPersonWarnPolyline(getContext(), lineInfo);
}
} else {
@@ -232,32 +201,38 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
}
/**
- * 绘制自车连线
+ * 绘制安全区域,自车与碰撞点之间的蓝色线
*/
private void drawSlefCarLine(Location latLng) {
if (!isSelfLineClear) {
IMogoPolyline mogoPolyline = V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline();
if (mCloundWarningInfo != null) {
+ MogoLatLng startLatlng = null;
+ MogoLatLng endLatlng = null;
+ MogoLatLng addMiddleLoc = null;
if (!isFirstLocation) {
- mNewLocation = getMogoLat(new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()));
- Log.d(V2XConst.LOG_NAME_WARN, "drawSlefCarLine lon = " + mNewLocation.lon + "---lat = " + mNewLocation.lat);
+ startLatlng = new MogoLatLng(latLng.getLatitude(), latLng.getLongitude());
+ carLocation = getMogoLat(new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()));
+ endLatlng = new MogoLatLng(mCloundWarningInfo.getDirection() == 1 ? carLocation.lat : mCloundWarningInfo.getCollisionLat(),
+ mCloundWarningInfo.getDirection() == 1 ? carLocation.lon : mCloundWarningInfo.getCollisionLon());
+ float distance = CoordinateUtils.calculateLineDistance(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat);
+ addMiddleLoc = LocationUtils.getNewLocation(startLatlng, distance / 2, mCloundWarningInfo.getAngle());
+ Log.d(V2XConst.LOG_NAME_WARN, "drawSlefCarLine lon = " + carLocation.lon + "---lat = " + carLocation.lat);
isFirstLocation = true;
}
if (mogoPolyline != null) {
- mogoPolyline.setPoints(Arrays.asList(new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()),
- new MogoLatLng(mCloundWarningInfo.getDirection() == 1 ? mNewLocation.lat : mCloundWarningInfo.getCollisionLat(),
- mCloundWarningInfo.getDirection() == 1 ? mNewLocation.lon : mCloundWarningInfo.getCollisionLon())));
+ mogoPolyline.setPoints(Arrays.asList(startLatlng, addMiddleLoc, endLatlng));
mogoPolyline.setTransparency(0.5f);
} else {
-// Log.e(V2XConst.LOG_NAME_WARN, "onCarLocationChanged2 mogoPolyline == null width = " + mCloundWarningInfo.getRoadwidth());
DrawLineInfo info = new DrawLineInfo(); // 对象
- MogoLatLng startLatlng = new MogoLatLng(latLng.getLatitude(), latLng.getLongitude());
- MogoLatLng endLatlng = new MogoLatLng(mCloundWarningInfo.getDirection() == 1 ? mNewLocation.lat : mCloundWarningInfo.getCollisionLat(),
- mCloundWarningInfo.getDirection() == 1 ? mNewLocation.lon : mCloundWarningInfo.getCollisionLon());
+ Log.d(TAG, "安全区域的画线点为" + "起点:" + startLatlng + "中间点:" + addMiddleLoc + "终点:" + endLatlng);
+ List locations = new ArrayList();
+ locations.add(startLatlng);
+ locations.add(addMiddleLoc);
+ locations.add(endLatlng);
+ info.setLocations(locations);
info.setHeading(latLng.getBearing());
- info.setStartLocation(startLatlng);
- info.setEndLocation(endLatlng);
- info.setWidth(mCloundWarningInfo.getRoadwidth()); //TODO 还需要转换比例尺
+ info.setWidth(mCloundWarningInfo.getRoadwidth() * 10 + 5);
info.setDirection(mCloundWarningInfo.getDirection());
V2XServiceManager.getMoGoWarnPolylineManager().drawWarnPolyline(getContext(), info);
}
@@ -297,7 +272,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
}
private MogoLatLng getMogoLat(MogoLatLng latlng) {
- MogoLatLng newLocation = LocationUtils.getNewLocation(latlng, mCloundWarningInfo.getDistance(), mCloundWarningInfo.getDirection());
+ MogoLatLng newLocation = LocationUtils.getNewLocation(latlng, mCloundWarningInfo.getStopLineDistance(), mCloundWarningInfo.getDirection());
return newLocation;
}
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoWarnPolylineManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoWarnPolylineManager.java
index 51a9fcb00d..be8388e88a 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoWarnPolylineManager.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoWarnPolylineManager.java
@@ -43,11 +43,13 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager {
List colors = new ArrayList<>();
if (info.getDirection() == 1) {
- colors.add(0xFF3036FF);
- colors.add(0xFF3036FF);
+ colors.add(0x0D3036FF);
+ colors.add(0xD93036FF);
+ colors.add(0x0D3036FF);
} else {
- colors.add(0xFFE32F46);
- colors.add(0xFFE32F46);
+ colors.add(0x0DE32F46);
+ colors.add(0xD9E32F46);
+ colors.add(0x0DE32F46);
}
Log.d(V2XConst.LOG_NAME_WARN, "MoGoWarnPolylineManager roadWidth = " + info.getWidth());
@@ -55,10 +57,10 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager {
// 当前车辆位置
options.width(info.getWidth() == 0.0 ? 60 : info.getWidth()).useGradient(true).colorValues(colors);
// options.width(60).useGradient(true).colorValues(colors);
- options.add(info.getStartLocation());
- // 目标车辆位置
- options.add(info.getEndLocation());
-
+ List locations = info.getLocations();
+ for (int i = 0; i < locations.size(); i++) {
+ options.add(locations.get(i));
+ }
// 绘制线的对象
mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options);
mMogoPolyline.setTransparency(0.5f);
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java
index c6b26b9c3a..d7f2bdbba2 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java
@@ -31,6 +31,7 @@ import com.mogo.utils.WorkThreadHandler;
import java.util.ArrayList;
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.V2XConst.V2X_OPTIMAL_SPEED_MARKER;
@@ -86,4 +87,33 @@ public class V2XWarningMarker implements IV2XMarker {
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
}
+
+ /*
+ * 2D资源绘制停止线
+ * */
+ private void drawStopLineWith2Resource() {
+ MogoLatLng carlo = mMarkerEntity.getCarLocation();
+ 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, mMarkerEntity.getStopLineDistance(), mMarkerEntity.getAngle());
+ Log.d(TAG, "2D资源绘制停止线" + drawStopLineLon);
+ MogoMarkerOptions optionsRipple = new MogoMarkerOptions()
+ .latitude(drawStopLineLon.getLat())
+ .longitude(drawStopLineLon.getLon())
+ .anchor(1.0f, 1.0f)
+ .zIndex(MarkerDrawer.MARKER_Z_INDEX_HIGH);
+
+ optionsRipple
+ .icon(ViewUtils.fromView(new EmptyMarkerView(V2XServiceManager.getContext())));
+ 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();
+ }, 8000);
+ }
}
diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json
index c9530e4ff2..dd781a966a 100644
--- a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json
+++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json
@@ -20,11 +20,11 @@
"direction": 1,
"speed": 11.108121,
"targetColor": "#FF4040",
- "stopLineDistance": 3000,
+ "stopLineDistance": 60,
"warningContent": "小心行人",
"heading": 0,
"showTime": 8000,
- "roadwidth": 60.0,
+ "roadwidth": 4.0,
"carLocation": {
"lat": 39.97665425,
"lon": 116.41769983