Merge remote-tracking branch 'origin/dev2_aiSdk' into dev2_aiSdk

This commit is contained in:
董宏宇
2021-04-13 17:31:06 +08:00
17 changed files with 315 additions and 212 deletions

View File

@@ -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

View File

@@ -2,11 +2,11 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:endColor="#3B3F6D"
android:startColor="#3B3F6D" />
<!-- <stroke-->
<!-- android:width="1dp"-->
<!-- android:color="#182155" />-->
android:endColor="#3B4577"
android:startColor="#3B4577" />
<!-- <stroke-->
<!-- android:width="1dp"-->
<!-- android:color="#182155" />-->
<corners
android:bottomLeftRadius="@dimen/dp_100"
android:bottomRightRadius="@dimen/dp_20"

View File

@@ -2,13 +2,13 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:endColor="#3B3F6D"
android:endColor="#3B4577"
android:gradientRadius="50%p"
android:startColor="#93354E"
android:type="radial" />
<!-- <stroke-->
<!-- android:width="1dp"-->
<!-- android:color="#182155" />-->
<!-- <stroke-->
<!-- android:width="1dp"-->
<!-- android:color="#182155" />-->
<corners
android:bottomLeftRadius="@dimen/dp_100"
android:bottomRightRadius="@dimen/dp_20"

View File

@@ -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<MarkerExploreWay>) roadInfoList, currentLat, currentLon);
addMarkersAction(convertMarkerExploreWayList((List<MarkerExploreWayCloud>) 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<MarkerExploreWay> convertMarkerExploreWayList(List<MarkerExploreWayCloud> list) {
List<MarkerExploreWay> 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<MarkerExploreWayItem> 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);

View File

@@ -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<MarkerExploreWay>)
fun onQueryRoadInfoSuccess(roadInfoList:List<MarkerExploreWayCloud>)
fun onQueryRoadInfoFail(msg: String, code: Int)
}

View File

@@ -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<MogoLatLng> locations;
private double heading;
private float width;
@@ -70,4 +76,12 @@ public class DrawLineInfo {
public void setDirection(int direction) {
this.direction = direction;
}
public List<MogoLatLng> getLocations() {
return locations;
}
public void setLocations(List<MogoLatLng> locations) {
this.locations = locations;
}
}

View File

@@ -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<Integer> 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<MogoLatLng> 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);

View File

@@ -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<Integer> 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<MogoLatLng> 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);

View File

@@ -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;
}

View File

@@ -43,11 +43,13 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager {
List<Integer> 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<MogoLatLng> 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);

View File

@@ -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);
}

View File

@@ -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);
}
}

View File

@@ -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" />
<ImageView
@@ -273,12 +273,13 @@
android:id="@+id/tv_line"
android:layout_width="@dimen/dp_0_5"
android:layout_height="@dimen/dp_70"
android:background="@color/v2x_white"
android:background="@color/v2x_line_color"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/tv_play"
app:layout_constraintStart_toEndOf="@+id/ll_event"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible" />
<TextView
android:id="@+id/tv_play"
@@ -293,6 +294,7 @@
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>

View File

@@ -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发布求助信息" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -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" />
<ImageView
android:id="@+id/ivFaultHelpEventCall"
android:layout_width="@dimen/module_v2x_event_button_size_vr"
android:layout_height="@dimen/module_v2x_event_button_size_vr"
android:layout_marginLeft="@dimen/dp_40"
android:layout_marginEnd="28dp"
android:layout_width="@dimen/dp_80"
android:layout_height="@dimen/dp_80"
android:layout_marginRight="@dimen/dp_40"
android:src="@drawable/selector_talk_btn"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/ivFaultHelpEventNavi"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.385"
tools:visibility="visible" />
<ImageView
android:id="@+id/ivFaultHelpEventNavi"
android:layout_width="0px"
android:layout_height="@dimen/module_v2x_event_button_size_vr"
android:layout_width="@dimen/dp_80"
android:layout_height="@dimen/dp_80"
android:layout_marginRight="@dimen/dp_40"
android:src="@drawable/selector_nav_btn"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -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 @@
<TextView
android:layout_width="@dimen/dp_0_5"
android:layout_height="@dimen/dp_70"
android:background="@color/v2x_white"
android:background="@color/v2x_line_color"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/tv_cancel"
app:layout_constraintTop_toTopOf="parent" />

View File

@@ -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

View File

@@ -21,4 +21,7 @@
<color name="v2x_FF3036">#FF3036</color>
<color name="v2x_car_for_help_cancel">#F63A35</color>
<color name="v2x_line_color">#D6D7D9</color>
<color name="v2x_white_color">#FFFFFF</color>
</resources>