This commit is contained in:
wangcongtao
2020-12-22 11:21:53 +08:00
parent 181ab87807
commit ea3518b676
23 changed files with 130 additions and 37 deletions

View File

@@ -54,7 +54,7 @@ public class AppsFragment extends MvpFragment< AppsView, AppsPresenter > impleme
mIndicator = findViewById( R.id.module_apps_id_indicator );
mIndicator.setOpenPadding( true );
ViewPagerSpeedScroller.attach(getContext(), mAppsPager, 1000);
// ViewPagerSpeedScroller.attach(getContext(), mAppsPager, 1000);
}
@NonNull

View File

@@ -22,7 +22,7 @@ enum AdasRecognizedType {
classIdTrafficSign( "traffic_sign", 5 ),
//bus
classIdTrafficBus( "traffic_bus", 6 ),
//track
//truck
classIdTrafficTruck( "traffic_truck", 8 );
AdasRecognizedType( int code ) {

View File

@@ -13,6 +13,7 @@ import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.R;
import com.mogo.module.common.constants.AdasRecognizedType;
import com.mogo.module.common.constants.DataTypes;
import com.mogo.service.adas.entity.ADASRecognizedListResult;
import com.mogo.utils.ViewUtils;
@@ -79,6 +80,12 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
if ( recognizedListResult == null ) {
continue;
}
// 暂时只显示车辆
if ( isCarType( recognizedListResult.type ) ) {
continue;
}
IMogoMarker marker = null;
String uniqueKey = recognizedListResult.uuid;
if ( TextUtils.isEmpty( uniqueKey ) ) {

View File

@@ -2,6 +2,7 @@ package com.mogo.module.common.drawer;
import com.mogo.map.CoordinatesTransformer;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.constants.AdasRecognizedType;
import com.mogo.module.common.constants.CarModelType;
import com.mogo.module.common.constants.SafeType;
@@ -83,4 +84,14 @@ class BaseDrawer {
}
return mTransformer.transform( lat, lon );
}
protected boolean isCarType( int type ) {
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom( type );
if ( recognizedType != AdasRecognizedType.classIdCar
|| recognizedType != AdasRecognizedType.classIdTrafficBus
|| recognizedType != AdasRecognizedType.classIdTrafficTruck ) {
return false;
}
return true;
}
}

View File

@@ -10,14 +10,18 @@ import android.widget.ImageView;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.map.MogoLatLng;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.R;
import com.mogo.module.common.api.CallChatApi;
import com.mogo.module.common.constants.DataTypes;
import com.mogo.module.common.entity.CloudRoadData;
import com.mogo.module.common.entity.MogoSnapshotSetData;
import com.mogo.utils.ViewUtils;
import com.mogo.utils.logger.Logger;
import com.zhidao.carchattingprovider.ICarsChattingProvider;
import com.zhidao.carchattingprovider.MogoDriverInfo;
import java.util.ArrayList;
import java.util.HashMap;
@@ -32,7 +36,7 @@ public
*
* 云端数据绘制
*/
class SnapshotSetDataDrawer extends BaseDrawer {
class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListener {
private static final String TAG = "SnapshotSetDataDrawer";
@@ -84,8 +88,7 @@ class SnapshotSetDataDrawer extends BaseDrawer {
boolean machineVision ) {
if ( data == null || (
( data.getAllList() == null || data.getAllList().isEmpty() ) &&
( data.getNearList() == null || data.getNearList().isEmpty() )
) ) {
( data.getNearList() == null || data.getNearList().isEmpty() ) ) ) {
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( AbsMogoApplication.getApp() ).removeMarkers( DataTypes.TYPE_MARKER_CLOUD_DATA );
return;
}
@@ -101,12 +104,21 @@ class SnapshotSetDataDrawer extends BaseDrawer {
mPurseCounter++;
if ( mPurseCounter >= 100 ) {
mPurseCounter = 0;
purgeCloudSnapshotData( allDatumsList );
}
purgeCloudSnapshotData( allDatumsList );
for ( CloudRoadData cloudRoadData : allDatumsList ) {
if ( cloudRoadData == null ) {
continue;
}
// 暂时只显示车辆
if ( TextUtils.isEmpty( cloudRoadData.getSn() ) ) {
if ( isCarType( cloudRoadData.getType() ) ) {
continue;
}
}
IMogoMarker marker = null;
String uniqueKey = cloudRoadData.getUniqueKey();
if ( TextUtils.isEmpty( uniqueKey ) ) {
@@ -121,6 +133,9 @@ class SnapshotSetDataDrawer extends BaseDrawer {
if ( marker == null ) {
continue;
}
if ( !TextUtils.isEmpty( cloudRoadData.getSn() ) ) {
bindClickListener( marker );
}
mCloudSnapshotMarkersCaches.put( uniqueKey, marker );
} else {
if ( mIsVrMode != MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
@@ -128,6 +143,7 @@ class SnapshotSetDataDrawer extends BaseDrawer {
if ( mIsVrMode ) {
marker.use3DResource( getVrModel( cloudRoadData ) );
} else {
marker.getMogoMarkerOptions().set3DMode( false );
marker.setIcon( ViewUtils.fromView( inflateView( cloudRoadData, machineVision, 0 ) ) );
}
}
@@ -142,7 +158,7 @@ class SnapshotSetDataDrawer extends BaseDrawer {
List< MogoLatLng > points = new ArrayList<>();
points.add( new MogoLatLng( lastPosition.lat, lastPosition.lon ) );
points.add( new MogoLatLng( target.lat, target.lon ) );
marker.startSmoothInMs( points, SystemClock.elapsedRealtime() - mLastReceiveTime );
marker.startSmoothInMs( points, 500L );
}
} else {
marker.setRotateAngle( 360 - ( float ) cloudRoadData.getHeading() );
@@ -154,6 +170,13 @@ class SnapshotSetDataDrawer extends BaseDrawer {
}
}
private void bindClickListener( IMogoMarker marker ) {
if ( marker == null || marker.isDestroyed() ) {
return;
}
marker.setOnMarkerClickListener( this );
}
/**
* 过滤本次数据中,不存在的 marker
*
@@ -206,6 +229,7 @@ class SnapshotSetDataDrawer extends BaseDrawer {
.owner( DataTypes.TYPE_MARKER_CLOUD_DATA )
.anchor( 0.5f, 0.5f )
.rotate( ( float ) data.getHeading() )
.object( data )
// .position( new MogoLatLng( coor[POS_LAT], coor[POS_LON] ) );
.position( new MogoLatLng( data.getLat(), data.getLon() ) );
if ( mIsVrMode = MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
@@ -256,4 +280,32 @@ class SnapshotSetDataDrawer extends BaseDrawer {
return R.drawable.icon_map_marker_car_gray;
}
}
@Override
public boolean onMarkerClicked( IMogoMarker marker ) {
if ( marker != null && !marker.isDestroyed() ) {
if ( marker.getObject() instanceof CloudRoadData ) {
showCarCallPanel( ( ( CloudRoadData ) marker.getObject() ) );
}
}
return true;
}
private void showCarCallPanel( CloudRoadData data ) {
MogoDriverInfo driverInfo = new MogoDriverInfo();
driverInfo.setLat( data.getLat() );
driverInfo.setLon( data.getLon() );
driverInfo.setSn( data.getSn() );
ICarsChattingProvider carChatting = CallChatApi.getInstance().getApiProvider();
if ( carChatting != null ) {
try {
carChatting.showUserWindow( TAG, driverInfo, mContext );
} catch ( Exception e ) {
Logger.e( TAG, e, "showCarCallPanel" );
}
}
}
}

View File

@@ -22,6 +22,7 @@ import com.mogo.module.common.R;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.ViewUtils;
import com.mogo.utils.glide.GlideApp;
import com.mogo.utils.storage.SharedPrefsMgr;
/**
* 自车图标工具类
@@ -44,6 +45,10 @@ public class MyLocationUtil {
private static final CarCursorOption DEFAULT_OPTION = new CarCursorOption.Builder()
.build();
public static void setMyLocationIconUrl(Context context){
setMyLocationIconUrl( context, SharedPrefsMgr.getInstance( context ).getString( "MY_LOCATION_CONFIG", "" ) );
}
public static void setMyLocationIconUrl(Context context, String url) {
if (url == null || url.isEmpty()) {
return;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -1066,7 +1066,7 @@
<dimen name="module_service_marker_dot_marginTop">4dp</dimen>
<dimen name="module_service_marker_bubble_width">100px</dimen>
<dimen name="module_service_marker_bubble_vr_width">55px</dimen>
<dimen name="module_service_marker_bubble_height">117px</dimen>
<dimen name="module_service_marker_bubble_height">130px</dimen>
<dimen name="module_service_marker_bubble_vr_height">69px</dimen>
<dimen name="module_service_marker_bubble_icon_width">60px</dimen>
<dimen name="module_service_marker_bubble_icon_height">60px</dimen>

View File

@@ -9,6 +9,7 @@ import com.mogo.map.navi.IMogoNavi;
import com.mogo.map.overlay.IMogoOverlayManager;
import com.mogo.map.search.geo.IMogoGeoSearch;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.analytics.IMogoAnalytics;
@@ -75,7 +76,7 @@ public class ExtensionServiceManager {
isInit = true;
mContext = context;
mMogoServiceApis = (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context);
mMogoServiceApis = MogoApisHandler.getInstance().getApis();
mMapService = mMogoServiceApis.getMapServiceApi();
mImageLoader = mMogoServiceApis.getImageLoaderApi();

View File

@@ -72,7 +72,7 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > implements
mMogoMap.getUIController().recoverLockMode();// 启动锁车
}
// 根据本地配置设置自车图标
MyLocationUtil.setMyLocationIconUrl( getContext(), SharedPrefsMgr.getInstance( getContext() ).getString( "MY_LOCATION_CONFIG", "" ) );
MyLocationUtil.setMyLocationIconUrl( getContext() );
}
@NonNull

View File

@@ -59,6 +59,7 @@ public class MogoRTKLocation {
}
private void sendLocationData() {
if (rtkLocationListener != null) {
List<CloudLocationInfo> list = new ArrayList<>(cacheList);
rtkLocationListener.onLocationChanged(list);

View File

@@ -102,6 +102,12 @@ class SnapshotUploadInTime implements MogoRTKLocation.RTKLocationListener {
content.self = locationResult;
content.adas = recognizedResults;
if ( content.self == null &&
( content.adas == null || content.adas.isEmpty() ) ) {
return;
}
MarkerServiceHandler.getApis().getWebSocketManagerApi( mContext ).sendMsg( content, new IMogoOnWebSocketMessageListener() {
@Override
public WebSocketMsgType getDownLinkType() {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB