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

This commit is contained in:
董宏宇
2021-04-15 10:03:28 +08:00
20 changed files with 180 additions and 112 deletions

View File

@@ -67,7 +67,7 @@ dependencies {
implementation project(':foudations:mogo-commons')
}
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-8.5.5'
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-8.5.6'
// implementation 'com.zhidaoauto.machine:map:1.0.0-vr-test-3.4'
}

View File

@@ -10,6 +10,7 @@ import android.util.Log;
import android.view.ViewGroup;
import android.widget.TextView;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.module.common.MogoApisHandler;
@@ -59,7 +60,6 @@ class BaseDrawer {
// 移除过期的 marker
public static final int MSG_REMOVE_DIRTY_MARKERS = 9990;
public static final int MSG_REMOVE_ADAS_MARKERS = 9992;
/**
* 显示速度
@@ -239,7 +239,7 @@ class BaseDrawer {
/**
* 根据速度、经纬度计算距离判断车辆颜色
*
* @param speed 车速
* @param speed 车速 TODO 这里很可能是adas的策略
* @param lon 经度
* @param lat 纬度
* @return 实际车辆颜色
@@ -251,26 +251,26 @@ class BaseDrawer {
return "#D8D8D8FF";
}
// 距离策略
// double coordinates[] = getCurCoordinates();
// double distance = CoordinateUtils.calculateLineDistance( lon, lat, coordinates[0], coordinates[1] ) * 100;
// if ( distance < 50 ) {
// return Car3DModelColor.Dangerous.color;
// } else if ( distance < 100 && distance >= 50 ) {
// return Car3DModelColor.Warming.color;
// }
double coordinates[] = getCurCoordinates();
double distance = CoordinateUtils.calculateLineDistance( lon, lat, coordinates[0], coordinates[1] ) * 100;
if ( distance < 50 ) {
return Car3DModelColor.Dangerous.color;
} else if ( distance < 100 && distance >= 50 ) {
return Car3DModelColor.Warming.color;
}
// 他车车速和自车车速对比速度策略
// 自车速度 >= 50% 危险
// 10% < 自车速度 < 50% 警告
// double curSpeed = getCurSpeed();
// if ( curSpeed > 0 && speed > curSpeed ) {
// double rate = ( ( speed - curSpeed ) / curSpeed ) * 100;
// if ( rate >= 50 ) {
// return Car3DModelColor.Dangerous.color;
// } else if ( rate > 10 && rate < 50 ) {
// return Car3DModelColor.Warming.color;
// }
// }
// 他车车速和自车车速对比速度策略
// 自车速度 >= 50% 危险
// 10% < 自车速度 < 50% 警告
double curSpeed = getCurSpeed();
if ( curSpeed > 0 && speed > curSpeed ) {
double rate = ( ( speed - curSpeed ) / curSpeed ) * 100;
if ( rate >= 50 ) {
return Car3DModelColor.Dangerous.color;
} else if ( rate > 10 && rate < 50 ) {
return Car3DModelColor.Warming.color;
}
}
// 默认颜色
return Car3DModelColor.Normal.color;

View File

@@ -58,6 +58,10 @@ class OnlineCarDrawer {
return sInstance;
}
public void clearMarkers(){
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( AbsMogoApplication.getApp() ).removeMarkers( ModuleNames.CARD_TYPE_USER_DATA );
}
/**
* 绘制在线车辆marker
*
@@ -72,12 +76,12 @@ class OnlineCarDrawer {
IMogoMarkerClickListener listener ) {
// 将数据同步给在线车辆,避免每次 perform 的时候去拉取,造成消耗
if ( onlineCarList == null || onlineCarList.isEmpty() ) {
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( AbsMogoApplication.getApp() ).removeMarkers( ModuleNames.CARD_TYPE_USER_DATA );
clearMarkers();
return;
}
if ( clearOld ) {
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( AbsMogoApplication.getApp() ).removeMarkers( ModuleNames.CARD_TYPE_USER_DATA );
clearMarkers();
}
int size = MarkerDrawer.getInstance().getAppropriateSize( maxAmount, onlineCarList );
@@ -191,4 +195,6 @@ class OnlineCarDrawer {
}
return false;
}
}

View File

@@ -77,16 +77,22 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
private boolean mIsVrMode = false;
/**
* 注册StatusDescriptor.VR_MODE类型VR_MODE状态改变回调
* @param descriptor 状态类型
* @param isTrue true - accOn、adas ui show、voice ui show、push ui show、v2x ui show
*/
@Override
public void onStatusChanged( StatusDescriptor descriptor, boolean isTrue ) {
Logger.d( TAG, "%s - %s", descriptor, isTrue );
mChangeCarModeStatus = true;
sendMessage( MSG_REMOVE_ADAS_MARKERS, mMarkersCaches );
sendMessage( MSG_REMOVE_DIRTY_MARKERS, mMarkersCaches );
mMarkersCaches = new HashMap<>();
if ( mLastPositions != null ) {
mLastPositions.clear();
}
AdasRecognizedResultDrawer.getInstance().notifyVrModeChanged();
AdasRecognizedResultDrawer.getInstance().notifyVrModeChanged(); //清除ADAS old marker data
OnlineCarDrawer.getInstance().clearMarkers(); //清除在线车辆 old marker data
}
public boolean isVrMode() {

View File

@@ -16,6 +16,7 @@ import com.mogo.module.common.drawer.marker.SimpleWindow3DAdapter;
import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.MarkerShowEntity;
import com.mogo.module.common.entity.V2XWarningEntity;
import com.mogo.module.common.utils.Trigonometric;
import com.mogo.module.common.view.MarkerBaseFloor;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.StatusDescriptor;
@@ -86,6 +87,11 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
markerShowEntity.setMarkerType(TYPE_MARKER_CLOUD_WARN_DATA);
IMogoMarker bottomMarker = drawMarkerWith2Resource(markerShowEntity);
//2D资源图片位置调整
MogoLatLng mogoLatLng = new MogoLatLng(data.getCollisionLat(), data.getCollisionLon());
MogoLatLng newLocation = Trigonometric.getNewLocation(mogoLatLng, 8, 180);
IMogoMarker marker = drawMarker(markerShowEntity);
Log.d("liyz", "renderWarnData marker != null direction = " + data.getDirection());
//识别物
@@ -94,8 +100,8 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
data.getDirection() == 1 ? data.getStopLines().get(1).lon : data.getCollisionLon()), (float) data.getHeading(), 5000);
//识别物下方的红色圆圈
bottomMarker.addDynamicAnchorPosition(new MogoLatLng(
data.getDirection() == 1 ? data.getStopLines().get(1).lat : data.getCollisionLat(),
data.getDirection() == 1 ? data.getStopLines().get(1).lon : data.getCollisionLon()), (float) data.getHeading(), 5000);
data.getDirection() == 1 ? data.getStopLines().get(1).lat : newLocation.getLat(),
data.getDirection() == 1 ? data.getStopLines().get(1).lon : newLocation.getLon()), (float) data.getHeading(), 5000);
//移动完成以后3s后消失
UiThreadHandler.postDelayed(() -> {
marker.remove();
@@ -121,16 +127,30 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
return marker;
}
public void drawerMarkerWithLocation(MarkerShowEntity markerShowEntity, MogoLatLng location){
MogoMarkerOptions options = new MogoMarkerOptions()
.object(markerShowEntity)
.latitude(location.getLat())
.longitude(location.getLon());
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
options.icon3DRes(getModelRes(2)); //TODO
options.anchorColor("#FB3C3CFF"); //红色#FF3036 蓝色:#256BFF
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerShowEntity.getMarkerType(), options);
iMarkerView.setMarker(marker);
marker.setToTop();
}
/*
* 2D资源绘制marker
* 2D资源绘制marker底部的红色圆圈
* */
private IMogoMarker drawMarkerWith2Resource(MarkerShowEntity markerShowEntity) {
MogoLatLng mogoLatLng = new MogoLatLng(markerShowEntity.getMarkerLocation().getLat(), markerShowEntity.getMarkerLocation().getLon());
MogoLatLng newLocation = Trigonometric.getNewLocation(mogoLatLng, 8, 180);
MogoMarkerOptions optionsRipple = new MogoMarkerOptions()
.latitude(markerShowEntity.getMarkerLocation().getLat())
.longitude(markerShowEntity.getMarkerLocation().getLon())
.latitude(newLocation.getLat())
.longitude(newLocation.getLon())
.anchor(1.0f, 1.0f)
.zIndex(MarkerDrawer.MARKER_Z_INDEX_HIGH);
optionsRipple
.icon(ViewUtils.fromView(new EmptyMarkerView(mContext)));
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerShowEntity.getMarkerType(), optionsRipple);

