@@ -33,6 +33,7 @@ import com.mogo.eagle.core.utilcode.mogo.AppLaunchTimeUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.permissions.PermissionsDialogUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.ResourcesHelper;
|
||||
import com.mogo.eagle.core.utilcode.util.BarUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ProcessUtils;
|
||||
import com.mogo.map.listener.IMogoHosListenerRegister;
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/module_main_window_background_color"
|
||||
android:background="@drawable/main_splash_bg"
|
||||
android:clipChildren="true"
|
||||
android:fitsSystemWindows="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- 地图 -->
|
||||
@@ -60,17 +62,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<!-- 右边事件面板 -->
|
||||
<!-- <FrameLayout-->
|
||||
<!-- android:id="@+id/module_main_id_event_panel_fragment_container"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="match_parent"-->
|
||||
<!-- android:layout_marginLeft="@dimen/module_main_id_entrance_fragment_container_marginLeft"-->
|
||||
<!-- android:paddingLeft="@dimen/module_main_event_panel_fragment_paddingLeft"-->
|
||||
<!-- android:paddingTop="@dimen/module_main_event_panel_fragment_paddingTop"-->
|
||||
<!-- android:paddingRight="@dimen/module_main_event_panel_fragment_paddingRight"-->
|
||||
<!-- android:paddingBottom="@dimen/module_main_event_panel_fragment_paddingBottom" />-->
|
||||
|
||||
<!-- 目的地车友 -->
|
||||
<FrameLayout
|
||||
android:id="@+id/module_main_id_message_history_fragment_container"
|
||||
@@ -102,7 +93,9 @@
|
||||
android:id="@+id/module_main_id_cover_up"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/main_splash_bg">
|
||||
android:background="@drawable/main_splash_bg"
|
||||
android:clipChildren="true"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -7,7 +7,7 @@ import com.mogo.eagle.core.data.enums.TrafficTypeEnum
|
||||
* @date 2021/8/17 8:41 下午
|
||||
* 交通元素数据,
|
||||
*/
|
||||
class /**/TrafficData {
|
||||
class TrafficData {
|
||||
/**
|
||||
* 交通元素类型, 车、人、摩托、大巴车、卡车、自行车
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.mogo.eagle.core.utilcode.util;
|
||||
|
||||
import static android.Manifest.permission.EXPAND_STATUS_BAR;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
@@ -19,15 +21,13 @@ import android.view.ViewGroup.MarginLayoutParams;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.annotation.RequiresPermission;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
|
||||
import static android.Manifest.permission.EXPAND_STATUS_BAR;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
@@ -44,8 +44,8 @@ public final class BarUtils {
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private static final String TAG_STATUS_BAR = "TAG_STATUS_BAR";
|
||||
private static final String TAG_OFFSET = "TAG_OFFSET";
|
||||
private static final int KEY_OFFSET = -123;
|
||||
private static final String TAG_OFFSET = "TAG_OFFSET";
|
||||
private static final int KEY_OFFSET = -123;
|
||||
|
||||
private BarUtils() {
|
||||
throw new UnsupportedOperationException("u can't instantiate me...");
|
||||
@@ -288,9 +288,13 @@ public final class BarUtils {
|
||||
* @param fakeStatusBar The fake status bar view.
|
||||
*/
|
||||
public static void setStatusBarCustom(@NonNull final View fakeStatusBar) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) return;
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
|
||||
return;
|
||||
}
|
||||
Activity activity = UtilsBridge.getActivityByContext(fakeStatusBar.getContext());
|
||||
if (activity == null) return;
|
||||
if (activity == null) {
|
||||
return;
|
||||
}
|
||||
transparentStatusBar(activity);
|
||||
fakeStatusBar.setVisibility(View.VISIBLE);
|
||||
ViewGroup.LayoutParams layoutParams = fakeStatusBar.getLayoutParams();
|
||||
@@ -333,9 +337,13 @@ public final class BarUtils {
|
||||
@NonNull final View fakeStatusBar,
|
||||
@ColorInt final int color,
|
||||
final boolean isTop) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) return;
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
|
||||
return;
|
||||
}
|
||||
Activity activity = UtilsBridge.getActivityByContext(fakeStatusBar.getContext());
|
||||
if (activity == null) return;
|
||||
if (activity == null) {
|
||||
return;
|
||||
}
|
||||
transparentStatusBar(activity);
|
||||
drawer.setFitsSystemWindows(false);
|
||||
setStatusBarColor(fakeStatusBar, color);
|
||||
@@ -381,14 +389,18 @@ public final class BarUtils {
|
||||
private static void hideStatusBarView(@NonNull final Window window) {
|
||||
ViewGroup decorView = (ViewGroup) window.getDecorView();
|
||||
View fakeStatusBarView = decorView.findViewWithTag(TAG_STATUS_BAR);
|
||||
if (fakeStatusBarView == null) return;
|
||||
if (fakeStatusBarView == null) {
|
||||
return;
|
||||
}
|
||||
fakeStatusBarView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
private static void showStatusBarView(@NonNull final Window window) {
|
||||
ViewGroup decorView = (ViewGroup) window.getDecorView();
|
||||
View fakeStatusBarView = decorView.findViewWithTag(TAG_STATUS_BAR);
|
||||
if (fakeStatusBarView == null) return;
|
||||
if (fakeStatusBarView == null) {
|
||||
return;
|
||||
}
|
||||
fakeStatusBarView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@@ -407,16 +419,18 @@ public final class BarUtils {
|
||||
}
|
||||
|
||||
public static void transparentStatusBar(@NonNull final Window window) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) return;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
|
||||
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
|
||||
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||
int option = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
|
||||
int vis = window.getDecorView().getSystemUiVisibility();
|
||||
window.getDecorView().setSystemUiVisibility(option | vis);
|
||||
window.setStatusBarColor(Color.TRANSPARENT);
|
||||
window.setNavigationBarColor(Color.TRANSPARENT);
|
||||
} else {
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
|
||||
WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.mogo.module.common.animation;
|
||||
|
||||
import android.graphics.drawable.AnimationDrawable;
|
||||
|
||||
public class DelegateDrawable implements Animation {
|
||||
|
||||
private AnimationDrawable drawable;
|
||||
|
||||
public DelegateDrawable(AnimationDrawable drawable) {
|
||||
this.drawable = drawable;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
if (drawable != null) {
|
||||
drawable.start();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
if (drawable != null) {
|
||||
drawable.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,6 @@
|
||||
package com.mogo.module.common.constants;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/27
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
enum AdasRecognizedType {
|
||||
public enum AdasRecognizedType {
|
||||
//背景
|
||||
classIdBackground("background", 0),
|
||||
//人
|
||||
|
||||
@@ -1,348 +0,0 @@
|
||||
package com.mogo.module.common.drawer;
|
||||
|
||||
import static com.mogo.cloud.socket.entity.SocketDownDataHelper.FROM_ADAS;
|
||||
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData;
|
||||
import com.mogo.map.MogoMarkerManager;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.constants.DataTypes;
|
||||
import com.mogo.module.common.utils.Trigonometric;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/28
|
||||
* <p>
|
||||
* 绘制adas近景识别到的车辆
|
||||
*/
|
||||
public class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
|
||||
private static final String TAG = "AdasRecognizedResultDrawer";
|
||||
|
||||
private static volatile AdasRecognizedResultDrawer sInstance;
|
||||
|
||||
/**
|
||||
* 上一帧数据的缓存
|
||||
*/
|
||||
private static Map<String, IMogoMarker> mMarkersCaches = new ConcurrentHashMap<>();
|
||||
|
||||
public AdasRecognizedResultDrawer() {
|
||||
super();
|
||||
}
|
||||
|
||||
private final Map<String, TrafficData> mLastPositions = new ConcurrentHashMap<>();
|
||||
|
||||
public static AdasRecognizedResultDrawer getInstance() {
|
||||
if (sInstance == null) {
|
||||
synchronized (AdasRecognizedResultDrawer.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new AdasRecognizedResultDrawer();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public boolean hasCached(String uniqueKey) {
|
||||
return mMarkersCaches.containsKey(uniqueKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* 渲染 adas 识别的数据
|
||||
*
|
||||
* @param resultList adas感知融合数据
|
||||
*/
|
||||
public void renderAdasRecognizedResult(List<TrafficData> resultList) {
|
||||
|
||||
final long start = System.nanoTime();
|
||||
if (resultList == null || resultList.isEmpty() || !DebugConfig.isUseAdasRecognize()) {
|
||||
clearOldMarker();
|
||||
Log.w("ADAS数据延时绘制", "resultList==>" + resultList + " DebugConfig.isUseAdasRecognize()==>" + DebugConfig.isUseAdasRecognize());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
clearOldMarker();
|
||||
Log.w("ADAS数据延时绘制", "当前不是VR模式");
|
||||
return;
|
||||
}
|
||||
|
||||
// List<TrafficData> allDatumsList = new ArrayList<>();
|
||||
// prepareData(resultList, allDatumsList);
|
||||
|
||||
Map<String, IMogoMarker> newAdasRecognizedMarkersCaches = new ConcurrentHashMap<>();
|
||||
List<TrafficData> newDiffSet = new ArrayList<>();
|
||||
for (TrafficData recognizedListResult : resultList) {
|
||||
|
||||
if (isUselessValue(recognizedListResult)) {
|
||||
continue;
|
||||
}
|
||||
// 复用之前存在的 marker
|
||||
String uniqueKey = recognizedListResult.getUuid();
|
||||
IMogoMarker marker = mMarkersCaches.remove(uniqueKey);
|
||||
if (marker != null && !marker.isDestroyed()) {
|
||||
// Log.d(TAG, "发现缓存marker id : " + uniqueKey);
|
||||
updateCacheMarkerRes(marker, recognizedListResult);
|
||||
renderAdasOneFrame(marker, uniqueKey, recognizedListResult, newAdasRecognizedMarkersCaches);
|
||||
} else {
|
||||
// 新增添加进差集
|
||||
newDiffSet.add(recognizedListResult);
|
||||
}
|
||||
}
|
||||
removeUselessMarker(mMarkersCaches);
|
||||
removeUselessLastRecord();
|
||||
int newDiffSetSize = newDiffSet.size();
|
||||
// Log.d(TAG, "原数据量 : " + resultList.size() + " 新增marker数量 : " + newDiffSetSize);
|
||||
// 复用过期 marker
|
||||
if (newDiffSetSize > 0) {
|
||||
for (int i = 0; i < newDiffSetSize; i++) {
|
||||
TrafficData recognizedListResult = newDiffSet.get(i);
|
||||
String uniqueKey = recognizedListResult.getUuid();
|
||||
IMogoMarker marker = drawAdasRecognizedDataMarker(recognizedListResult);
|
||||
if (marker == null) {
|
||||
continue;
|
||||
}
|
||||
// Log.d(TAG, "新增marker id : " + uniqueKey);
|
||||
renderAdasOneFrame(marker, uniqueKey, recognizedListResult, newAdasRecognizedMarkersCaches);
|
||||
}
|
||||
}
|
||||
sendMessage(MSG_REMOVE_DIRTY_MARKERS, mMarkersCaches);
|
||||
mMarkersCaches.clear();
|
||||
mMarkersCaches = newAdasRecognizedMarkersCaches;
|
||||
Log.d("ADAS数据延时绘制", "render 接收数据 -> 处理结束 " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start)) + "ms");
|
||||
}
|
||||
|
||||
/**
|
||||
* 对数据补点
|
||||
*
|
||||
* @param in
|
||||
* @param out
|
||||
*/
|
||||
private void prepareData(List<TrafficData> in, List<TrafficData> out) {
|
||||
// foreCastPoint(in);
|
||||
out.addAll(in);
|
||||
}
|
||||
|
||||
private final static String FORECAST = "adasForecast";
|
||||
|
||||
/**
|
||||
* 基于工控机识别的数据点速度预测当前位置和距离自车距离
|
||||
*
|
||||
* @param in 数据源
|
||||
*/
|
||||
private void foreCastPoint(List<TrafficData> in) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
for (TrafficData adasResult : in) {
|
||||
Log.d(FORECAST, "ready to foreCast current uuid : " + adasResult.getUuid());
|
||||
long internal = getCurSatelliteTime() - adasResult.getSatelliteTime();
|
||||
if (internal <= 0) {
|
||||
Log.d(FORECAST, "time internal less than 0 , uuid : " + adasResult.getUuid());
|
||||
continue;
|
||||
}
|
||||
long startTime = System.currentTimeMillis();
|
||||
// 预测点
|
||||
Log.d(FORECAST, "time internal : " + internal + " speed : " + adasResult.getSpeed());
|
||||
double foreCastDistance = adasResult.getSpeed() * internal / 1000;
|
||||
Log.d(FORECAST, "foreCastDistance : " + foreCastDistance);
|
||||
MogoLatLng mogoLatLng = new MogoLatLng(adasResult.getLat(), adasResult.getLon());
|
||||
MogoLatLng foreCastMogoLatLon = Trigonometric.getNewLocation(mogoLatLng, foreCastDistance, adasResult.getHeading());
|
||||
|
||||
// 计算与自车距离
|
||||
float distanceFromSelf = CoordinateUtils.calculateLineDistance(getCurCoordinates()[0], getCurCoordinates()[1]
|
||||
, foreCastMogoLatLon.getLon(), foreCastMogoLatLon.getLat());
|
||||
|
||||
long foreCastInternal = System.currentTimeMillis() - startTime;
|
||||
Log.d(FORECAST, "foreCastInternal :" + foreCastInternal); //todo 耗时1~2毫秒 需要测试是否由于补点算法造成
|
||||
|
||||
adasResult.setLat(foreCastMogoLatLon.getLat());
|
||||
adasResult.setLon(foreCastMogoLatLon.getLon());
|
||||
adasResult.setSatelliteTime((getCurSatelliteTime() - foreCastInternal));
|
||||
adasResult.setDistance(distanceFromSelf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* todo 后面涉及到此类变化的数据均改动
|
||||
*
|
||||
* @param marker
|
||||
* @param recognizedListResult
|
||||
*/
|
||||
private void updateCacheMarkerRes(IMogoMarker marker, TrafficData recognizedListResult) {
|
||||
String resIdVal;
|
||||
int resId = getModelRes(recognizedListResult.getType().getType());
|
||||
resIdVal = resId + "";
|
||||
String resName = mMarkerCachesResMd5Values.get(resIdVal);
|
||||
if (!TextUtils.isEmpty(resName)) {
|
||||
if (!TextUtils.equals(resName, marker.getMarkerResName())) {
|
||||
marker.use3DResource(resName);
|
||||
}
|
||||
} else {
|
||||
resName = marker.use3DResource(resId);
|
||||
mMarkerCachesResMd5Values.put(resIdVal, resName);
|
||||
}
|
||||
}
|
||||
|
||||
private void removeUselessLastRecord() { // todo 最好重新设计一个数据结构,用于多线程数据过期失效的场景,参见redis数据过期
|
||||
if (mLastPositions.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Iterator<TrafficData> iterator = mLastPositions.values().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
TrafficData result = iterator.next();
|
||||
long internal = result.getSatelliteTime() - getCurSatelliteTime();
|
||||
if (internal > 3000) { //防止帧率过低导致误删除上一个节点对象,从而出现跳跃现象
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 过滤无用数据
|
||||
*
|
||||
* @param recognizedListResult {@link TrafficData}
|
||||
* @return useless
|
||||
*/
|
||||
private boolean isUselessValue(TrafficData recognizedListResult) {
|
||||
if (recognizedListResult == null) {
|
||||
return true;
|
||||
}
|
||||
if (nonRenderType(recognizedListResult.getType().getType())) {
|
||||
return true;
|
||||
}
|
||||
String uniqueKey = recognizedListResult.getUuid();
|
||||
return TextUtils.isEmpty(uniqueKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制某个物体的一个数据
|
||||
*
|
||||
* @param recognizedListResult {@link TrafficData}
|
||||
* @param newAdasRecognizedMarkersCaches 缓存集合
|
||||
*/
|
||||
private void renderAdasOneFrame(IMogoMarker marker,
|
||||
String uniqueKey,
|
||||
TrafficData recognizedListResult,
|
||||
Map<String, IMogoMarker> newAdasRecognizedMarkersCaches) {
|
||||
final long start = System.nanoTime();
|
||||
// Log.d(TAG, "renderAdasOneFrame uuid : " + uniqueKey + " type : " + recognizedListResult.type + " heading : " + recognizedListResult.heading);
|
||||
TrafficData lastPosition = mLastPositions.remove(uniqueKey);
|
||||
// 道路吸附
|
||||
// double lastLon = -1;
|
||||
// double lastLat = -1;
|
||||
// if (lastPosition != null) {
|
||||
// lastLon = lastPosition.lon;
|
||||
// lastLat = lastPosition.lat;
|
||||
// }
|
||||
// double[] matchLonLat = getMatchLonLat(recognizedListResult.uuid, recognizedListResult.lon, recognizedListResult.lat, recognizedListResult.heading, lastLon, lastLat);
|
||||
//
|
||||
// recognizedListResult.lon = matchLonLat[0];
|
||||
// recognizedListResult.lat = matchLonLat[1];
|
||||
// Log.d( "matchRoad", "cost = %s", System.currentTimeMillis() - start );
|
||||
|
||||
mLastPositions.put(uniqueKey, recognizedListResult);
|
||||
// Log.d(TAG, "使用缓存 id : " + uniqueKey);
|
||||
long interval = 45;
|
||||
if (lastPosition != null) {
|
||||
interval = computeAnimDuration(lastPosition.getSatelliteTime(), recognizedListResult.getSatelliteTime());
|
||||
}
|
||||
final MogoLatLng renderLoc = new MogoLatLng(recognizedListResult.getLat(), recognizedListResult.getLon());
|
||||
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.getUuid());
|
||||
marker.addDynamicAnchorPosition(renderLoc, (float) recognizedListResult.getHeading(), intervalRef);
|
||||
String carColor = getModelRenderColor(recognizedListResult.getType().getType(), FROM_ADAS, recognizedListResult.getThreatLevel());
|
||||
marker.setAnchorColor(carColor);
|
||||
|
||||
newAdasRecognizedMarkersCaches.put(uniqueKey, marker);
|
||||
|
||||
// if (shouldShowSpeed(recognizedListResult.type)) {
|
||||
// Message msg = mRenderThreadHandler.obtainMessage();
|
||||
// msg.obj = new SpeedData(marker
|
||||
// , recognizedListResult.speed
|
||||
// , recognizedListResult.uuid
|
||||
// , recognizedListResult.type
|
||||
// , recognizedListResult.heading
|
||||
// , MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode());
|
||||
// msg.what = MSG_DISPLAY_SPEED;
|
||||
// msg.sendToTarget();
|
||||
// }
|
||||
Log.d("ADAS数据延时", "render 刷新一台车 cost : " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制 marker
|
||||
*
|
||||
* @param recognizedListResult {@link TrafficData}
|
||||
* @return {@link IMogoMarker}
|
||||
*/
|
||||
private IMogoMarker drawAdasRecognizedDataMarker(TrafficData recognizedListResult) {
|
||||
long start = System.nanoTime();
|
||||
if (recognizedListResult == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int resId = getModelRes(recognizedListResult.getType().getType());
|
||||
String resIdVal = resId + "";
|
||||
|
||||
String carColor = getModelRenderColor(recognizedListResult.getType().getType(), FROM_ADAS, recognizedListResult.getThreatLevel());
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.owner(DataTypes.TYPE_MARKER_ADAS)
|
||||
.anchor(0.5f, 0.5f)
|
||||
.set3DMode(true)
|
||||
.gps(true)
|
||||
.anchorColor(carColor)
|
||||
.controlAngle(true)
|
||||
.resName(mMarkerCachesResMd5Values.get(resIdVal))
|
||||
.icon3DRes(resId)
|
||||
.rotate((float) recognizedListResult.getHeading())
|
||||
.position(new MogoLatLng(recognizedListResult.getLat(), recognizedListResult.getLon()));
|
||||
IMogoMarker marker = MogoMarkerManager.getInstance(mContext).addMarker(DataTypes.TYPE_MARKER_ADAS, options);
|
||||
cacheMarkerIconResMd5Val(resIdVal, marker);
|
||||
Log.d("ADAS数据延时", "创建一个新 marker cost : " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start)));
|
||||
return marker;
|
||||
}
|
||||
|
||||
/**
|
||||
* vr 模式切换
|
||||
*/
|
||||
public void notifyVrModeChanged() {
|
||||
clearOldMarker();
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除旧的 marker 数据
|
||||
*/
|
||||
public void clearOldMarker() {
|
||||
if (mMarkersCaches != null) {
|
||||
mMarkersCaches.clear();
|
||||
}
|
||||
mLastPositions.clear();
|
||||
sendMessage(MSG_REMOVE_DIRTY_MARKERS, DataTypes.TYPE_MARKER_ADAS);
|
||||
}
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
package com.mogo.module.common.drawer.marker;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.view.View;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.module.common.R;
|
||||
|
||||
import java.lang.ref.SoftReference;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* VR 模式的Marker绘制
|
||||
*/
|
||||
public class MapVrMarkerView implements IMarkerView {
|
||||
private String TAG = "MapVrMarkerView";
|
||||
|
||||
|
||||
private static Map<String, SoftReference<Bitmap>> sRef = new HashMap<>();
|
||||
private static Map<String, SoftReference<Bitmap>> sTypedRef = new HashMap<>();
|
||||
|
||||
private static final class InstanceHolder {
|
||||
private static final MapVrMarkerView INSTANCE = new MapVrMarkerView();
|
||||
}
|
||||
|
||||
public static MapVrMarkerView getInstance() {
|
||||
return MapVrMarkerView.InstanceHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return MapVrMarkerView.InstanceHolder.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMarker(IMogoMarker marker) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Bitmap getBitmap(int vehicleType) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TODO 都是模拟数据
|
||||
* 获取VR道路事件
|
||||
*/
|
||||
public Bitmap getBitmap(String sceneId) {
|
||||
sRef.put(sceneId, new SoftReference<>(BitmapFactory.decodeResource(AbsMogoApplication.getApp().getResources(), R.drawable.icon_map_marker_car_type_taxi)));
|
||||
switch (sceneId) {
|
||||
case "200001"://后方VIP车辆提示
|
||||
// bitmap = ImageUtil.createBitmap(Utils.getApp(),
|
||||
// R.drawable.v2x_duixiang_laiche_che);
|
||||
break;
|
||||
case "200002"://前车急刹
|
||||
break;
|
||||
case "200003"://后方危险车辆预警
|
||||
break;
|
||||
case "200004"://逆向车辆路线预判
|
||||
// bitmap = ImageUtil.createBitmap(Utils.getApp(),
|
||||
// R.drawable.v2x_duixiang_laiche_che);
|
||||
break;
|
||||
case "200005"://VIP变灯通行
|
||||
break;
|
||||
case "200006"://障碍物绕行
|
||||
break;
|
||||
case "200007"://行人预警,行人路线预测
|
||||
break;
|
||||
case "200008"://拥堵路线推荐
|
||||
break;
|
||||
case "200009"://双闪车辆,自动绕行
|
||||
break;
|
||||
}
|
||||
|
||||
return sRef.get(sceneId).get();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package com.mogo.module.common.drawer.marker;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import com.mogo.map.marker.IMogoInfoWindowAdapter;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
|
||||
/**
|
||||
* 简单marker适配器
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class SimpleWindow3DAdapter implements IMogoInfoWindowAdapter {
|
||||
|
||||
public View icon;
|
||||
public SimpleWindow3DAdapter(View icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
@Override
|
||||
public View getInfoWindow(IMogoMarker marker) {
|
||||
return icon;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/customRatingBar">
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -27,7 +27,6 @@ import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler;
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
|
||||
import com.mogo.eagle.core.utilcode.util.AppStateManager;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.map.MogoMapUIController;
|
||||
import com.mogo.map.MogoMarkerManager;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
@@ -462,23 +461,10 @@ public class MockIntentHandler implements IntentHandler {
|
||||
.rotate((float) 358.526123);
|
||||
IMogoMarker marker3 = MogoMarkerManager.getInstance(context).addMarker(DataTypes.TYPE_MARKER_ADAS, options3);
|
||||
break;
|
||||
case 51:// 模拟路口车辆移动
|
||||
// mLocationMockHandler.sendEmptyMessageDelayed(100, 0L);
|
||||
// mLocationMockHandler.sendEmptyMessageDelayed(101, 1000L);
|
||||
break;
|
||||
case 52:
|
||||
// 打开连调工控机、ADAS的控制面板
|
||||
//adb shell am broadcast -a com.mogo.mock --ei oper 52
|
||||
//EnvStatusManager.getInstance().showPanel(context);
|
||||
ToastUtils.showShort("请使用新版调试面板!!");
|
||||
break;
|
||||
case 53:// 控制 Adas识别 是否可用
|
||||
boolean isUseAdasRecognize = intent.getBooleanExtra("status", false);
|
||||
DebugConfig.setUseAdasRecognize(isUseAdasRecognize);
|
||||
break;
|
||||
case 54:
|
||||
// mTimeTickCarHandler.sendEmptyMessageDelayed(1, 0L);
|
||||
break;
|
||||
case 56:
|
||||
// 开启数据采集 自车定位和视觉识别
|
||||
break;
|
||||
@@ -568,19 +554,6 @@ public class MockIntentHandler implements IntentHandler {
|
||||
br = null;
|
||||
}
|
||||
}
|
||||
// 模拟远端数据
|
||||
else if (msg.what == 21) {
|
||||
try {
|
||||
handleMockSnapshotIntent2();
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
br4.close();
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// 模拟ADAS数据
|
||||
else if (msg.what == 3) {
|
||||
try {
|
||||
@@ -714,39 +687,6 @@ public class MockIntentHandler implements IntentHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private BufferedReader br4;
|
||||
|
||||
/**
|
||||
* 模拟快照意图
|
||||
*/
|
||||
private boolean handleMockSnapshotIntent2() throws Exception {
|
||||
// if (br4 == null) {
|
||||
// br4 = new BufferedReader(new InputStreamReader(AbsMogoApplication.getApp().getAssets().open("snapshot.txt"))); todo 需要重新模拟一个test数据
|
||||
// }
|
||||
// String line = br4.readLine();
|
||||
// if (line == null) {
|
||||
// throw new Exception("end of file 2.");
|
||||
// }
|
||||
// SocketDownData.LauncherSnapshotProto.Builder data = SocketDownData.LauncherSnapshotProto.newBuilder();
|
||||
// List<SocketDownData.CloudRoadDataProto> allList = new ArrayList<>();
|
||||
// SocketDownData.CloudRoadDataProto cloudRoadData = GsonUtil.objectFromJson(line, SocketDownData.CloudRoadDataProto.class);
|
||||
// if (cloudRoadData == null) {
|
||||
// return false;
|
||||
// }
|
||||
// SocketDownData.CloudRoadDataProto.Builder builder = cloudRoadData.toBuilder();
|
||||
// builder.setWgslat(cloudRoadData.getLon());
|
||||
// builder.setWgslon(cloudRoadData.getLat());
|
||||
// builder.setUuid("1_21");
|
||||
// allList.add(cloudRoadData);
|
||||
// data.addAllAllList(allList);
|
||||
//
|
||||
// final long start = System.currentTimeMillis();
|
||||
// SnapshotSetDataDrawer.getInstance().renderSnapshotData(data.build());
|
||||
//// mLocationMockHandler.sendEmptyMessageDelayed( 21, 100L );
|
||||
return true;
|
||||
}
|
||||
|
||||
private BufferedReader[] readers = null;
|
||||
private BufferedReader[] readers2 = null;
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package com.mogo.module.service.network;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.service.network.bean.HomeCompanyDistanceForPushResponse;
|
||||
import com.mogo.module.service.network.bean.TtsConfigData;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -19,30 +17,21 @@ import retrofit2.http.POST;
|
||||
* 接口描述
|
||||
*/
|
||||
public interface RefreshApiService {
|
||||
|
||||
/**
|
||||
* 大而全
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST( "/yycp-launcherSnapshot/launcherSnapshot/querySnapshotAsync" )
|
||||
Observable< BaseData > refreshData( @FieldMap Map< String, Object > parameters );
|
||||
@POST("/yycp-launcherSnapshot/launcherSnapshot/querySnapshotSync")
|
||||
Observable<MarkerResponse> refreshDataSync(@FieldMap Map<String, Object> parameters);
|
||||
|
||||
/**
|
||||
* 大而全
|
||||
*/
|
||||
* 周边在线车辆
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST( "/yycp-launcherSnapshot/launcherSnapshot/querySnapshotSync" )
|
||||
Observable< MarkerResponse > refreshDataSync( @FieldMap Map< String, Object > parameters );
|
||||
|
||||
/**
|
||||
* 周边在线车辆
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST( "/yycp-launcherSnapshot/user/queryOnLineCarWithRoute" )
|
||||
Observable< MarkerResponse > queryOnLineCarWithRoute( @FieldMap Map< String, Object > parameters );
|
||||
@POST("/yycp-launcherSnapshot/user/queryOnLineCarWithRoute")
|
||||
Observable<MarkerResponse> queryOnLineCarWithRoute(@FieldMap Map<String, Object> parameters);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST( "/yycp-travel-condition/trajectoryPrediction/calculationNotHomeCompanyDistanceForPush" )
|
||||
Observable< HomeCompanyDistanceForPushResponse > calculationNotHomeCompanyDistanceForPush( @FieldMap Map< String, Object > parameters );
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST( "/yycp-launcherSnapshot/appCard/queryAppCardData" )
|
||||
Observable< TtsConfigData > queryBroadCastInfo( @FieldMap Map< String, Object > parameters );
|
||||
@POST("/yycp-launcherSnapshot/appCard/queryAppCardData")
|
||||
Observable<TtsConfigData> queryBroadCastInfo(@FieldMap Map<String, Object> parameters);
|
||||
}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.mogo.module.service.network.bean;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/9/22
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class HomeCompanyDistanceForPushData {
|
||||
|
||||
public double lon;
|
||||
public double lat;
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.mogo.module.service.network.bean;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/9/22
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class HomeCompanyDistanceForPushResponse extends BaseData {
|
||||
|
||||
public HomeCompanyDistanceForPushResult result;
|
||||
|
||||
public static class HomeCompanyDistanceForPushResult {
|
||||
public boolean pushFlag;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user