opt
This commit is contained in:
@@ -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;
|
||||
@@ -238,7 +239,7 @@ class BaseDrawer {
|
||||
/**
|
||||
* 根据速度、经纬度计算距离判断车辆颜色
|
||||
*
|
||||
* @param speed 车速
|
||||
* @param speed 车速 TODO 这里很可能是adas的策略
|
||||
* @param lon 经度
|
||||
* @param lat 纬度
|
||||
* @return 实际车辆颜色
|
||||
@@ -250,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;
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user