This commit is contained in:
wangcongtao
2020-06-11 16:42:45 +08:00
parent 5f7e9a3d58
commit 88436a4d5a
10 changed files with 32 additions and 23 deletions

View File

@@ -194,11 +194,11 @@ public class MarkerServiceHandler {
* 绘制Marker
* 建议使用
*
* @see MapMarkerManager#drawMapMarker(MarkerShowEntity)
* @see MapMarkerManager#drawMapMarker(MarkerShowEntity, int)
*/
@Deprecated
public static IMogoMarker drawMapMarker( MarkerShowEntity markerShowEntity ) {
return getMapMarkerManager().drawMapMarker( markerShowEntity );
return getMapMarkerManager().drawMapMarker( markerShowEntity, ServiceConst.MARKER_Z_INDEX_HIGH );
}
/**

View File

@@ -113,6 +113,9 @@ public class ServiceConst {
*/
public static final int MSG_LOCK_CAR = 0x202;
public static final int MARKER_Z_INDEX_HIGH = 100;
public static final int MARKER_Z_INDEX_LOW = 2;
/**
* 切换卡片内容-上一个

View File

@@ -320,7 +320,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
String sn = getCarSnFromEntity( markerOnlineCar );
IMogoMarker mogoMarker = existCarMap.get( sn );
if ( mogoMarker == null ) {
mogoMarker = drawMapMarker( markerShowEntity );
mogoMarker = drawMapMarker( markerShowEntity, ServiceConst.MARKER_Z_INDEX_LOW );
}
startSmooth( mogoMarker, markerOnlineCar, markerLocation );
}
@@ -360,7 +360,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
IMogoMarker mogoMarker = existCarMap.get( sn );
if ( mogoMarker == null ) {
Logger.d( TAG, "draw road condition, sn = %s", sn );
drawMapMarker( markerShowEntity );
drawMapMarker( markerShowEntity, ServiceConst.MARKER_Z_INDEX_HIGH );
}
}
}
@@ -392,7 +392,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
String sn = getCarSnFromEntity( markerShareMusic );
IMogoMarker mogoMarker = existCarMap.get( sn );
if ( mogoMarker == null ) {
drawMapMarker( markerShowEntity );
drawMapMarker( markerShowEntity, ServiceConst.MARKER_Z_INDEX_HIGH );
}
}
}
@@ -425,7 +425,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
String sn = getCarSnFromEntity( noveltyInfo );
IMogoMarker mogoMarker = existCarMap.get( sn );
if ( mogoMarker == null ) {
drawMapMarker( markerShowEntity );
drawMapMarker( markerShowEntity, ServiceConst.MARKER_Z_INDEX_HIGH );
}
}
}
@@ -634,20 +634,20 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
* @param markerShowEntity marker 绘制数据实体
* @return 绘制的Marker
*/
public synchronized IMogoMarker drawMapMarker( MarkerShowEntity markerShowEntity ) {
public synchronized IMogoMarker drawMapMarker( MarkerShowEntity markerShowEntity, int zIndex ) {
try {
return drawMapMarkerImpl( markerShowEntity );
return drawMapMarkerImpl( markerShowEntity, zIndex );
} catch ( Exception e ) {
e.printStackTrace();
return null;
}
}
private IMogoMarker drawMapMarkerImpl( MarkerShowEntity markerShowEntity ) {
private IMogoMarker drawMapMarkerImpl( MarkerShowEntity markerShowEntity, int zIndex ) {
if ( markerShowEntity == null || markerShowEntity.getMarkerLocation() == null ) {
return null;
}
MogoMarkerOptions options = new MogoMarkerOptions().owner( markerShowEntity.getMarkerType() ).object( markerShowEntity ).latitude( markerShowEntity.getMarkerLocation().getLat() ).longitude( markerShowEntity.getMarkerLocation().getLon() );
MogoMarkerOptions options = new MogoMarkerOptions().owner( markerShowEntity.getMarkerType() ).zIndex( zIndex ).object( markerShowEntity ).latitude( markerShowEntity.getMarkerLocation().getLat() ).longitude( markerShowEntity.getMarkerLocation().getLon() );
IMarkerView markerView = MapMarkerAdapter.getMarkerView( mContext, markerShowEntity, options );
if ( markerView instanceof OnlineCarMarkerView ) {
try {

View File

@@ -8,6 +8,7 @@ import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.module.common.entity.MarkerShowEntity;
import com.mogo.module.service.MarkerServiceHandler;
import com.mogo.module.service.ServiceConst;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.module.IMogoMarkerService;
import com.mogo.utils.logger.Logger;
@@ -27,7 +28,7 @@ public class MogoMarkerServiceImpl implements IMogoMarkerService {
@Override
public IMogoMarker drawMarker( Object object ) {
if ( object instanceof MarkerShowEntity ) {
return MarkerServiceHandler.getMapMarkerManager().drawMapMarker( ( ( MarkerShowEntity ) object ) );
return MarkerServiceHandler.getMapMarkerManager().drawMapMarker( ( ( MarkerShowEntity ) object ), ServiceConst.MARKER_Z_INDEX_HIGH );
}
Logger.w( TAG, "object must instance of [com.mogo.module.common.entity.MarkerShowEntity]" );
return null;