View File

@@ -0,0 +1,53 @@
package com.mogo.module.common.utils;
import com.mogo.map.MogoLatLng;
/**
* @author liujing
* @description 描述
* @since: 2021/4/13
*/
public class Trigonometric {
private final static double radius_b = 6378137;//大半径
private final static double radius_s = 6356725;//小半径
private static double mRadLo;
private static double mRadLa;
private static double Ec;
private static double Ed;
/**
* 计算两点间的角度
*/
public static double getAngle(double lon1, double lat1, double lon2,
double lat2) {
double fLat = Math.PI * (lat1) / 180.0;
double fLng = Math.PI * (lon1) / 180.0;
double tLat = Math.PI * (lat2) / 180.0;
double tLng = Math.PI * (lon2) / 180.0;
double degree = (Math.atan2(Math.sin(tLng - fLng) * Math.cos(tLat), Math.cos(fLat) * Math.sin(tLat) -
Math.sin(fLat) * Math.cos(tLat) * Math.cos(tLng - fLng))) * 180.0 / Math.PI;
if (degree >= 0) {
return degree;
} else {
return 360 + degree;
}
}
/**
* 根据角度获取指定距离点的经纬度
*/
public static MogoLatLng getNewLocation(MogoLatLng st, double distance, double angle) {
mRadLo = st.getLon() * Math.PI / 180.;
mRadLa = st.getLat() * Math.PI / 180.;
Ec = radius_s + (radius_b - radius_s) * (90. - st.lat) / 90;
Ed = Ec * Math.cos(mRadLa);
double dx = distance * Math.sin(Math.toRadians(angle));
double dy = distance * Math.cos(Math.toRadians(angle));
double lon_new = (dx / Ed + mRadLo) * 180. / Math.PI;
double lat_new = (dy / Ec + mRadLa) * 180. / Math.PI;
return new MogoLatLng(lat_new, lon_new);
}
}

