This commit is contained in:
wangcongtao
2020-12-15 21:18:08 +08:00
parent 96f8ce7be2
commit 47056c97a1
9 changed files with 69 additions and 14 deletions

View File

@@ -60,10 +60,14 @@ class MarkerDrawer {
}
public IMogoMarker drawMapMarkerImpl( MarkerShowEntity markerShowEntity, int zIndex, IMogoMarkerClickListener listener ) {
return drawMapMarkerImpl(markerShowEntity, zIndex, 0, listener);
}
public IMogoMarker drawMapMarkerImpl( MarkerShowEntity markerShowEntity, int zIndex, int icon3DRes, IMogoMarkerClickListener listener ) {
if ( markerShowEntity == null || markerShowEntity.getMarkerLocation() == null ) {
return null;
}
MogoMarkerOptions options = new MogoMarkerOptions().owner( markerShowEntity.getMarkerType() ).zIndex( zIndex ).object( markerShowEntity ).latitude( markerShowEntity.getMarkerLocation().getLat() ).longitude( markerShowEntity.getMarkerLocation().getLon() );
MogoMarkerOptions options = new MogoMarkerOptions().icon3DRes( icon3DRes ).owner( markerShowEntity.getMarkerType() ).zIndex( zIndex ).object( markerShowEntity ).latitude( markerShowEntity.getMarkerLocation().getLat() ).longitude( markerShowEntity.getMarkerLocation().getLon() );
IMarkerView markerView = MapMarkerAdapter.getMarkerView( AbsMogoApplication.getApp(), markerShowEntity, options );
if ( markerView instanceof OnlineCarMarkerView ) {
try {

View File

@@ -8,6 +8,7 @@ import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.module.common.ModuleNames;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.R;
import com.mogo.module.common.entity.MarkerCarPois;
import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.MarkerOnlineCar;
@@ -104,7 +105,7 @@ class OnlineCarDrawer {
String sn = MarkerDrawer.getInstance().getPrimaryKeyFromEntity( markerOnlineCar );
IMogoMarker mogoMarker = existCarMap.get( sn );
if ( mogoMarker == null || mogoMarker.isDestroyed() ) {
mogoMarker = MarkerDrawer.getInstance().drawMapMarkerImpl( markerShowEntity, MarkerDrawer.MARKER_Z_INDEX_LOW, listener );
mogoMarker = MarkerDrawer.getInstance().drawMapMarkerImpl( markerShowEntity, MarkerDrawer.MARKER_Z_INDEX_LOW, R.raw.taxi, listener );
}
if ( mogoMarker != null ) {
mogoMarker.setVisible( true );

View File

@@ -9,6 +9,7 @@ import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.map.marker.anim.OnMarkerAnimationListener;
import com.mogo.module.common.ModuleNames;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.drawer.marker.RoadConditionInfoWindow3DAdapter;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.MarkerShowEntity;
@@ -84,10 +85,16 @@ class RoadConditionDrawer {
if ( mogoMarker == null || mogoMarker.isDestroyed() ) {
Logger.d( TAG, "draw road condition, sn = %s", sn );
try {
if ( DebugConfig.isRoadEventAnimated() ) {
post2AddAndStartAnimation( markerShowEntity, i * 100L, listener );
} else {
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
mogoMarker = MarkerDrawer.getInstance().drawMapMarkerImpl( markerShowEntity, MarkerDrawer.MARKER_Z_INDEX_HIGH, listener );
mogoMarker.setInfoWindowAdapter( new RoadConditionInfoWindow3DAdapter( markerShowEntity, AbsMogoApplication.getApp(), mogoMarker.getMogoMarkerOptions() ) );
mogoMarker.showInfoWindow();
} else {
if ( DebugConfig.isRoadEventAnimated() ) {
post2AddAndStartAnimation( markerShowEntity, i * 100L, listener );
} else {
mogoMarker = MarkerDrawer.getInstance().drawMapMarkerImpl( markerShowEntity, MarkerDrawer.MARKER_Z_INDEX_HIGH, listener );
}
}
} catch ( Exception e ) {
e.printStackTrace();

View File

@@ -0,0 +1,37 @@
package com.mogo.module.common.drawer.marker;
import android.content.Context;
import android.view.View;
import com.mogo.map.marker.IMogoInfoWindowAdapter;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.module.common.entity.MarkerShowEntity;
public
/**
* @author congtaowang
* @since 2020/12/15
*
* 描述
*/
class RoadConditionInfoWindow3DAdapter implements IMogoInfoWindowAdapter {
private MarkerShowEntity mEntity;
private Context mContext;
private MogoMarkerOptions mOptions;
public RoadConditionInfoWindow3DAdapter( MarkerShowEntity entity,
Context context,
MogoMarkerOptions options ) {
this.mEntity = entity;
this.mContext = context;
this.mOptions = options;
}
@Override
public View getInfoWindow( IMogoMarker marker ) {
IMarkerView creator = MapMarkerAdapter.getMarkerView( mContext, mEntity, mOptions );
return creator.getView();
}
}