Merge branch 'master' into dev_MogoAP_eagle-220_211207_8.0.17

# Conflicts:
#	gradle.properties
#	libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapWrapper.java
#	libraries/map-custom/src/main/java/com/mogo/map/impl/custom/CustomMapApiBuilder.java
#	modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/IdentifyDataDrawer.java
This commit is contained in:
donghongyu
2022-01-14 14:49:29 +08:00
19 changed files with 359 additions and 554 deletions

View File

@@ -31,7 +31,7 @@
android:textSize="@dimen/dp_34"
android:textStyle="bold" />
<LinearLayout
<!-- <LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
@@ -50,7 +50,7 @@
android:format24Hour="yyyy年MM月dd日 EEEE aa HH:mm:ss"
android:textColor="#000"
android:textSize="@dimen/dp_36" />
</LinearLayout>
</LinearLayout>-->
<TextView
android:id="@+id/tvAppInfo"

View File

@@ -11,7 +11,7 @@
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<application>
<!--保活用-->
<!-- &lt;!&ndash;保活用&ndash;&gt;
<service
android:name="com.zhidao.boot.persistent.lib.PersistentAliveService"
android:enabled="true"
@@ -26,7 +26,7 @@
android:resizeableActivity="false"
android:screenOrientation="landscape"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
-->
<activity
android:name=".MainLauncherActivity"
android:clearTaskOnLaunch="true"

View File

