baseDrawer add color func and open the bicycle to shwo
This commit is contained in:
@@ -26,6 +26,7 @@ import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import static com.mogo.cloud.socket.entity.SocketDownDataHelper.FROM_ADAS;
|
||||
import static com.mogo.cloud.socket.entity.SocketDownDataHelper.FROM_MY_LOCATION;
|
||||
import static com.mogo.cloud.socket.entity.SocketDownDataHelper.FROM_ROAD_UNIT;
|
||||
import static java.lang.Math.PI;
|
||||
|
||||
@@ -156,20 +157,20 @@ class BaseDrawer {
|
||||
|| recognizedType == AdasRecognizedType.classIdPerson
|
||||
|| recognizedType == AdasRecognizedType.classIdTrafficBus
|
||||
|| recognizedType == AdasRecognizedType.classIdTrafficTruck
|
||||
|| recognizedType == AdasRecognizedType.classIdUnKnow; //todo unKnow物体绘制
|
||||
|| recognizedType == AdasRecognizedType.classIdUnKnow;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否展示车速
|
||||
* 是否展示车速,UUID以及类型
|
||||
*
|
||||
* @param type {@link AdasRecognizedType}
|
||||
* @return showSpeed
|
||||
*/
|
||||
public boolean shouldShowSpeed(int type) {
|
||||
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type);
|
||||
return recognizedType != AdasRecognizedType.classIdBicycle
|
||||
&& recognizedType != AdasRecognizedType.classIdMoto
|
||||
&& recognizedType != AdasRecognizedType.classIdPerson;
|
||||
return recognizedType != AdasRecognizedType.classIdPerson;
|
||||
// &&recognizedType != AdasRecognizedType.classIdBicycle //todo Bicycle显示
|
||||
// && recognizedType != AdasRecognizedType.classIdMoto //todo moto显示
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -182,7 +183,7 @@ class BaseDrawer {
|
||||
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type);
|
||||
if (recognizedType == AdasRecognizedType.classIdCar
|
||||
|| recognizedType == AdasRecognizedType.classIdTrafficTruck) {
|
||||
return R.raw.othercar; //todo otherCar be replacing tache for now to test,remember to fix
|
||||
return R.raw.othercar;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdTrafficBus) {
|
||||
return R.raw.bus;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdBicycle
|
||||
@@ -192,7 +193,7 @@ class BaseDrawer {
|
||||
return R.raw.stopline;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdWarningArrows) {
|
||||
return R.raw.arraw;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdUnKnow) { //todo unKnow物体3D模型
|
||||
} else if (recognizedType == AdasRecognizedType.classIdUnKnow) {
|
||||
return R.raw.tache;
|
||||
}
|
||||
return R.raw.people;
|
||||
@@ -219,9 +220,11 @@ class BaseDrawer {
|
||||
double[] coordinates = getCurCoordinates();
|
||||
double distance = CoordinateUtils.calculateLineDistance(lon, lat, coordinates[0], coordinates[1]) * 100;
|
||||
if (distance < 50) {
|
||||
return Car3DModelColor.Dangerous.color;
|
||||
return Car3DModelColor.Dangerous.color; // todo 方案1
|
||||
// return Car3DTestModelColor.getTestModelColor(fromType, Waring_Dangerous); // todo 方案2
|
||||
} else if (distance < 100 && distance >= 50) {
|
||||
return Car3DModelColor.Warming.color;
|
||||
return Car3DModelColor.Warming.color; // todo 方案1
|
||||
// return Car3DTestModelColor.getTestModelColor(fromType, Waring_Close); // todo 方案2
|
||||
}
|
||||
|
||||
// 他车车速和自车车速对比速度策略
|
||||
@@ -231,22 +234,26 @@ class BaseDrawer {
|
||||
if (curSpeed > 0 && speed > curSpeed) {
|
||||
double rate = ((speed - curSpeed) / curSpeed) * 100;
|
||||
if (rate >= 50) {
|
||||
return Car3DModelColor.Dangerous.color;
|
||||
return Car3DModelColor.Dangerous.color; // todo 方案1
|
||||
// return Car3DTestModelColor.getTestModelColor(fromType, Waring_Dangerous); // todo 方案2
|
||||
} else if (rate > 10 && rate < 50) {
|
||||
return Car3DModelColor.Warming.color;
|
||||
return Car3DModelColor.Warming.color; // todo 方案1
|
||||
// return Car3DTestModelColor.getTestModelColor(fromType, Waring_Close); // todo 方案2
|
||||
}
|
||||
}
|
||||
|
||||
// 默认颜色
|
||||
// switch (fromType) {
|
||||
// case FROM_ADAS:
|
||||
// return Car3DModelColor.Normal_Visual.color;
|
||||
// case FROM_ROAD_UNIT:
|
||||
// return Car3DModelColor.Normal_Cloud.color;
|
||||
// default:
|
||||
// return Car3DModelColor.Normal.color;
|
||||
// }
|
||||
return Car3DModelColor.Normal.color;
|
||||
// 默认颜色 // todo 方案1
|
||||
switch (fromType) {
|
||||
case FROM_ADAS:
|
||||
return Car3DModelColor.Normal_Visual.color;
|
||||
case FROM_ROAD_UNIT:
|
||||
return Car3DModelColor.Normal_Cloud.color;
|
||||
default:
|
||||
return Car3DModelColor.Normal.color;
|
||||
}
|
||||
// return Car3DModelColor.Normal.color;
|
||||
// todo 方案2
|
||||
// return Car3DTestModelColor.getTestModelColor(fromType, Waring_Normal);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -282,7 +289,7 @@ class BaseDrawer {
|
||||
/**
|
||||
* 返回当前自车SNTP时间
|
||||
*
|
||||
* @return
|
||||
* @return SNTP时间
|
||||
*/
|
||||
protected long getCurSatelliteTime() {
|
||||
String satelliteTime = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getSatelliteTime();
|
||||
@@ -302,13 +309,61 @@ class BaseDrawer {
|
||||
Normal_Cloud("#D8F8D69B"),
|
||||
|
||||
Warming("#FFD53EFF"),
|
||||
Dangerous("#FF3C45FF");
|
||||
Warming_Visual("#FFC192F1"),
|
||||
Warming_Cloud("#FFEF09AD"),
|
||||
|
||||
Dangerous("#FF3C45FF"),
|
||||
Dangerous_Visual("#FF91B7F1"),
|
||||
Dangerous_Cloud("#FF260FEC");
|
||||
|
||||
private int fromType;
|
||||
private final String color;
|
||||
|
||||
Car3DModelColor(String color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static final int Waring_Normal = 0;
|
||||
public static final int Waring_Close = 1;
|
||||
public static final int Waring_Dangerous = 2;
|
||||
|
||||
/**
|
||||
* 模型颜色
|
||||
*/
|
||||
public enum Car3DTestModelColor {
|
||||
|
||||
Normal_Type(FROM_MY_LOCATION, Waring_Normal, "#D8D8D8FF"),
|
||||
Normal_Type_Visual(FROM_ADAS, Waring_Normal, "#D8CFF8BD"),
|
||||
Normal_Type_Cloud(FROM_ROAD_UNIT, Waring_Normal, "#D8F8D69B"),
|
||||
|
||||
Warming_Type(FROM_MY_LOCATION, Waring_Close, "#FFD53EFF"),
|
||||
Warming_Type_Visual(FROM_ADAS, Waring_Close, "#FFC192F1"),
|
||||
Warming_Type_Cloud(FROM_ROAD_UNIT, Waring_Close, "#FFEF09AD"),
|
||||
|
||||
Dangerous_Type(FROM_MY_LOCATION, Waring_Dangerous, "#FF3C45FF"),
|
||||
Dangerous_Type_Visual(FROM_ADAS, Waring_Dangerous, "#FF91B7F1"),
|
||||
Dangerous_Type_Cloud(FROM_ROAD_UNIT, Waring_Dangerous, "#FF260FEC");
|
||||
|
||||
private final int fromType;
|
||||
private final int waringType;
|
||||
private final String color;
|
||||
|
||||
Car3DTestModelColor(int fromType, int waringType, String color) {
|
||||
this.fromType = fromType;
|
||||
this.waringType = waringType;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public static String getTestModelColor(int fromType, int waringType) {
|
||||
for (Car3DTestModelColor value : Car3DTestModelColor.values()) {
|
||||
if (value.fromType == fromType && value.waringType == waringType) {
|
||||
return value.color;
|
||||
}
|
||||
}
|
||||
return Normal_Type.color;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -364,8 +419,8 @@ class BaseDrawer {
|
||||
/**
|
||||
* 缓存绘制 marker 的 id 和 marker 资源缓存的 md5 的关系
|
||||
*
|
||||
* @param id
|
||||
* @param marker
|
||||
* @param id 缓存资源ID
|
||||
* @param marker {@link IMogoMarker}
|
||||
*/
|
||||
protected static void cacheMarkerIconResMd5Val(String id, IMogoMarker marker) {
|
||||
if (marker == null || marker.isDestroyed()) {
|
||||
@@ -381,11 +436,11 @@ class BaseDrawer {
|
||||
/**
|
||||
* 道路匹配到车道中心点
|
||||
*
|
||||
* @param lon
|
||||
* @param lat
|
||||
* @param angle
|
||||
* @param isRtk
|
||||
* @return
|
||||
* @param lon 经度
|
||||
* @param lat 纬度
|
||||
* @param angle 方向角
|
||||
* @param isRtk 是否是RTK
|
||||
* @return 匹配经纬度值
|
||||
*/
|
||||
public double[] matchRoad(String id, double lon, double lat, double angle, boolean isRtk) {
|
||||
final long start = System.currentTimeMillis();
|
||||
@@ -401,20 +456,20 @@ class BaseDrawer {
|
||||
/**
|
||||
* 清理缓存路段数据
|
||||
*
|
||||
* @param id
|
||||
* @param id 缓存数据Key
|
||||
*/
|
||||
public static void clearRoadCacheById(String id) {
|
||||
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().clearRoadCacheById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用系统时间或卫星时间计算出动画的运动时间
|
||||
* 使用系统时间或卫星时间计算出动画的运动时间,最小值45,防止两个点距离过近设置的最小动画执行时间
|
||||
*
|
||||
* @param lastSystemTime
|
||||
* @param curSystemTime
|
||||
* @param lastSatelliteTime
|
||||
* @param curSatelliteTime
|
||||
* @return
|
||||
* @param lastSystemTime 上一个点系统时间,误差值
|
||||
* @param curSystemTime 当前点系统时间,误差值
|
||||
* @param lastSatelliteTime 上一个点SNTP时间,精确值
|
||||
* @param curSatelliteTime 当前点SNTP时间,精确值
|
||||
* @return 动画运动时间
|
||||
*/
|
||||
public long computeAnimDuration(long lastSystemTime, long curSystemTime, long lastSatelliteTime, long curSatelliteTime) {
|
||||
long systemTimeInterval = curSystemTime - lastSystemTime;
|
||||
@@ -429,13 +484,13 @@ class BaseDrawer {
|
||||
/**
|
||||
* 根据位置信息、车头朝向计算道路吸附
|
||||
*
|
||||
* @param id
|
||||
* @param lon
|
||||
* @param lat
|
||||
* @param heading
|
||||
* @param lastLon
|
||||
* @param lastLat
|
||||
* @return
|
||||
* @param id UUID
|
||||
* @param lon 经度
|
||||
* @param lat 纬度
|
||||
* @param heading 方向角
|
||||
* @param lastLon 上一个点经度
|
||||
* @param lastLat 上一个点纬度
|
||||
* @return 匹配经纬度
|
||||
*/
|
||||
protected double[] getMatchLonLat(String id, double lon, double lat, double heading, double lastLon, double lastLat) {
|
||||
double[] matchedPoint = matchRoad(id, lon,
|
||||
@@ -444,7 +499,7 @@ class BaseDrawer {
|
||||
true
|
||||
);
|
||||
|
||||
boolean match = false;
|
||||
boolean match;
|
||||
if (matchedPoint != null) {
|
||||
// Logger.d( TAG, "matchPoint %s distance = %s",lineCounter, matchedPoint[2] );
|
||||
match = matchedPoint[2] < 1 && matchedPoint[2] > 0;
|
||||
|
||||
Reference in New Issue
Block a user