opt
This commit is contained in:
@@ -76,12 +76,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
boolean machineVision,
|
||||
double curSpeed ) {
|
||||
if ( resultList == null || resultList.isEmpty() ) {
|
||||
MogoApisHandler.getInstance().getApis()
|
||||
.getMapServiceApi()
|
||||
.getMarkerManager( mContext )
|
||||
.removeMarkers( DataTypes.TYPE_MARKER_ADAS );
|
||||
mAdasRecognizedMarkersCaches.clear();
|
||||
mLastPositions.clear();
|
||||
clearOldMarker();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -166,9 +161,17 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
}
|
||||
|
||||
public void notifyVrModeChanged() {
|
||||
sendMessage( MSG_REMOVE_DIRTY_MARKERS, mAdasRecognizedMarkersCaches );
|
||||
mAdasRecognizedMarkersCaches = new ConcurrentHashMap<>();
|
||||
mLastPositions.clear();
|
||||
clearOldMarker();
|
||||
}
|
||||
|
||||
private void clearOldMarker() {
|
||||
if ( mAdasRecognizedMarkersCaches != null ) {
|
||||
mAdasRecognizedMarkersCaches.clear();
|
||||
}
|
||||
if ( mLastPositions != null ) {
|
||||
mLastPositions.clear();
|
||||
}
|
||||
sendMessage( MSG_REMOVE_DIRTY_MARKERS, DataTypes.TYPE_MARKER_ADAS );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,11 +8,13 @@ import android.os.Message;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.CoordinatesTransformer;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
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.DataTypes;
|
||||
import com.mogo.module.common.constants.SafeType;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
|
||||
@@ -39,7 +41,6 @@ class BaseDrawer {
|
||||
|
||||
// 移除过期的 marker
|
||||
public static final int MSG_REMOVE_DIRTY_MARKERS = 9990;
|
||||
public static final int MSG_REMOVE_SNAPSHOT_MARKERS = 9991;
|
||||
public static final int MSG_REMOVE_ADAS_MARKERS = 9992;
|
||||
|
||||
public BaseDrawer() {
|
||||
@@ -64,6 +65,11 @@ class BaseDrawer {
|
||||
if ( msg.what == MSG_REMOVE_DIRTY_MARKERS ) {
|
||||
if ( msg.obj instanceof Map ) {
|
||||
removeDirtyMarkers( ( ( Map ) msg.obj ) );
|
||||
} else if ( msg.obj instanceof String ) {
|
||||
MogoApisHandler.getInstance().getApis()
|
||||
.getMapServiceApi()
|
||||
.getMarkerManager( AbsMogoApplication.getApp() )
|
||||
.removeMarkers( ( ( String ) msg.obj ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mogo.module.common.drawer;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
@@ -103,23 +104,27 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
private boolean clear( MogoSnapshotSetData data ) {
|
||||
if ( !MogoApisHandler.getInstance().getApis().getStatusManagerApi().isMainPageLaunched() ) {
|
||||
if ( mCloudSnapshotMarkersCaches == null ) {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
MogoApisHandler.getInstance().getApis()
|
||||
.getMapServiceApi().getMarkerManager( mContext )
|
||||
.removeMarkers( DataTypes.TYPE_MARKER_CLOUD_DATA );
|
||||
mCloudSnapshotMarkersCaches.clear();
|
||||
mLastPositions.clear();
|
||||
if ( mCloudSnapshotMarkersCaches != null ) {
|
||||
mCloudSnapshotMarkersCaches.clear();
|
||||
}
|
||||
if ( mLastPositions != null ) {
|
||||
mLastPositions.clear();
|
||||
}
|
||||
sendMessage( MSG_REMOVE_DIRTY_MARKERS, DataTypes.TYPE_MARKER_CLOUD_DATA );
|
||||
return true;
|
||||
}
|
||||
if ( data == null || (
|
||||
( data.getAllList() == null || data.getAllList().isEmpty() ) &&
|
||||
( data.getNearList() == null || data.getNearList().isEmpty() ) ) ) {
|
||||
MogoApisHandler.getInstance().getApis()
|
||||
.getMapServiceApi().getMarkerManager( mContext )
|
||||
.removeMarkers( DataTypes.TYPE_MARKER_CLOUD_DATA );
|
||||
mCloudSnapshotMarkersCaches.clear();
|
||||
mLastPositions.clear();
|
||||
if ( mCloudSnapshotMarkersCaches != null ) {
|
||||
mCloudSnapshotMarkersCaches.clear();
|
||||
}
|
||||
if ( mLastPositions != null ) {
|
||||
mLastPositions.clear();
|
||||
}
|
||||
sendMessage( MSG_REMOVE_DIRTY_MARKERS, DataTypes.TYPE_MARKER_CLOUD_DATA );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -159,6 +164,7 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
continue;
|
||||
}
|
||||
|
||||
long start = System.currentTimeMillis();
|
||||
IMogoMarker marker = mCloudSnapshotMarkersCaches.remove( uniqueKey );
|
||||
CloudRoadData lastPosition = mLastPositions.put( uniqueKey, cloudRoadData );
|
||||
if ( marker == null || marker.isDestroyed() ) {
|
||||
@@ -170,12 +176,14 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
bindClickListener( marker );
|
||||
}
|
||||
}
|
||||
Log.i( "mock-snapshot-timer2", "cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||
|
||||
start = System.currentTimeMillis();
|
||||
newAdasRecognizedMarkersCaches.put( uniqueKey, marker );
|
||||
|
||||
if ( mChangeCarModeStatus ) {
|
||||
mChangeCarModeStatus = false;
|
||||
mIsVrMode = MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode();
|
||||
mChangeCarModeStatus = false;
|
||||
if ( mIsVrMode ) {
|
||||
Logger.d( TAG, "3D模型-%s", uniqueKey );
|
||||
marker.getMogoMarkerOptions().set3DMode( true );
|
||||
@@ -215,7 +223,8 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
marker.setRotateAngle( ( float ) cloudRoadData.getHeading() );
|
||||
marker.setPosition( cloudRoadData.getLat(), cloudRoadData.getLon() );
|
||||
}
|
||||
showSelfSpeed( mContext, marker, cloudRoadData.getSpeed(), mIsVrMode );
|
||||
showSelfSpeed( mContext, marker, cloudRoadData.getSpeed(), MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() );
|
||||
Log.i( "mock-snapshot-timer3", "cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||
}
|
||||
sendMessage( MSG_REMOVE_DIRTY_MARKERS, mCloudSnapshotMarkersCaches );
|
||||
mCloudSnapshotMarkersCaches = newAdasRecognizedMarkersCaches;
|
||||
|
||||
Reference in New Issue
Block a user