@@ -36,8 +36,8 @@ enum class TrafficTypeEnum(
TYPE_TRAFFIC_ID_TA_CHE(
3,
"他车",
R.raw.special_vehicle,
R.raw.special_vehicle
R.raw.othercar,
R.raw.othercar
),
TYPE_TRAFFIC_ID_MOTO(
4,

Binary file not shown.

View File

@@ -37,7 +37,7 @@ kapt.include.compile.classpath=false
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
android.jetifier.blacklist=module-service-2.1.15.9.aar
android.jetifier.blacklist=module-service-2.1.16.6.aar
## maven 配置
RELEASE_REPOSITORY_URL=http://nexus.zhidaoauto.com/repository/maven-releases/
SNAPSHOT_REPOSITORY_URL=http://nexus.zhidaoauto.com/repository/maven-snapshots/
@@ -89,104 +89,104 @@ applicationName=IntelligentPilot
versionCode=80008
versionName=8.0.17
################# 新架构模块Maven版本管理 #################
MOGO_CORE_FUNCTION_AUTOPILOT_VERSION=0.0.57.9
MOGO_CORE_FUNCTION_CHECK_VERSION=0.0.57.9
MOGO_CORE_FUNCTION_HMI_VERSION=0.0.57.9
MOGO_CORE_FUNCTION_MAIN_VERSION=0.0.57.9
MOGO_CORE_FUNCTION_MAP_VERSION=0.0.57.9
MOGO_CORE_FUNCTION_MONITORING_VERSION=0.0.57.9
MOGO_CORE_FUNCTION_NOTICE_VERSION=0.0.57.9
MOGO_CORE_FUNCTION_OBU_MOGO_VERSION=0.0.57.9
MOGO_CORE_FUNCTION_SMP_VERSION=0.0.57.9
MOGO_CORE_FUNCTION_V2X_VERSION=0.0.57.9
MOGO_CORE_DATA_VERSION=0.0.57.9
MOGO_CORE_FUNCTION_API_VERSION=0.0.57.9
MOGO_CORE_FUNCTION_CALL_VERSION=0.0.57.9
MOGO_CORE_RES_VERSION=0.0.57.9
MOGO_CORE_UTILS_VERSION=0.0.57.9
MOGO_CORE_NETWORK_VERSION=0.0.57.9
MOGO_CORE_FUNCTION_AUTOPILOT_VERSION=0.0.58.6
MOGO_CORE_FUNCTION_CHECK_VERSION=0.0.58.6
MOGO_CORE_FUNCTION_HMI_VERSION=0.0.58.6
MOGO_CORE_FUNCTION_MAIN_VERSION=0.0.58.6
MOGO_CORE_FUNCTION_MAP_VERSION=0.0.58.6
MOGO_CORE_FUNCTION_MONITORING_VERSION=0.0.58.6
MOGO_CORE_FUNCTION_NOTICE_VERSION=0.0.58.6
MOGO_CORE_FUNCTION_OBU_MOGO_VERSION=0.0.58.6
MOGO_CORE_FUNCTION_SMP_VERSION=0.0.58.6
MOGO_CORE_FUNCTION_V2X_VERSION=0.0.58.6
MOGO_CORE_DATA_VERSION=0.0.58.6
MOGO_CORE_FUNCTION_API_VERSION=0.0.58.6
MOGO_CORE_FUNCTION_CALL_VERSION=0.0.58.6
MOGO_CORE_RES_VERSION=0.0.58.6
MOGO_CORE_UTILS_VERSION=0.0.58.6
MOGO_CORE_NETWORK_VERSION=0.0.58.6
################# 旧版本架构模块版本 #################
## 工程内模块
MOGO_COMMONS_VERSION=2.1.15.9
MOGO_UTILS_VERSION=2.1.15.9
MAP_AMAP_VERSION=2.1.15.9
MAP_AUTONAVI_VERSION=2.1.15.9
MOGO_MAP_VERSION=2.1.15.9
MOGO_MAP_API_VERSION=2.1.15.9
MOGO_SERVICE_VERSION=2.1.15.9
MOGO_SERVICE_API_VERSION=2.1.15.9
MOGO_CONNECTION_VERSION=2.1.15.9
MOGO_MODULE_APPS_VERSION=2.1.15.9
MOGO_MODULE_NAVI_VERSION=2.1.15.9
MOGO_MODULE_SHARE_VERSION=2.1.15.9
MOGO_MODULE_COMMON_VERSION=2.1.15.9
MOGO_MODULE_MAIN_VERSION=2.1.15.9
MOGO_MODULE_MAP_VERSION=2.1.15.9
MOGO_MODULE_SERVICE_VERSION=2.1.15.9
MOGO_MODULE_EXTENSIONS_VERSION=2.1.15.9
MOGO_MODULE_SEARCH_VERSION=2.1.15.9
MOGO_MODULE_BACK_VERSION=2.1.15.9
MOGO_MODULE_V2X_VERSION=2.1.15.9
MOGO_COMMONS_VERSION=2.1.16.6
MOGO_UTILS_VERSION=2.1.16.6
MAP_AMAP_VERSION=2.1.16.6
MAP_AUTONAVI_VERSION=2.1.16.6
MOGO_MAP_VERSION=2.1.16.6
MOGO_MAP_API_VERSION=2.1.16.6
MOGO_SERVICE_VERSION=2.1.16.6
MOGO_SERVICE_API_VERSION=2.1.16.6
MOGO_CONNECTION_VERSION=2.1.16.6
MOGO_MODULE_APPS_VERSION=2.1.16.6
MOGO_MODULE_NAVI_VERSION=2.1.16.6
MOGO_MODULE_SHARE_VERSION=2.1.16.6
MOGO_MODULE_COMMON_VERSION=2.1.16.6
MOGO_MODULE_MAIN_VERSION=2.1.16.6
MOGO_MODULE_MAP_VERSION=2.1.16.6
MOGO_MODULE_SERVICE_VERSION=2.1.16.6
MOGO_MODULE_EXTENSIONS_VERSION=2.1.16.6
MOGO_MODULE_SEARCH_VERSION=2.1.16.6
MOGO_MODULE_BACK_VERSION=2.1.16.6
MOGO_MODULE_V2X_VERSION=2.1.16.6
# 探路
MOGO_MODULE_TANLU_VERSION=2.1.15.9
MOGO_MODULE_TANLU_VERSION=2.1.16.6
# 推送
MOGO_MODULE_PUSH_VERSION=2.1.15.9
MOGO_MODULE_PUSH_BASE_VERSION=2.1.15.9
MOGO_MODULE_PUSH_NOOP_VERSION=2.1.15.9
MOGO_MODULE_PUSH_VERSION=2.1.16.6
MOGO_MODULE_PUSH_BASE_VERSION=2.1.16.6
MOGO_MODULE_PUSH_NOOP_VERSION=2.1.16.6
# 探路上报和分享模块
TANLULIB_VERSION=2.1.15.9
MOGO_TANLU_API_VERSION=2.1.15.9
TANLULIB_VERSION=2.1.16.6
MOGO_TANLU_API_VERSION=2.1.16.6
#左侧面板模块
MOGO_MODULE_LEFT_PANEL_VERSION=2.1.15.9
MOGO_MODULE_LEFT_PANEL_NOOP_VERSION=2.1.15.9
MOGO_MODULE_LEFT_PANEL_VERSION=2.1.16.6
MOGO_MODULE_LEFT_PANEL_NOOP_VERSION=2.1.16.6
# 小控件
MOGO_MODULE_WIDGETS_VERSION=2.1.15.9
MOGO_MODULE_WIDGETS_VERSION=2.1.16.6
# obu
MOGO_MODULE_OBU_VERSION=2.1.15.9
MOGO_MODULE_OBU_MOGO_VERSION=2.1.15.9
MOGO_MODULE_OBU_VERSION=2.1.16.6
MOGO_MODULE_OBU_MOGO_VERSION=2.1.16.6
# monitor
MOGO_MODULE_MONITOR_VERSION=2.1.15.9
MOGO_MODULE_MONITOR_VERSION=2.1.16.6
# bugly
CRASHREPORT_VERSION=2.1.15.9
CRASHREPORT_BUGLY_VERSION=2.1.15.9
CRASHREPORT_NOOP_VERSION=2.1.15.9
CRASHREPORT_UPGRADE_VERSION=2.1.15.9
CRASHREPORT_VERSION=2.1.16.6
CRASHREPORT_BUGLY_VERSION=2.1.16.6
CRASHREPORT_NOOP_VERSION=2.1.16.6
CRASHREPORT_UPGRADE_VERSION=2.1.16.6
## tts
TTS_BASE_VERSION=2.1.15.9
TTS_DI_VERSION=2.1.15.9
TTS_ZHI_VERSION=2.1.15.9
TTS_PAD_VERSION=2.1.15.9
TTS_NOOP_VERSION=2.1.15.9
TTS_BASE_VERSION=2.1.16.6
TTS_DI_VERSION=2.1.16.6
TTS_ZHI_VERSION=2.1.16.6
TTS_PAD_VERSION=2.1.16.6
TTS_NOOP_VERSION=2.1.16.6
# 自研地图
MAP_CUSTOM_VERSION=2.1.15.9
MOGO_MODULE_ADAS_VERSION=2.1.15.9
MAP_CUSTOM_VERSION=2.1.16.6
MOGO_MODULE_ADAS_VERSION=2.1.16.6
# 基础服务实现passport、socket、location
MOGO_BASE_WEBSOCKET_SDK_VERSION=2.1.15.9
MOGO_BASE_SERVICES_APK_VERSION=2.1.15.9
MOGO_BASE_SERVICES_SDK_VERSION=2.1.15.9
MOGO_MODULE_CHAT_VERSION=2.1.15.9
MOGO_BASE_WEBSOCKET_SDK_VERSION=2.1.16.6
MOGO_BASE_SERVICES_APK_VERSION=2.1.16.6
MOGO_BASE_SERVICES_SDK_VERSION=2.1.16.6
MOGO_MODULE_CHAT_VERSION=2.1.16.6
# 车聊聊
MOGO_MODULE_CARCHATTING_VERSION=2.1.15.9
MOGO_MODULE_CARCHATTING_VERSION=2.1.16.6
# 车聊聊接口
MOGO_MODULE_CARCHATTINGPROVIDER_VERSION=2.1.15.9
MOGO_MODULE_CARCHATTINGPROVIDER_VERSION=2.1.16.6
# 皮肤
MOGO_SKIN_SUPPORT_VERSION=2.1.15.9
MOGO_SKIN_LIGHT_VERSION=2.1.15.9
MOGO_SKIN_SUPPORT_IMPL_VERSION=2.1.15.9
MOGO_SKIN_SUPPORT_NOOP_VERSION=2.1.15.9
SKIN_SUPPORT_VERSION=2.1.15.9
SKIN_SUPPORT_APPCOMPAT_VERSION=2.1.15.9
SKIN_SUPPORT_CARDVIEW_VERSION=2.1.15.9
SKIN_SUPPORT_CONSTRAINT_LAYOUT_VERSION=2.1.15.9
SKIN_SUPPORT_DESIGN_VERSION=2.1.15.9
MOGO_SKIN_SUPPORT_VERSION=2.1.16.6
MOGO_SKIN_LIGHT_VERSION=2.1.16.6
MOGO_SKIN_SUPPORT_IMPL_VERSION=2.1.16.6
MOGO_SKIN_SUPPORT_NOOP_VERSION=2.1.16.6
SKIN_SUPPORT_VERSION=2.1.16.6
SKIN_SUPPORT_APPCOMPAT_VERSION=2.1.16.6
SKIN_SUPPORT_CARDVIEW_VERSION=2.1.16.6
SKIN_SUPPORT_CONSTRAINT_LAYOUT_VERSION=2.1.16.6
SKIN_SUPPORT_DESIGN_VERSION=2.1.16.6
# OCH
MOGO_OCH_VERSION=2.1.15.9-test
MOGO_OCH_VERSION=2.1.16.6-test
MOGO_OCH_BUS_VERSION=2.0.66
MOGO_OCH_NOOP_VERSION=2.0.66
MOGO_OCH_TAXI_VERSION=2.0.66
# mogoAiCloud sdk services
MOGO_AICLOUD_SERVICES_SDK_VERSION=2.1.15.9
MOGO_AICLOUD_SERVICES_SDK_VERSION=2.1.16.6
# v2x-sdk
MOGO_V2X_SDK_VERSION=1.0.1
################# 旧版本架构模块版本 #################

View File

@@ -3,6 +3,7 @@ package com.mogo.map.impl.custom;
import android.content.Context;
import android.graphics.Point;
import com.mogo.eagle.core.data.traffic.TrafficData;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.map.IMogoMap;
import com.mogo.map.IMogoUiSettings;
@@ -21,7 +22,9 @@ import com.zhidaoauto.map.sdk.open.MapAutoApi;
import com.zhidaoauto.map.sdk.open.data.MapDataApi;
import com.zhidaoauto.map.sdk.open.data.SinglePointRoadInfo;
import com.zhidaoauto.map.sdk.open.marker.Marker;
import com.zhidaoauto.map.sdk.open.marker.MarkerHelper;
import com.zhidaoauto.map.sdk.open.marker.MarkerOptions;
import com.zhidaoauto.map.sdk.open.marker.MarkerSimpleData;
import com.zhidaoauto.map.sdk.open.marker.MultiPointOverlayOptions;
import com.zhidaoauto.map.sdk.open.poyline.Polyline;
import com.zhidaoauto.map.sdk.open.poyline.PolylineOptions;
@@ -98,6 +101,43 @@ public class AMapWrapper implements IMogoMap {
return mogoMarker;
}
@Override
public void updateBatchMarkerPositon(ArrayList<TrafficData> optionsArrayList) {
if (!checkAMap()) {
return;
}
ArrayList<MarkerSimpleData> markerOptionsArrayList = new ArrayList<>();
for (TrafficData mogoMarkerOptions : optionsArrayList) {
MarkerSimpleData markerOptions = ObjectUtils.fromTrafficData(mogoMarkerOptions);
if (markerOptions == null) {
Logger.e(TAG, "marker参数为空");
break;
}
markerOptionsArrayList.add(markerOptions);
}
MarkerHelper.INSTANCE.updateBatchMarkerPositon(markerOptionsArrayList,false,8.0f,0,100);
}
@Override
public String addPreVehicleModel(int type, int modelRes) {
try {
return MarkerHelper.INSTANCE.addPreVehicleModel(type, modelRes);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
@Override
public void removeMarker(String uuidString) {
try {
MarkerHelper.INSTANCE.removeMarker(uuidString);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public ArrayList<IMogoMarker> addMarkers(String tag, ArrayList<MogoMarkerOptions> options, boolean moveToCenter) {
if (!checkAMap()) {

View File

@@ -22,6 +22,8 @@ import com.mogo.map.search.poisearch.IMogoPoiSearch;
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
import com.mogo.map.search.traffic.IMogoTrafficSearch;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.utils.logger.Logger;
import com.zhidaoauto.map.sdk.open.MapAutoApi;
import com.zhidaoauto.map.sdk.open.MapParams;
import com.zhidaoauto.map.sdk.open.NavAutoApi;
import com.zhidaoauto.map.sdk.open.NavParams;
@@ -77,14 +79,14 @@ public class CustomMapApiBuilder implements IMogoMapApiBuilder {
mapParams.setDebugMode(false)
//.setDataFileSource(1) //todo 1-使用本地地图数据0-使用在线地图数据
.setCoordinateType(MapParams.COORDINATETYPE_GCJ02)
.setPerspectiveMode(MapParams.MAP_PERSPECTIVE_2D)
.setPerspectiveMode(MapParams.MAP_PERSPECTIVE_3D)
// .setZoom( 20 )
// .setPointToCenter( 0.734375f, 0.5f )
.setPointToCenter(0.5f, 0.5f) //todo 2D模式下需要注意ADAS部分遮挡
.setStyleMode(MapParams.MAP_STYLE_VR);
NavAutoApi.INSTANCE.init(context, mapParams, NavParams.Companion.init());
MapAutoApi.INSTANCE.init(context, mapParams);
MapAutoView mapAutoView = new MapAutoView(context);
//mapAutoView.registerRenderListener(l -> Log.i(TAG, "renderTime: " + l));
IMogoMapView mapView = new AMapViewWrapper(mapAutoView);

View File

@@ -7,6 +7,7 @@ import android.view.View;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.data.traffic.TrafficData;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.map.overlay.MogoPolylineOptions;
import com.mogo.map.search.geo.MogoGeocodeAddress;
@@ -26,6 +27,7 @@ import com.zhidaoauto.map.sdk.open.camera.CameraPosition;
import com.zhidaoauto.map.sdk.open.marker.BitmapDescriptor;
import com.zhidaoauto.map.sdk.open.marker.BitmapDescriptorFactory;
import com.zhidaoauto.map.sdk.open.marker.MarkerOptions;
import com.zhidaoauto.map.sdk.open.marker.MarkerSimpleData;
import com.zhidaoauto.map.sdk.open.poyline.PolylineOptions;
import com.zhidaoauto.map.sdk.open.query.GeocodeAddress;
import com.zhidaoauto.map.sdk.open.query.GeocodeQuery;
@@ -69,22 +71,6 @@ public class ObjectUtils {
}
}
// 吸附到路边
// if ( opt.isMatchOnRoadSide() ) {
// double coors[] = new double[]{opt.getLongitude(), opt.getLatitude()};
// if ( !opt.isGps() ) {
// coors = CoordinateUtils.transformGcj02toWgs84( opt.getLatitude(), opt.getLongitude() );
// opt.gps( true );
// }
// if ( coors != null ) {
// SinglePointRoadInfo singlePointRoadInfo = MapDataApi.INSTANCE.getSinglePointMatchRoad( ( ( float ) coors[0] ), ( ( float ) coors[1] ), ( ( float ) opt.getRotate() ), true, true );
// double data[] = PointInterpolatorUtil.mergeToRoad( coors[0], coors[1], singlePointRoadInfo.getCoords() );
// if ( data != null ) {
// opt.longitude( data[0] ).latitude( data[1] );
// }
// }
// }
MarkerOptions markerOptions = new MarkerOptions()
.setGps(opt.isGps())
.position(new LonLatPoint(opt.getLongitude(), opt.getLatitude()))
@@ -98,13 +84,14 @@ public class ObjectUtils {
.infoWindowEnable(opt.isInifoWindowEnable())
.scale(opt.getScale())
.alpha(opt.getAlpha())
// .draggable( opt.isDraggable() )
.setInfoWindowOffset(opt.getOffsetX(), opt.getOffsetY())
.zIndex(opt.getzIndex());
try {
Color.parseColor(opt.getAnchorColor());
markerOptions.anchorColor(opt.getAnchorColor());
} catch (Exception e) {
e.printStackTrace();
}
markerOptions.vrEnable(opt.is3DMode());
if (!TextUtils.isEmpty(opt.getResName())) {
@@ -127,6 +114,24 @@ public class ObjectUtils {
return markerOptions;
}
public static MarkerSimpleData fromTrafficData(TrafficData trafficData) {
if (trafficData == null) {
return null;
}
MarkerSimpleData markerOptions = null;
try {
markerOptions = new MarkerSimpleData();
markerOptions.setId(Long.parseLong(trafficData.getUuid()));
markerOptions.setMarkerType(trafficData.getType().getType());
markerOptions.setRotateAngle((float) trafficData.getHeading());
markerOptions.setLat(trafficData.getLat());
markerOptions.setLon(trafficData.getLon());
} catch (Exception e) {
e.printStackTrace();
}
return markerOptions;
}
private static BitmapDescriptor getBitmapDescriptorFromMogo(MogoMarkerOptions options) {
if (options == null) {
return null;

View File

@@ -1,5 +1,6 @@
package com.mogo.map;
import com.mogo.eagle.core.data.traffic.TrafficData;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.map.overlay.IMogoPolyline;
@@ -39,6 +40,29 @@ public interface IMogoMap {
*/
IMogoMarker addMarker( String tag, MogoMarkerOptions options );
/**
* 批量更新锚点位置
*
* @param optionsArrayList 锚点集合
*/
void updateBatchMarkerPositon(ArrayList<TrafficData> optionsArrayList);
/**
* 添加感知使用到的3d模型
*
* @param type
* @param modelRes
*/
String addPreVehicleModel(int type, int modelRes);
/**
* 要移除的感知数据uuid
*
* @param uuidString
*/
void removeMarker(String uuidString);
/**
* 在地图上添一组图片标记marker对象并设置是否改变地图状态以至于所有的marker对象都在当前地图可视区域范围内显示。
*

View File

@@ -3,6 +3,7 @@ package com.mogo.map.marker;
import android.content.Context;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.traffic.TrafficData;
import java.util.ArrayList;
import java.util.List;
@@ -34,6 +35,26 @@ public interface IMogoMarkerManager {
*/
List< IMogoMarker > addMarkers( String tag, ArrayList< MogoMarkerOptions > options, boolean moveToCenter );
/**
* 批量更新锚点位置
* @param optionsArrayList 锚点集合
*/
void updateBatchMarkerPosition(ArrayList<TrafficData> optionsArrayList);
/**
* 添加感知使用到的3d模型
* @param type
* @param modelRes
*/
String addPreVehicleModel(int type,int modelRes);
/**
* 要移除的感知数据uuid
*
* @param uuidString
*/
void removeMarker(String uuidString);
/**
* 移除某一个类型、某个模块的 markers
*

View File

@@ -20,6 +20,9 @@ import java.util.Observable;
*/
public class MogoMarkerOptions extends Observable {
// marker 唯一标记
private String uuid;
private int markerType;
private double latitude;
private double longitude;
// 设置 Marker覆盖物 的标题
@@ -94,7 +97,23 @@ public class MogoMarkerOptions extends Observable {
*/
private boolean mMatchOnRoadSide = true;
public MogoMarkerOptions matchOnRoadSide( boolean matchOnRoadSide ) {
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public int getMarkerType() {
return markerType;
}
public void setMarkerType(int markerType) {
this.markerType = markerType;
}
public MogoMarkerOptions matchOnRoadSide(boolean matchOnRoadSide ) {
this.mMatchOnRoadSide = matchOnRoadSide;
return this;
}
@@ -404,7 +423,9 @@ public class MogoMarkerOptions extends Observable {
@Override
public String toString() {
return "MogoMarkerOptions{" +
"latitude=" + latitude +
"uuid='" + uuid + '\'' +
", markerType=" + markerType +
", latitude=" + latitude +
", longitude=" + longitude +
", title='" + title + '\'' +
", snippet='" + snippet + '\'' +
@@ -416,7 +437,7 @@ public class MogoMarkerOptions extends Observable {
", visible=" + visible +
", inifoWindowEnable=" + inifoWindowEnable +
", alpha=" + alpha +
" ,scale=" + scale+
", scale=" + scale +
", isGps=" + isGps +
", u=" + u +
", v=" + v +
@@ -424,6 +445,16 @@ public class MogoMarkerOptions extends Observable {
", offsetX=" + offsetX +
", offsetY=" + offsetY +
", zIndex=" + zIndex +
", mIconView=" + mIconView +
", mOwner='" + mOwner + '\'' +
", mObject=" + mObject +
", mAutoManager=" + mAutoManager +
", mIcon3DRes=" + mIcon3DRes +
", mAnchorColor='" + mAnchorColor + '\'' +
", mIs3DMode=" + mIs3DMode +
", mIsControlAngle=" + mIsControlAngle +
", mResName='" + mResName + '\'' +
", mMatchOnRoadSide=" + mMatchOnRoadSide +
'}';
}
}

View File

@@ -3,6 +3,7 @@ package com.mogo.map;
import android.content.Context;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.traffic.TrafficData;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerManager;
import com.mogo.map.marker.MogoMarkerOptions;
@@ -51,6 +52,7 @@ public class MogoMarkerManager implements IMogoMarkerManager {
try {
return MogoMap.getInstance().getMogoMap().addMarker( tag, options );
} catch ( Exception e ) {
e.printStackTrace();
return null;
}
}
@@ -60,10 +62,39 @@ public class MogoMarkerManager implements IMogoMarkerManager {
try {
return MogoMap.getInstance().getMogoMap().addMarkers( tag, options, moveToCenter );
} catch ( Exception e ) {
e.printStackTrace();
return null;
}
}
@Override
public void updateBatchMarkerPosition(ArrayList<TrafficData> optionsArrayList) {
try {
MogoMap.getInstance().getMogoMap().updateBatchMarkerPositon(optionsArrayList);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public String addPreVehicleModel(int type, int modelRes) {
try {
return MogoMap.getInstance().getMogoMap().addPreVehicleModel(type, modelRes);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
@Override
public void removeMarker(String uuidString) {
try {
MogoMap.getInstance().getMogoMap().removeMarker(uuidString);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void removeMarkers( String tag ) {

View File

@@ -45,7 +45,7 @@ public class AdasEventManager implements
OnAdasMsgConnectStatusListener,
IMoGoAutopilotStatusListener,
IMoGoAutopilotPlanningListener,
IMoGoAutopilotIdentifyListener ,
IMoGoAutopilotIdentifyListener,
IMoGoAutopilotCarStateListener {
private final String TAG = "AdasEventManager";
@@ -235,20 +235,13 @@ public class AdasEventManager implements
@Override
public void onAutopilotIdentifyDataUpdate(@Nullable ArrayList<TrafficData> trafficData) {
try {
if (trafficData == null) {
IdentifyDataDrawer.getInstance().clearOldMarker();
} else {
if (FunctionBuildConfig.isDrawIdentifyData) {
ThreadUtils.getSinglePool().execute(() ->
IdentifyDataDrawer.getInstance().renderAdasRecognizedResult(trafficData)
);
} else {
IdentifyDataDrawer.getInstance().clearOldMarker();
}
if (FunctionBuildConfig.isDrawIdentifyData) {
ThreadUtils.getSinglePool().execute(() ->
IdentifyDataDrawer.getInstance().renderAdasRecognizedResult(trafficData)
);
}
} catch (Exception e) {
e.printStackTrace();
IdentifyDataDrawer.getInstance().clearOldMarker();
}
}

View File

@@ -1,35 +1,27 @@
package com.mogo.module.common.drawer;
import static com.mogo.cloud.socket.entity.SocketDownDataHelper.FROM_ADAS;
import static java.lang.Math.PI;
import android.content.Context;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import android.view.ViewGroup;
import android.widget.TextView;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.R;
import com.mogo.module.common.constants.AdasRecognizedType;
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter;
import com.mogo.module.common.drawer.bean.SpeedData;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
/*
/**
* @author congtaowang
* @since 2020/10/30
* <p>
@@ -42,21 +34,6 @@ public class BaseDrawer {
*/
public static final int MSG_REMOVE_DIRTY_MARKERS = 9990;
/**
* 地图刷新频率
*/
public static final int MAP_RENDER_FRAME_FREQUENCY = 30;
/**
* 显示速度
*/
public static final int MSG_DISPLAY_SPEED = 11;
/**
* 移动点的时间间隔
*/
public static final int MAP_MARKER_MOVE_INTERVAL = MAP_RENDER_FRAME_FREQUENCY;
/**
* 地图内部资源md5缓存便于资源复用
*/
@@ -64,77 +41,8 @@ public class BaseDrawer {
protected final Context mContext;
private static TextView mSpeedView;
public BaseDrawer() {
mContext = AbsMogoApplication.getApp();
initWorkThreadHandler();
initView();
}
private void initView() {
if (mSpeedView == null) {
mSpeedView = new TextView(mContext);
mSpeedView.setSingleLine(false);
mSpeedView.setTextColor(Color.WHITE);
mSpeedView.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
mSpeedView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
}
}
private static Handler mWorkThreadHandler;
protected static Handler mRenderThreadHandler = null;
/**
* 处理 marker 移除的线程
*/
private static void initWorkThreadHandler() {
if (mWorkThreadHandler == null) {
mWorkThreadHandler = new Handler(WorkThreadHandler.newInstance("3d-marker-work-thread").getLooper()) {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
if (msg.what == MSG_REMOVE_DIRTY_MARKERS) {
if (msg.obj instanceof Map) {
removeDirtyMarkers(((Map) msg.obj));
Set<String> key = ((Map) msg.obj).keySet();
for (String id : key) {
// 清除道路缓存
clearRoadCacheById(id);
}
} else if (msg.obj instanceof String) {
MogoApisHandler.getInstance().getApis()
.getMapServiceApi()
.getMarkerManager(AbsMogoApplication.getApp())
.removeMarkers(((String) msg.obj));
}
}
}
};
}
if (mRenderThreadHandler == null) {
mRenderThreadHandler = new Handler(WorkThreadHandler.newInstance("render-thread-" + new Random().nextLong()).getLooper()) {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
if (msg.what == MSG_DISPLAY_SPEED) {
if (msg.obj instanceof SpeedData) {
showSpeed((SpeedData) msg.obj);
}
}
}
};
}
}
public static void showSpeed(SpeedData speedData) {
showIdentitySpeed(speedData.getMarker()
, speedData.getSpeed()
, speedData.getUuid()
, speedData.getType()
, speedData.getHeading()
, speedData.getIsVrMode());
}
/**
@@ -162,10 +70,7 @@ public class BaseDrawer {
* @param data 数据体
*/
public void sendMessage(int msg, Object data) {
Message message = Message.obtain();
message.what = msg;
message.obj = data;
mWorkThreadHandler.sendMessage(message);
}
/**
@@ -185,20 +90,6 @@ public class BaseDrawer {
&& recognizedType != AdasRecognizedType.classIdUnKnow;
}
/**
* 是否展示车速UUID以及类型
*
* @param type {@link AdasRecognizedType}
* @return showSpeed
*/
public boolean shouldShowSpeed(int type) {
return true; //todo 验证行人预警,对行人和自行车不做infoWindow过滤
// AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type);
// return recognizedType != AdasRecognizedType.classIdPerson;
// &&recognizedType != AdasRecognizedType.classIdBicycle //todo Bicycle显示
// && recognizedType != AdasRecognizedType.classIdMoto //todo moto显示
}
/**
* 获取3D锚点模型资源
*
@@ -258,19 +149,6 @@ public class BaseDrawer {
return Car3DModelColor.Normal.color;
}
/**
* 返回当前自车速度
*
* @return isCurSpeed
*/
protected double getCurSpeed() {
double speed = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastSpeed();
if (speed <= 0) {
speed = SnapshotLocationDataCenter.getInstance().getCurSpeed();
}
return speed;
}
/**
* 返回当前自车经纬度
*
@@ -305,45 +183,15 @@ public class BaseDrawer {
* 模型颜色
*/
public enum Car3DModelColor {
Normal("#D8D8D8FF"),
Warming("#FFD53EFF"),
Dangerous("#FF3C45FF"),
Error("#7fb80e");
private final String color;
Car3DModelColor(String color) {
this.color = color;
}
}
/**
* 展示车辆速度
*
* @param mogoMarker {@link IMogoMarker}
* @param speed 是否显示速度
* @param isVrMode 是否是vrMode
*/
public static void showIdentitySpeed(IMogoMarker mogoMarker, double speed, String uuid,
int type, double heading, boolean isVrMode) {
Log.d("EmArrow", "showSelf uuid : " + uuid + " speed : " + speed);
if (mogoMarker == null || mogoMarker.isDestroyed()) {
return;
}
if (!isVrMode) {
mogoMarker.hideInfoWindow();
return;
}
int speedIntVal = (int) (speed * 3.6);
mogoMarker.setInfoWindowOffset(0, 20);
String text = "uuid : " + uuid + "\n"
+ "speed : " + speedIntVal + "\n"
+ "type : " + type + "\n"
+ "heading : " + heading;
mSpeedView.setText(text);
mogoMarker.updateInfoWindowView(mSpeedView);
}
/**
@@ -386,35 +234,6 @@ public class BaseDrawer {
mMarkerCachesResMd5Values.put(id, md5);
}
/**
* 道路匹配到车道中心点
*
* @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();
double[] matchRoad = MogoApisHandler.getInstance()
.getApis()
.getMapServiceApi()
.getMapUIController()
.matchRoad(id, lon, lat, angle, true, isRtk);
Log.i("timer-matchRoad", "cost " + (System.currentTimeMillis() - start) + "ms");
return matchRoad;
}
/**
* 清理缓存路段数据
*
* @param id 缓存数据Key
*/
public static void clearRoadCacheById(String id) {
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().clearRoadCacheById(id);
}
/**
* 使用系统时间或卫星时间计算出动画的运动时间最小值45防止两个点距离过近设置的最小动画执行时间
*
@@ -435,53 +254,4 @@ public class BaseDrawer {
return interval;
}
/**
* 根据位置信息、车头朝向计算道路吸附
*
* @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,
lat,
heading,
true
);
boolean match;
if (matchedPoint != null) {
// Logger.d( TAG, "matchPoint %s distance = %s",lineCounter, matchedPoint[2] );
match = matchedPoint[2] < 1 && matchedPoint[2] > 0;
if (lastLon != -1) {
double clearAngle;
if (heading > 0 && heading <= 90) {
clearAngle = heading;
} else if (heading > 90 && heading <= 180) {
clearAngle = 180 - heading;
} else if (heading > 180 && heading <= 270) {
clearAngle = heading - 180;
} else {
clearAngle = 360 - heading;
}
double _angle = Math.atan2(Math.abs(matchedPoint[0] - lastLon), Math.abs(matchedPoint[1] - lastLat)) * (180 / PI);
_angle = Math.abs(clearAngle - _angle);
// Logger.d(TAG, "matchPoint %s angel = %s", lineCounter, _angle);
if (_angle > 22.5) {
match = false;
}
}
if (match) {
lon = matchedPoint[0];
lat = matchedPoint[1];
}
}
return new double[]{lon, lat};
}
}

View File

@@ -1,46 +1,42 @@
package com.mogo.module.common.drawer;
import static com.mogo.cloud.socket.entity.SocketDownDataHelper.FROM_ADAS;
import android.text.TextUtils;
import android.content.Context;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.enums.TrafficTypeEnum;
import com.mogo.eagle.core.data.traffic.TrafficData;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.constants.AdasRecognizedType;
import com.mogo.module.common.constants.DataTypes;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.logger.Logger;
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 xiaoyuzhou
* @date 2021/10/19 10:45 上午
* 域控制器识别信息绘制
*/
public class IdentifyDataDrawer extends BaseDrawer {
public class IdentifyDataDrawer {
private static final String TAG = "IdentifyDataDrawer";
protected final Context mContext;
private static volatile IdentifyDataDrawer sInstance;
/**
* 上一帧数据的缓存
*/
private static Map<String, IMogoMarker> mMarkersCaches = new ConcurrentHashMap<>();
private static ConcurrentHashMap<String, TrafficData> mMarkersCaches = new ConcurrentHashMap<>();
/**
* 最后一帧数据的缓存
* 已经感知不到的脏数据
*/
private final Map<String, TrafficData> mLastPositions = new ConcurrentHashMap<>();
private final ConcurrentHashMap<String, TrafficData> mDirtyPositions = new ConcurrentHashMap<>();
private IdentifyDataDrawer() {
super();
mContext = AbsMogoApplication.getApp();
addPreVehicleModel();
}
public static IdentifyDataDrawer getInstance() {
@@ -63,10 +59,10 @@ public class IdentifyDataDrawer extends BaseDrawer {
*
* @param resultList adas感知融合数据
*/
public void renderAdasRecognizedResult(List<TrafficData> resultList) {
final long start = System.nanoTime();
public void renderAdasRecognizedResult(ArrayList<TrafficData> resultList) {
if (resultList == null || resultList.isEmpty() || !DebugConfig.isUseAdasRecognize()) {
clearOldMarker();
Logger.w(TAG, "感知数据为空无需渲染……");
return;
}
@@ -76,186 +72,35 @@ public class IdentifyDataDrawer extends BaseDrawer {
return;
}
Map<String, IMogoMarker> newAdasRecognizedMarkersCaches = new ConcurrentHashMap<>();
List<TrafficData> newDiffSet = new ArrayList<>();
for (TrafficData recognizedListResult : resultList) {
// 循环将集合中的数据提取记录
ArrayList<String> trafficDataUuidList = new ArrayList<>();
for (TrafficData trafficData : resultList) {
trafficDataUuidList.add(trafficData.getUuid());
}
if (isUselessValue(recognizedListResult)) {
continue;
}
if (AdasRecognizedType.valueFrom(recognizedListResult.getType().getType()) == AdasRecognizedType.classIdUnKnow) {
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);
// 找出上一针数据中已经不在本次数据中存在的数据
for (String uuid : mMarkersCaches.keySet()) {
if (!trafficDataUuidList.contains(uuid)) {
mDirtyPositions.put(uuid, mMarkersCaches.get(uuid));
}
}
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);
if (AdasRecognizedType.valueFrom(recognizedListResult.getType().getType()) == AdasRecognizedType.classIdUnKnow) {
continue;
}
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(TAG, "ADAS数据延时绘制 render 接收数据 -> 处理结束 " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start)) + "ms");
}
/**
* todo 后面涉及到此类变化的数据均改动
* 更新缓存Marker的资源
*
* @param marker
* @param recognizedListResult
*/
private void updateCacheMarkerRes(IMogoMarker marker, TrafficData recognizedListResult) {
// 获取3D资源文件
int resId = getModelRes(recognizedListResult.getType().getType());
String 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);
}
}
/**
* // todo 最好重新设计一个数据结构用于多线程数据过期失效的场景参见redis数据过期
* 移除工控机长时间没有下发的数据
*/
private void removeUselessLastRecord() {
if (mLastPositions.isEmpty()) {
return;
}
Iterator<TrafficData> iterator = mLastPositions.values().iterator();
// Log.d(TAG, "EmArrow removeUselessLastRecord size : " + mLastPositions.size());
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();
TrafficData lastPosition = mLastPositions.remove(uniqueKey);
mLastPositions.put(uniqueKey, recognizedListResult);
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(TAG, "ADAS动画数据 cost : " + cost);
final long intervalRef = interval - cost;
//Log.d(TAG, "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.getType().getType())) {
// SpeedData speedData = new SpeedData(marker
// , recognizedListResult.getSpeed()
// , recognizedListResult.getUuid()
// , recognizedListResult.getType().getType()
// , recognizedListResult.getHeading()
// , MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode());
// showSpeed(speedData);
// // 移除脏数据
// for (String uuid : mDirtyPositions.keySet()) {
// MogoApisHandler.getInstance().getApis()
// .getMapServiceApi()
// .getMarkerManager(mContext)
// .removeMarker(uuid);
// }
// 绘制新数据
MogoApisHandler.getInstance().getApis()
.getMapServiceApi()
.getMarkerManager(mContext)
.updateBatchMarkerPosition(resultList);
}
/**
* 创建一个新 marker
*
* @param recognizedListResult {@link TrafficData}
* @return {@link IMogoMarker}
*/
private IMogoMarker drawAdasRecognizedDataMarker(TrafficData recognizedListResult) {
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 = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(DataTypes.TYPE_MARKER_ADAS, options);
cacheMarkerIconResMd5Val(resIdVal, marker);
return marker;
}
/**
* 清除旧的 marker 数据
@@ -264,7 +109,48 @@ public class IdentifyDataDrawer extends BaseDrawer {
if (mMarkersCaches != null) {
mMarkersCaches.clear();
}
mLastPositions.clear();
sendMessage(MSG_REMOVE_DIRTY_MARKERS, DataTypes.TYPE_MARKER_ADAS);
}
private void addPreVehicleModel() {
Logger.d(TAG, "添加感知模型到地图中……");
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI, "添加感知模型到地图中……preVehicleStrWeiZhi=");
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_PEOPLE, "添加感知模型到地图中……preVehicleStrPeople=");
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_BICYCLE, "添加感知模型到地图中……preVehicleStrBicycle=");
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_TA_CHE, "添加感知模型到地图中……preVehicleStrTaChe=");
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_MOTO, "添加感知模型到地图中……preVehicleStrMoto=");
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_BUS, "添加感知模型到地图中……preVehicleStrBus=");
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_TRUCK, "添加感知模型到地图中……preVehicleStrTruck=");
}
/**
* 添加模型到地图中
*
* @param typeTrafficIdWeiZhi
* @param s
*/
private void addPreVehicleModelWeiZhi(TrafficTypeEnum typeTrafficIdWeiZhi, String s) {
String preVehicleStrWeiZhi = MogoApisHandler.getInstance().getApis()
.getMapServiceApi()
.getMarkerManager(mContext)
.addPreVehicleModel(typeTrafficIdWeiZhi.getType(),
typeTrafficIdWeiZhi.getTraffic3DIconId());
Logger.d(TAG, s + preVehicleStrWeiZhi);
if (preVehicleStrWeiZhi == null) {
UiThreadHandler.postDelayed(new Runnable() {
@Override
public void run() {
Logger.w(TAG, "添加感知模型到地图中失败,尝试重复添加……");
addPreVehicleModelWeiZhi(typeTrafficIdWeiZhi, s);
}
}, 1000L);
}
}
}

View File

@@ -45,13 +45,13 @@ class MogoMainService extends Service implements IMogoLocationListener {
mServiceApis = MogoApisHandler.getInstance().getApis();
initAndStartLocation();
UiThreadHandler.postDelayed(() -> {
Logger.d(TAG, "4秒已过,启动基础服务……");
Logger.d(TAG, "5秒已过,启动基础服务……");
loadBaseModules();
startTanluService();
initADAS();
initGpsSimulatorListener();
HdMapBuildConfig.isMapLoaded = true;
}, 4_000L
}, 5_000L
);
// 开启延时检测
DelayCheckUtil delayCheckUtil = new DelayCheckUtil(this);

View File

@@ -900,7 +900,7 @@ public class MockIntentHandler implements IntentHandler {
}
}
List<TrafficData> trafficData = new ArrayList<>();
ArrayList<TrafficData> trafficData = new ArrayList<>();
for (BufferedReader reader : readers) {
String line = reader.readLine();
TrafficData adasRecognizedResult = GsonUtil.objectFromJson(line, TrafficData.class);
@@ -936,7 +936,7 @@ public class MockIntentHandler implements IntentHandler {
}
}
List<TrafficData> trafficData = new ArrayList<>();
ArrayList<TrafficData> trafficData = new ArrayList<>();
for (BufferedReader reader : readers2) {
String line = reader.readLine();
TrafficData adasRecognizedResult = GsonUtil.objectFromJson(line, TrafficData.class);

View File

@@ -113,8 +113,10 @@ public class MogoRouteOverlayManager implements IMoGoAutopilotPlanningListener,
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autoPilotStatusInfo) {
this.STATUS_AUTOPILOT = autoPilotStatusInfo.getControl_pilotmode();
//Log.d("lianglihui","onAutopilotStatusResponse:"+STATUS_AUTOPILOT);
if (STATUS_AUTOPILOT == 1 && mEnding != null){
RouteOverlayDrawer.getInstance(mContext).addEndingMarker(mEnding.lat,mEnding.lon);
if (STATUS_AUTOPILOT == 1 ){
if (mEnding != null){
RouteOverlayDrawer.getInstance(mContext).addEndingMarker(mEnding.lat,mEnding.lon);
}
}else {
RouteOverlayDrawer.getInstance(mContext).clearEndingMarker();
RouteOverlayDrawer.getInstance(mContext).clearMogoRouteOverlay();

View File

@@ -89,9 +89,9 @@ public class RouteOverlayDrawer {
markderOptions.latitude(lat).longitude(lon);
//Log.d("lianglihui","addEndingMarker-"+lat+":"+lon);
endMarker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerType, markderOptions);
if (DebugConfig.isDebug()){
ToastUtils.showLong("绘制终点marker,"+lat+":"+lon);
}
// if (DebugConfig.isDebug()){
// ToastUtils.showLong("绘制终点marker,"+lat+":"+lon);
// }
}
public void clearMogoRouteOverlay(){