fix bug of delay time problem and invisible marker when change visual problem

This commit is contained in:
zhongchao
2021-07-10 14:13:12 +08:00
parent c84646906b
commit 822e536c2b
10 changed files with 44 additions and 61 deletions

View File

@@ -181,7 +181,7 @@ MOGO_AICLOUD_SERVICES_APK_VERSION=1.0.0-SNAPSHOT
# mogoAiCloud sdk services
MOGO_AICLOUD_SERVICES_SDK_VERSION=1.0.0-SNAPSHOT
# 自研地图
MAP_SDK_VERSION=1.0.0-vr-8.5.66
MAP_SDK_VERSION=1.0.0-vr-8.5.67
## 产品库必备配置产品库自动对versionCode和versionName版本进行升级

View File

@@ -56,6 +56,12 @@ public interface IMogoMarkerManager {
*/
void inVisibleAllMarkers();
/**
* 隐藏除了某些类别的所有marker {@link MogoMarkerOptions Owner}
* @param owner
*/
void inVisibleWithoutMarkers(String owner); //todo 后续需要把Owner类别统一起来基类下沉此接口为临时方案应该设计为隐藏某一类元素
/**
* 获取某种类型的全部marker。
*

View File

@@ -61,6 +61,17 @@ public class MogoMarkersHandler implements IMogoMarkerClickListener, IMogoMarker
.forEach(mogoMarkerList -> mogoMarkerList.forEach(mogoMarker -> mogoMarker.setVisible(false)));
}
@SuppressLint("NewApi")
public synchronized void inVisibleMarkers(String owner){
mServicesMarkers.values().stream()
.filter(mogoMarkerList -> mogoMarkerList != null && !mogoMarkerList.isEmpty())
.forEach(mogoMarkerList -> mogoMarkerList.forEach(mogoMarker -> {
if(TextUtils.isEmpty(mogoMarker.getOwner()) || !mogoMarker.getOwner().equals(owner)){
mogoMarker.setVisible(false);
}
}));
}
public synchronized void removeAll() {
final Collection< List< IMogoMarker > > mogoMarkers = mServicesMarkers.values();
for ( List< IMogoMarker > mogoMarkerList : mogoMarkers ) {

View File

@@ -84,6 +84,11 @@ public class MogoMarkerManager implements IMogoMarkerManager {
MogoMarkersHandler.getInstance().inVisibleAll();
}
@Override
public void inVisibleWithoutMarkers(String owner) {
MogoMarkersHandler.getInstance().inVisibleMarkers(owner);
}
@Override
public List< IMogoMarker > getMarkers( String tag ) {
return MogoMarkersHandler.getInstance().getMarkers( tag );

View File

@@ -217,7 +217,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
while (iterator.hasNext()) {
ADASRecognizedResult result = iterator.next();
long internal = result.satelliteTime - getCurSatelliteTime();
if (internal > 300) {
if (internal > 3000) { //防止帧率过低导致误删除上一个节点对象,从而出现跳跃现象
iterator.remove();
}
}
@@ -270,11 +270,13 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
// Log.d(TAG, "使用缓存 id : " + uniqueKey);
long interval = 45;
if (lastPosition != null) {
interval = computeAnimDuration(lastPosition.systemTime, recognizedListResult.systemTime, lastPosition.satelliteTime, recognizedListResult.satelliteTime);
interval = computeAnimDuration(lastPosition.satelliteTime, recognizedListResult.satelliteTime);
}
final MogoLatLng renderLoc = new MogoLatLng(recognizedListResult.lat, recognizedListResult.lon);
long cost = System.currentTimeMillis() - start;
long cost = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start);
Log.d("ADAS动画数据","cost : " + cost);
final long intervalRef = interval - cost;
Log.d("ADAS动画数据", "最终赋值 : " + intervalRef + " 两帧间隔 : " + interval + " uuid : " + recognizedListResult.uuid);
marker.addDynamicAnchorPosition(renderLoc, (float) recognizedListResult.heading, intervalRef);
String carColor = recognizedListResult.color;
if (TextUtils.isEmpty(carColor)) {

View File

@@ -28,7 +28,6 @@ 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 com.mogo.module.common.constants.DataTypes.TYPE_MARKER_ADAS;
import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_DATA;
import static java.lang.Math.PI;
@@ -306,7 +305,6 @@ class BaseDrawer {
Dangerous_Visual("#FF91B7F1"),
Dangerous_Cloud("#FF260FEC");
private int fromType;
private final String color;
Car3DModelColor(String color) {
@@ -315,47 +313,6 @@ class BaseDrawer {
}
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, "#D8F83F94"),
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;
}
}
/**
* 展示车辆速度
*
@@ -378,7 +335,8 @@ class BaseDrawer {
return;
}
mogoMarker.setInfoWindowOffset(0, 20);
String text = "speed : " + speedIntVal + "\n" + uuid + "\n" + "type : " + type + "\n" + "heading : " + heading;
// String text = "speed : " + speedIntVal + "\n" + uuid + "\n" + "type : " + type + "\n" + "heading : " + heading;
String text = uuid + " " + (int) heading;
mSpeedView.setText(text);
mogoMarker.updateInfoWindowView(mSpeedView);
}
@@ -455,16 +413,18 @@ class BaseDrawer {
/**
* 使用系统时间或卫星时间计算出动画的运动时间最小值45防止两个点距离过近设置的最小动画执行时间
*
* @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;
long satelliteTimeInterval = curSatelliteTime - lastSatelliteTime;
long interval = systemTimeInterval < satelliteTimeInterval || satelliteTimeInterval == 0 ? systemTimeInterval : satelliteTimeInterval;
public long computeAnimDuration(long lastSatelliteTime, long curSatelliteTime) {
if (lastSatelliteTime == 0 || curSatelliteTime == 0) {
Log.d("ADAS动画数据", "卫星时间存在错误");
return 45;
}
long interval = curSatelliteTime - lastSatelliteTime;
Log.d("ADAS动画数据", "lastSatelliteTime : " + lastSatelliteTime +
" ---- curSatelliteTime : " + curSatelliteTime + " ===== 插值 " + interval);
if (interval < 45) {
interval = 45;
}

View File

@@ -265,7 +265,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
while (iterator.hasNext()) {
SocketDownData.CloudRoadDataProto result = iterator.next();
long internal = result.getSatelliteTime() - Long.parseLong(adasControllerApi.getSatelliteTime());
if (internal > 300) {
if (internal > 3000) {
iterator.remove();
}
}
@@ -320,7 +320,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
mLastPositions.put(uniqueKey, cloudRoadData);
if (useCache) {
long interval = computeAnimDuration(lastPosition.getSystemTime(), cloudRoadData.getSystemTime(), lastPosition.getSatelliteTime(), cloudRoadData.getSatelliteTime());
long interval = computeAnimDuration(lastPosition.getSatelliteTime(), cloudRoadData.getSatelliteTime());
final MogoLatLng point = new MogoLatLng(cloudRoadData.getWgslat(), cloudRoadData.getWgslon());
long cost = System.currentTimeMillis() - start;

View File

@@ -49,6 +49,7 @@ import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.map.uicontroller.VisualAngleMode;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.constants.DataTypes;
import com.mogo.module.common.dialog.WMDialog;
import com.mogo.module.common.glide.SkinAbleBitmapTarget;
import com.mogo.module.common.map.CustomNaviInterrupter;
@@ -963,7 +964,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
}
}
private int[] heights = new int[]{100, 200, 300};
private final int[] heights = new int[]{100, 200, 300};
private int currentHeight;
private void debugTopView() {
@@ -1363,7 +1364,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
.getMapUIController().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
mSwitchText.setText(R.string.module_map_model_normal);
} else if (MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getCurrentMapVisualAngle().isMediumSight()) {
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(AbsMogoApplication.getApp()).inVisibleAllMarkers();
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(AbsMogoApplication.getApp()).inVisibleWithoutMarkers(DataTypes.TYPE_MARKER_ADAS);
MogoApisHandler.getInstance().getApis().getMapServiceApi()
.getMapUIController().changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null);
mSwitchText.setText(R.string.module_map_model_faster);

View File

@@ -61,7 +61,6 @@ public class AdasObjectUtils {
if (model == null) {
return null;
}
long start = System.nanoTime();
ADASRecognizedResult result = new ADASRecognizedResult();
result.uuid = model.getUuid();

View File

@@ -174,8 +174,7 @@ public class MogoADASController implements IMogoADASController {
mLastLon = stateInfo.getValues().getLon();
mLastLat = stateInfo.getValues().getLat();
mSpeed = stateInfo.getValues().getGnss_speed();
// satelliteTime = stateInfo.getValues().getSatelliteTime();
satelliteTime = stateInfo.getValues().getSystemTime();
satelliteTime = stateInfo.getValues().getSatelliteTime();
if (mMogoAdasCarDataCallback != null) {
mMogoAdasCarDataCallback.onAdasCarDataCallback(stateInfo);
}