View File

@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:layout_marginTop="@dimen/dp_100"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/common_marker_bottom_floor"/>
android:src="@drawable/common_marker_bottom_floor" />
</LinearLayout>

View File

@@ -8,6 +8,7 @@ import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.view.View;
@@ -69,10 +70,12 @@ public class ArcView extends View {
private void drawText(Canvas canvas) {
Rect mRect = new Rect();
String mValue = String.valueOf(currentValue);
mTextPaint.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
//绘制中心的数值
mTextPaint.getTextBounds(mValue, 0, mValue.length(), mRect);
canvas.drawText(mValue, getWidth() / 2, getHeight() / 2 + mRect.height() / 2, mTextPaint);
canvas.drawText(mValue, getWidth() / 2, getHeight() / 2 + mRect.height() / 2-10, mTextPaint);
mTextPaint.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
//绘制中心文字描述
mTextPaint.setTextSize(28);
mTextPaint.getTextBounds(mDes, 0, mDes.length(), mRect);

View File

@@ -100,20 +100,19 @@ public class V2XWaringManager {
if (v2XWarnMessageListener != null) {
V2XServiceManager
.getMoGoSocketManager()
.unregisterOnMessageListener(401011, v2XWarnMessageListener);
.unregisterOnMessageListener(10116, v2XWarnMessageListener);
}
}
/**
* 道路事件,行人 TODO type
* 道路预警 弱势群体事件,行人 TODO type
*/
private void registerWarnListener() {
v2XWarnMessageListener = new V2XWarnMessageListener();
// 道路事件,在线车辆绘制
V2XServiceManager
.getMoGoSocketManager()
.registerOnMessageListener(
401011,
10116,
v2XWarnMessageListener );
}

View File

@@ -199,18 +199,18 @@ public class V2XOtherSeekHelpVH extends V2XBaseViewHolder<V2XEventShowEntity> {
if (mV2XPushMessageEntity.getDistance() > 1000) {
SpanUtils.with(tvDistance)
.append("" + (int) mV2XPushMessageEntity.getDistance() / 1000)
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_text))
.setFontSize((int) itemView.getResources().getDimension(V2XServiceManager.getMoGoStatusManager().isVrMode() ? R.dimen.dp_42 : R.dimen.module_v2x_event_distance_text))
.append("公里")
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_title))
.setFontSize((int) itemView.getResources().getDimension(V2XServiceManager.getMoGoStatusManager().isVrMode() ? R.dimen.dp_42 : R.dimen.module_v2x_event_distance_title))
.create();
} else {
SpanUtils.with(tvDistance)
.append("" + (int) mV2XPushMessageEntity.getDistance())
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_text))
.setFontSize((int) itemView.getResources().getDimension(V2XServiceManager.getMoGoStatusManager().isVrMode() ? R.dimen.dp_42 : R.dimen.module_v2x_event_distance_text))
.append("")
.setFontSize((int) itemView.getResources().getDimension(
V2XServiceManager.getMoGoStatusManager().isVrMode() ?
R.dimen.module_v2x_event_distance_title_vr : R.dimen.module_v2x_event_distance_title))
R.dimen.dp_42 : R.dimen.module_v2x_event_distance_title))
.create();
}
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm", Locale.CHINA);

