diff --git a/gradle.properties b/gradle.properties index edcdd3acd8..1d9227fd21 100644 --- a/gradle.properties +++ b/gradle.properties @@ -145,7 +145,7 @@ MOGO_OCH_TAXI_VERSION=1.0.0 ######## 外部依赖引用 # 车聊聊 -CARCHATTING_VERSION=2.2.318 +CARCHATTING_VERSION=2.2.320 # 车聊聊接口 CARCHATTINGPROVIDER_VERSION=1.1.11 # websocket @@ -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-extensions/src/main/res/drawable/yi_biao_pan_bg_nor.xml b/modules/mogo-module-extensions/src/main/res/drawable/yi_biao_pan_bg_nor.xml index 99548b5edd..9c1429d2f4 100644 --- a/modules/mogo-module-extensions/src/main/res/drawable/yi_biao_pan_bg_nor.xml +++ b/modules/mogo-module-extensions/src/main/res/drawable/yi_biao_pan_bg_nor.xml @@ -2,11 +2,11 @@ - - - + android:endColor="#3B4577" + android:startColor="#3B4577" /> + + + - - - + + + roadInfoList) { + public void onQueryRoadInfoSuccess(@NotNull List 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..db6f53c4d2 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; @@ -60,148 +51,129 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog @Override public void analysisV2XCloundDataEvent(V2XWarningEntity cloundWarningInfo) { - Log.d(V2XConst.LOG_NAME_WARN, "analysisV2XCloundDataEvent -----> "); - mCloundWarningInfo = cloundWarningInfo; - showTime = mCloundWarningInfo.getShowTime(); - pointsBetween(); + if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) { + Log.d(V2XConst.LOG_NAME_WARN, "analysisV2XCloundDataEvent -----> "); + mCloundWarningInfo = cloundWarningInfo; + showTime = mCloundWarningInfo.getShowTime(); + pointsBetween(); - //发送预警提示 - MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(cloundWarningInfo.getType(), MogoReceiver.ACTION_V2X_FRONT_WARNING); - isSelfLineClear = false; - isFirstLocation = false; + //预警蒙层 + MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(cloundWarningInfo.getType(), MogoReceiver.ACTION_V2X_FRONT_WARNING); + isSelfLineClear = false; + isFirstLocation = false; - if (cloundWarningInfo.getDirection() == 1) { //前方 - MogoLatLng newLocation = LocationUtils.getNewLocation((MogoLatLng) fillPoints.get(0), 80, cloundWarningInfo.getAngle()); - //停止线前方画线 - WorkThreadHandler.getInstance().postDelayed(() -> { - //添加停止线 - drawStopLineWith2Resource(); - //二轮车和行人的渲染和移动 - V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo); - //绘制识别物与交汇点连线,并且更新连线数据 - drawStopLine(cloundWarningInfo, newLocation); - //添加停止线marker - handleStopLine(); - }, 800); + if (cloundWarningInfo.getDirection() == 1) { //前方 + MogoLatLng newLocation = LocationUtils.getNewLocation((MogoLatLng) fillPoints.get(0), 80, cloundWarningInfo.getAngle()); + //停止线前方画线 + WorkThreadHandler.getInstance().postDelayed(() -> { + //二轮车和行人的渲染和移动 + V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo); + //绘制识别物与交汇点连线,并且更新连线数据 + drawStopLine(cloundWarningInfo, newLocation); + //添加停止线marker + handleStopLine(); + }, 500); - UiThreadHandler.postDelayed(() -> { - V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine(); - V2XServiceManager.getMoGoWarnPolylineManager().clearLine(); - V2XServiceManager.getMoGoStopPolylineManager().clearLine(); - isSelfLineClear = true; - }, showTime); + UiThreadHandler.postDelayed(() -> { + V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine(); + V2XServiceManager.getMoGoWarnPolylineManager().clearLine(); + V2XServiceManager.getMoGoStopPolylineManager().clearLine(); + isSelfLineClear = true; + }, showTime); - } else { //左侧或者右侧 - WorkThreadHandler.getInstance().postDelayed(() -> { - //绘制识别物与交汇点连线,并且更新连线数据 - drawOtherObjectLine(cloundWarningInfo); - //二轮车和行人的渲染和移动 - V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo); - }, 500); + } else { //左侧或者右侧 + WorkThreadHandler.getInstance().postDelayed(() -> { + //绘制识别物与交汇点连线,并且更新连线数据 + drawOtherObjectLine(cloundWarningInfo); + //二轮车和行人的渲染和移动 + V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo); + }, 500); - //延迟3秒清理线 - UiThreadHandler.postDelayed(() -> { - V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine(); - V2XServiceManager.getMoGoWarnPolylineManager().clearLine(); - isSelfLineClear = true; - }, showTime); + //延迟3秒清理线 + UiThreadHandler.postDelayed(() -> { + V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine(); + V2XServiceManager.getMoGoWarnPolylineManager().clearLine(); + isSelfLineClear = true; + }, showTime); + } } } private void handleStopLine() { - for (int i = 0; i < fillPoints.size(); i++) { - V2XWarningEntity entity = new V2XWarningEntity(); - MogoLatLng latLng = (MogoLatLng) fillPoints.get(i); - entity.setLat(latLng.lat); - entity.setLon(latLng.lon); - entity.setCollisionLat(mCloundWarningInfo.getCollisionLat()); - entity.setCollisionLon(mCloundWarningInfo.getCollisionLon()); - entity.heading = mCloundWarningInfo.heading; - V2XWarnDataDrawer.getInstance().renderStopLineData(entity); + if (mCloundWarningInfo != null) { + for (int i = 0; i < fillPoints.size(); i++) { + V2XWarningEntity entity = new V2XWarningEntity(); + MogoLatLng latLng = (MogoLatLng) fillPoints.get(i); + entity.setLat(latLng.lat); + entity.setLon(latLng.lon); + entity.setCollisionLat(mCloundWarningInfo.getCollisionLat()); + entity.setCollisionLon(mCloundWarningInfo.getCollisionLon()); + entity.heading = mCloundWarningInfo.heading; + V2XWarnDataDrawer.getInstance().renderStopLineData(entity); + } } } - /* - * 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 { - Log.e(V2XConst.LOG_NAME_WARN, "drawStopLine info == null"); V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine(); } } /** - * 绘制行人和二轮车连线,并且更新数据 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 { @@ -221,9 +193,13 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog @Override public void onCarLocationChanged2(Location latLng) { // Log.d(V2XConst.LOG_NAME_WARN, "onCarLocationChanged2 latLng = " + latLng.getLatitude() + "--" + latLng.getLongitude() + "---isSelfLineClear = " + isSelfLineClear); - //当行人经纬度交点 开始画线,否则清理 - mCloundWarningInfo.setCarLocation(new MogoLatLng(latLng.getLatitude(), latLng.getLongitude())); - drawSlefCarLine(latLng); + if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) { + //当行人经纬度交点 开始画线,否则清理 + if (mCloundWarningInfo != null) { + mCloundWarningInfo.setCarLocation(new MogoLatLng(latLng.getLatitude(), latLng.getLongitude())); + } + drawSlefCarLine(latLng); + } } @Override @@ -232,37 +208,42 @@ 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); } } else { - Log.e(V2XConst.LOG_NAME_WARN, "onCarLocationChanged2 mCloundWarningInfo == null"); V2XServiceManager.getMoGoWarnPolylineManager().clearLine(); } } @@ -297,7 +278,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/help/V2XSeekHelpButton.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XSeekHelpButton.java index ac18174fed..5c52454150 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XSeekHelpButton.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XSeekHelpButton.java @@ -82,7 +82,7 @@ public class V2XSeekHelpButton implements IV2XButton { tvCancel.setOnClickListener(v -> { doAction(); }); - ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, + ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams((int) V2XUtils.getApp().getResources().getDimension(R.dimen.dp_640), (int) V2XUtils.getApp().getResources().getDimension(R.dimen.dp_140)); V2XServiceManager.getMogoTopViewManager().addView(topView, layoutParams); } 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/layout/item_v2x_event_detail_vr.xml b/modules/mogo-module-v2x/src/main/res/layout/item_v2x_event_detail_vr.xml index 2d0db2ebb2..79f8efeac3 100644 --- a/modules/mogo-module-v2x/src/main/res/layout/item_v2x_event_detail_vr.xml +++ b/modules/mogo-module-v2x/src/main/res/layout/item_v2x_event_detail_vr.xml @@ -255,7 +255,7 @@ android:maxWidth="@dimen/dp_480" android:paddingLeft="@dimen/dp_40" android:paddingRight="@dimen/dp_40" - android:textColor="@color/v2x_white" + android:textColor="@color/v2x_white_color" android:textSize="@dimen/dp_32" /> + app:layout_constraintTop_toTopOf="parent" + tools:visibility="visible" /> + app:layout_constraintTop_toTopOf="parent" + tools:visibility="visible" /> \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/layout/item_v2x_fault_help_vr.xml b/modules/mogo-module-v2x/src/main/res/layout/item_v2x_fault_help_vr.xml index 76ddb7d31a..9a39d8fd09 100644 --- a/modules/mogo-module-v2x/src/main/res/layout/item_v2x_fault_help_vr.xml +++ b/modules/mogo-module-v2x/src/main/res/layout/item_v2x_fault_help_vr.xml @@ -51,8 +51,8 @@ android:id="@+id/tvFaultHelpName" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginStart="@dimen/dp_20" - android:layout_marginTop="@dimen/dp_15" + android:layout_marginStart="@dimen/dp_24" + android:layout_marginTop="@dimen/dp_27" android:textColor="#FFFFFF" android:textSize="@dimen/dp_40" android:textStyle="bold" @@ -66,11 +66,13 @@ android:id="@+id/tvFaultHelpEventTime" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_marginStart="@dimen/dp_24" + android:layout_marginBottom="@dimen/dp_27" android:alpha="0.59" android:textColor="#FFFFFF" android:textSize="@dimen/dp_24" - app:layout_constraintStart_toStartOf="@id/tvFaultHelpName" - app:layout_constraintTop_toBottomOf="@id/tvFaultHelpName" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toEndOf="@id/ivFaultHelpHead" tools:text="15:30发布求助信息" /> @@ -79,40 +81,39 @@ android:id="@+id/tvFaultHelpDistance" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginEnd="@dimen/dp_42" - android:layout_marginRight="@dimen/dp_42" + android:layout_marginEnd="@dimen/dp_40" + android:layout_marginRight="@dimen/dp_40" android:gravity="center_vertical" android:textColor="#FFFFFF" - android:textSize="@dimen/dp_70" + android:textSize="@dimen/dp_42" android:textStyle="bold" app:layout_constraintBottom_toBottomOf="@+id/ivFaultHelpEventCall" app:layout_constraintEnd_toStartOf="@+id/ivFaultHelpEventCall" app:layout_constraintTop_toTopOf="@+id/ivFaultHelpEventCall" - app:layout_constraintVertical_bias="0.466" tools:text="300M" /> + app:layout_constraintTop_toTopOf="parent" + tools:visibility="visible" /> \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/layout/window_carforhelp_detail.xml b/modules/mogo-module-v2x/src/main/res/layout/window_carforhelp_detail.xml index 267d6b20fe..3623d89beb 100644 --- a/modules/mogo-module-v2x/src/main/res/layout/window_carforhelp_detail.xml +++ b/modules/mogo-module-v2x/src/main/res/layout/window_carforhelp_detail.xml @@ -24,9 +24,9 @@ android:maxWidth="@dimen/dp_480" android:paddingLeft="@dimen/dp_40" android:paddingRight="@dimen/dp_40" + android:text="正在为您发起求助" android:textColor="@color/v2x_white" android:textSize="@dimen/dp_32" - android:text="正在为您发起求助" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@+id/iv_event" app:layout_constraintTop_toTopOf="parent" /> @@ -34,7 +34,7 @@ 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 diff --git a/modules/mogo-module-v2x/src/main/res/values/colors.xml b/modules/mogo-module-v2x/src/main/res/values/colors.xml index b3a90791e3..c52d9652c2 100644 --- a/modules/mogo-module-v2x/src/main/res/values/colors.xml +++ b/modules/mogo-module-v2x/src/main/res/values/colors.xml @@ -21,4 +21,7 @@ #FF3036 #F63A35 + + #D6D7D9 + #FFFFFF \ No newline at end of file