opt
This commit is contained in:
@@ -22,7 +22,7 @@ enum AdasRecognizedType {
|
||||
classIdTrafficSign( "traffic_sign", 5 ),
|
||||
//bus
|
||||
classIdTrafficBus( "traffic_bus", 6 ),
|
||||
//track
|
||||
//truck
|
||||
classIdTrafficTruck( "traffic_truck", 8 );
|
||||
|
||||
AdasRecognizedType( int code ) {
|
||||
|
||||
@@ -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 ) ) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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" );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user