View File

@@ -20,12 +20,13 @@ public class V2XWarnMessageListener implements IMogoOnMessageListener<V2XWarning
@Override
public void onMsgReceived(V2XWarningEntity info) {
Log.d(V2XConst.LOG_NAME_WARN, "V2XWarnMessageListener onMsgReceived ---11---> ");
//Logger.d(MODULE_NAME, "V2XMessageListener_401011==V2X地图气泡数据刷新\n" + GsonUtil.jsonFromObject(response));
V2XUtils.runOnBackgroundThread(() -> {
// 解析不同的Marker类型然后对应的进行绘制
if (info != null) {
// 解析存储道路事件 liyz
Log.d(V2XConst.LOG_NAME_WARN, "V2XWarnMessageListener onMsgReceived ----> ");
Log.d(V2XConst.LOG_NAME_WARN, "V2XWarnMessageListener onMsgReceived --22--> ");
V2XServiceManager.getMoGoV2XCloundDataManager().analysisV2XCloundDataEvent(info);
}
});

View File

@@ -11,7 +11,9 @@ import com.mogo.map.navi.IMogoCarLocationChangedListener2;
import com.mogo.map.overlay.IMogoPolyline;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.drawer.V2XWarnDataDrawer;
import com.mogo.module.common.entity.MarkerShowEntity;
import com.mogo.module.common.entity.V2XWarningEntity;
import com.mogo.module.common.utils.Trigonometric;
import com.mogo.module.service.MarkerServiceHandler;
import com.mogo.module.service.receiver.MogoReceiver;
import com.mogo.module.v2x.MoGoV2XServicePaths;
@@ -19,7 +21,6 @@ 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.utils.LocationUtils;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.WorkThreadHandler;
@@ -39,7 +40,10 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
private boolean isSelfLineClear;
private List fillPoints = new ArrayList();//停止线经纬度合集
private boolean isFirstLocation = false;
private MogoLatLng carLocation;
private MogoLatLng carLocation = new MogoLatLng(
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat(),
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon()
);
private static long showTime = 0;
@@ -63,7 +67,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
isFirstLocation = false;
if (cloundWarningInfo.getDirection() == 1) { //前方
MogoLatLng newLocation = LocationUtils.getNewLocation((MogoLatLng) fillPoints.get(0), 80, cloundWarningInfo.getAngle());
MogoLatLng newLocation = Trigonometric.getNewLocation((MogoLatLng) fillPoints.get(0), 80, cloundWarningInfo.getAngle());
//停止线前方画线
WorkThreadHandler.getInstance().postDelayed(() -> {
//二轮车和行人的渲染和移动
@@ -116,7 +120,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
}
/**
* 绘制红色区域(停止线继续前行的预警区域) TODO 需要实时给行人当前位置
* 车辆行驶正前方绘制红色区域(停止线继续前行的预警区域) TODO 需要实时给行人当前位置
*/
private void drawStopLine(V2XWarningEntity info, MogoLatLng mogoLatLng) {
if (info != null) {
@@ -126,7 +130,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
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());
MogoLatLng addMiddleLoc = Trigonometric.getNewLocation(startLatlng, distance / 2, mCloundWarningInfo.getAngle());
if (polyLine != null) {
Log.d(V2XConst.LOG_NAME_WARN, "drawStopLine polyLine != null");
polyLine.setPoints(Arrays.asList(startLatlng, addMiddleLoc, endLatlng));
@@ -150,7 +154,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
/**
* 目标物与预碰撞点连线,并且更新数据 TODO 需要实时给行人当前位置
* 侧方目标物与预碰撞点连线,并且更新数据 TODO 需要实时给行人当前位置
*/
private void drawOtherObjectLine(V2XWarningEntity info) {
if (info != null) {
@@ -158,7 +162,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
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());
MogoLatLng addMiddleLoc = Trigonometric.getNewLocation(startLatlng, distance / 2, mCloundWarningInfo.getAngle());
if (polyLine != null) {
Log.d(V2XConst.LOG_NAME_WARN, "polyLine != null");
polyLine.setPoints(Arrays.asList(startLatlng, addMiddleLoc, endLatlng));
@@ -182,6 +186,21 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
}
}
//侧面目标物与碰撞点之间添加多个小箭头
private void addArrows(MogoLatLng startLatLng, MogoLatLng endLatLng) {
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
float distance = CoordinateUtils.calculateLineDistance(
startLatLng.lon, startLatLng.lat, endLatLng.lon, endLatLng.lat);
if (distance > 5) {
int count = (int) (distance / 5);
for (int i = 0; i < count; i++) {
MogoLatLng newLo = Trigonometric.getNewLocation(
startLatLng, 5 * i, mCloundWarningInfo.getAngle());
V2XWarnDataDrawer.getInstance().drawerMarkerWithLocation(markerShowEntity, newLo);
}
}
}
@Override
public void clearALLPOI() {
@@ -225,7 +244,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
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());
addMiddleLoc = Trigonometric.getNewLocation(startLatlng, distance / 2, mCloundWarningInfo.getAngle());
Log.d(V2XConst.LOG_NAME_WARN, "drawSlefCarLine lon = " + carLocation.lon + "---lat = " + carLocation.lat);
isFirstLocation = true;
}
@@ -265,11 +284,11 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
float distance = CoordinateUtils.calculateLineDistance(x.lon, x.lat, y.lon, y.lat);
float average = distance / 3;
//两点间的角度
double angle = LocationUtils.getAngle(x.lon, x.lat, y.lon, y.lat);
double angle = Trigonometric.getAngle(x.lon, x.lat, y.lon, y.lat);
//根据距离和角度获取下个点的经纬度
fillPoints.add(x);
for (int i = 1; i < 3; i++) {
MogoLatLng newLocation = LocationUtils.getNewLocation(x, average * i, angle);
MogoLatLng newLocation = Trigonometric.getNewLocation(x, average * i, angle);
fillPoints.add(newLocation);
}
fillPoints.add(y);
@@ -280,7 +299,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
}
private MogoLatLng getMogoLat(MogoLatLng latlng) {
MogoLatLng newLocation = LocationUtils.getNewLocation(latlng, mCloundWarningInfo.getStopLineDistance(), mCloundWarningInfo.getDirection());
MogoLatLng newLocation = Trigonometric.getNewLocation(latlng, mCloundWarningInfo.getStopLineDistance(), mCloundWarningInfo.getDirection());
return newLocation;
}

View File

@@ -16,6 +16,7 @@ import com.mogo.module.common.drawer.marker.SimpleWindow3DAdapter;
import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.MarkerShowEntity;
import com.mogo.module.common.entity.V2XWarningEntity;
import com.mogo.module.common.utils.Trigonometric;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
@@ -99,7 +100,7 @@ public class V2XWarningMarker implements IV2XMarker {
carlo = new MogoLatLng(lat, lon);
}
//自车行驶方向的前方*米的经纬度,该经纬度在停止线上
MogoLatLng drawStopLineLon = LocationUtils.getNewLocation(carlo, mMarkerEntity.getStopLineDistance(), mMarkerEntity.getAngle());
MogoLatLng drawStopLineLon = Trigonometric.getNewLocation(carlo, mMarkerEntity.getStopLineDistance(), mMarkerEntity.getAngle());
Log.d(TAG, "2D资源绘" + drawStopLineLon);
MogoMarkerOptions optionsRipple = new MogoMarkerOptions()
.latitude(drawStopLineLon.getLat())

View File

@@ -27,12 +27,6 @@ import com.mogo.utils.network.utils.GsonUtil;
*/
public class LocationUtils {
private static final String TAG = "LocationUtils";
private final static double radius_b = 6378137;//大半径
private final static double radius_s = 6356725;//小半径
private static double mRadLo;
private static double mRadLa;
private static double Ec;
private static double Ed;
public static void geoCodeSearch(MogoLocation location, IMogoGeoSearchListener listener) {
MogoRegeocodeQuery mogoRegeocodeQuery = new MogoRegeocodeQuery();
@@ -93,42 +87,6 @@ public class LocationUtils {
return latLon;
}
/**
* 计算两点间的角度
*/
public static double getAngle(double lon1, double lat1, double lon2,
double lat2) {
double fLat = Math.PI * (lat1) / 180.0;
double fLng = Math.PI * (lon1) / 180.0;
double tLat = Math.PI * (lat2) / 180.0;
double tLng = Math.PI * (lon2) / 180.0;
double degree = (Math.atan2(Math.sin(tLng - fLng) * Math.cos(tLat), Math.cos(fLat) * Math.sin(tLat) -
Math.sin(fLat) * Math.cos(tLat) * Math.cos(tLng - fLng))) * 180.0 / Math.PI;
if (degree >= 0) {
return degree;
} else {
return 360 + degree;
}
}
/**
* 根据角度获取指定距离点的经纬度
*/
public static MogoLatLng getNewLocation(MogoLatLng st, double distance, double angle) {
mRadLo = st.getLon() * Math.PI / 180.;
mRadLa = st.getLat() * Math.PI / 180.;
Ec = radius_s + (radius_b - radius_s) * (90. - st.lat) / 90;
Ed = Ec * Math.cos(mRadLa);
double dx = distance * Math.sin(Math.toRadians(angle));
double dy = distance * Math.cos(Math.toRadians(angle));
double lon_new = (dx / Ed + mRadLo) * 180. / Math.PI;
double lat_new = (dy / Ec + mRadLa) * 180. / Math.PI;
return new MogoLatLng(lat_new, lon_new);
}
/**
* 获取传入的经纬度在车辆的什么位置
*

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#88000000" />
<solid android:color="#dd000000" />
<corners android:radius="@dimen/dp_20" />
</shape>

View File

@@ -2,8 +2,8 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="180"
android:endColor="#C57406"
android:startColor="#FCB932" />
android:endColor="#FFBF29"
android:startColor="#FFBF29" />
<corners android:bottomLeftRadius="@dimen/dp_20" android:topRightRadius="@dimen/dp_20"/>
</shape>

View File

@@ -35,13 +35,11 @@
android:layout_marginTop="15dp"
android:background="@drawable/bg_v2x_event_type_orange_vr"
android:gravity="center"
android:paddingTop="@dimen/dp_2"
android:paddingBottom="@dimen/dp_5"
android:text="求助"
android:textColor="@android:color/white"
android:textSize="@dimen/module_v2x_event_type_title_text_size"
android:textSize="@dimen/sp_20"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@id/ivFaultHelpHead"
@@ -81,12 +79,11 @@
android:id="@+id/tvFaultHelpDistance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_40"
android:layout_marginRight="@dimen/dp_40"
android:layout_marginEnd="@dimen/dp_42"
android:layout_marginRight="@dimen/dp_42"
android:gravity="center_vertical"
android:textColor="#FFFFFF"
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"
@@ -97,7 +94,7 @@
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:src="@drawable/v2x_event_icon_tel_vr"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/ivFaultHelpEventNavi"
@@ -109,8 +106,7 @@
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"
android:src="@drawable/v2x_event_icon_daohang_vr"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"

View File

@@ -138,10 +138,16 @@ public class MogoADASController implements IMogoADASController {
super.handleMessage( msg );
final long start = System.currentTimeMillis();
ADASCarStateInfo stateInfo = GsonUtil.objectFromJson( ( ( String ) msg.obj ), ADASCarStateInfo.class );
Logger.d( "ADAS-LOC-timer", "upd 到 aidl 传输耗时:%s", start - Long.valueOf( stateInfo.getValues().getStartReceiverDataTime() ) );
if ( stateInfo == null || stateInfo.getValues() == null ) {
Logger.d(TAG,"ADAS-LOC-timer","upd 到 aidl 传输数据 stateInfo or stateInfo.getValues() is null");
return;
}
if(stateInfo.getValues().getStartReceiverDataTime() != null){
Logger.d( "ADAS-LOC-timer", "upd 到 aidl 传输耗时:%s", start - Long.valueOf( stateInfo.getValues().getStartReceiverDataTime() ) );
}else{
Logger.d( "ADAS-LOC-timer", "upd 到 aidl 传输耗时时间字段 startReceiverDataTime is null");
}
mLastLon = stateInfo.getValues().getLon();
mLastLat = stateInfo.getValues().getLat();
if ( mMogoAdasCarDataCallback != null ) {