This commit is contained in:
wangcongtao
2020-01-07 17:56:33 +08:00
parent dca01fe24b
commit c69a959b6a
177 changed files with 1457 additions and 650 deletions

View File

@@ -71,7 +71,7 @@ public class AMapNaviViewWrapper implements IMogoMapView,
// 设置是否开启自动黑夜模式切换默认为false不自动切换
options.setAutoNaviViewNightMode( false );
// 设置6秒后是否自动锁车
options.setAutoLockCar( true );
options.setAutoLockCar( false );
// 设置路线上的摄像头气泡是否显示
options.setCameraBubbleShow( true );
// 设置路线相关的配置属性,如:路线的路况颜色,路线上是否显示摄像头气泡等。
@@ -80,6 +80,8 @@ public class AMapNaviViewWrapper implements IMogoMapView,
options.setCarBitmap( BitmapFactory.decodeResource( getContext().getResources(), R.drawable.ic_amap_navi_cursor ) );
// 设置指南针图标否在导航界面显示默认显示。true显示false隐藏。
options.setCompassEnabled( false );
// 黑夜模式
options.setNaviNight( true );
//设置路况光柱条是否显示(只适用于驾车导航,需要联网)。
options.setTrafficBarEnabled( false );
// 设置[实时交通图层开关按钮]是否显示(只适用于驾车导航,需要联网)。
@@ -391,8 +393,8 @@ public class AMapNaviViewWrapper implements IMogoMapView,
@Override
public void moveToCenter( MogoLatLng latLng ) {
if ( latLng == null ) {
Logger.e( TAG, "latlng = null" );
if ( latLng == null || latLng.lat == 0.0d || latLng.lng == 0.0d ) {
Logger.e( TAG, "latlng = null or is illegal" );
return;
}
mMapView.getMap().animateCamera( CameraUpdateFactory.newLatLng( new LatLng( latLng.lat, latLng.lng ) ) );

View File

@@ -109,7 +109,7 @@ public class NaviListenerAdapter extends AMapNaviListenerAdapter {
@Override
public void onNaviInfoUpdate( NaviInfo naviInfo ) {
MogoNaviListenerHandler.getInstance().onNaviInfoUpdate( ObjectUtils.fromAMap( naviInfo ) );
MogoNaviListenerHandler.getInstance().onNaviInfoUpdate( ObjectUtils.fromAMap( mContext, naviInfo ) );
mNaviOverlayHelper.handleNaviInfoUpdate( naviInfo );
}

View File

@@ -0,0 +1,96 @@
package com.mogo.map.impl.amap.utils;
import android.content.Context;
import android.util.SparseArray;
import com.amap.api.navi.enums.IconType;
/**
* @author congtaowang
* @since 2019-09-29
* <p>
* 描述
*/
public class IconTypeUtils {
private static SparseArray< String > sIconName = new SparseArray<>();
static {
sIconName.put( IconType.ARRIVED_DESTINATION, "到达目的地" );
sIconName.put( IconType.ARRIVED_SERVICE_AREA, "到达服务区" );
sIconName.put( IconType.ARRIVED_TOLLGATE, "到达收费站" );
sIconName.put( IconType.ARRIVED_TUNNEL, "到达隧道" );
sIconName.put( IconType.ARRIVED_WAYPOINT, "到达途经点" );
sIconName.put( IconType.BRIDGE, "通过桥" );
sIconName.put( IconType.BY_ELEVATOR, "电梯换层" );
sIconName.put( IconType.BY_ESCALATOR, "扶梯换层" );
sIconName.put( IconType.BY_STAIR, "楼梯换层" );
sIconName.put( IconType.CABLEWAY, "通过索道" );
sIconName.put( IconType.CHANNEL, "通过通道" );
sIconName.put( IconType.CROSSWALK, "通过人行横道" );
sIconName.put( IconType.CRUISE_ROUTE, "通过游船路线" );
sIconName.put( IconType.DEFAULT, "自车" );
sIconName.put( IconType.ENTER_BUILDING, "进入建筑物" );
sIconName.put( IconType.ENTER_ROUNDABOUT, "进入环岛" );
sIconName.put( IconType.ENTRY_LEFT_RING, "进入环岛" );
sIconName.put( IconType.ENTRY_LEFT_RING_CONTINUE, "绕环岛直行" );
sIconName.put( IconType.ENTRY_LEFT_RING_LEFT, "绕环岛左转" );
sIconName.put( IconType.ENTRY_LEFT_RING_RIGHT, "绕环岛右转" );
sIconName.put( IconType.ENTRY_LEFTRINGU_TURN, "绕环岛调头" );
sIconName.put( IconType.ENTRY_RING_CONTINUE, "绕环岛直行" );
sIconName.put( IconType.ENTRY_RING_LEFT, "绕环岛左转" );
sIconName.put( IconType.ENTRY_RING_RIGHT, "绕环岛右转" );
sIconName.put( IconType.ENTRY_RING_UTURN, "绕环岛调头" );
sIconName.put( IconType.FERRY, "通过轮渡" );
sIconName.put( IconType.LADDER, "通过阶梯" );
sIconName.put( IconType.LEAVE_BUILDING, "离开建筑物" );
sIconName.put( IconType.LEAVE_LEFT_RING, "驶出环岛" );
sIconName.put( IconType.LEFT, "左转" );
sIconName.put( IconType.LEFT_BACK, "左后" );
sIconName.put( IconType.LEFT_FRONT, "左前方" );
sIconName.put( IconType.LEFT_TURN_AROUND, "左转掉头" );
sIconName.put( IconType.LIFT, "通过直梯" );
sIconName.put( IconType.LOW_CROSS, "通过普通路口" );
sIconName.put( IconType.LOW_TRAFFIC_CROSS, "红绿灯路口" );
sIconName.put( IconType.NONE, "无定义" );
sIconName.put( IconType.OUT_ROUNDABOUT, "驶出环岛" );
sIconName.put( IconType.OVERPASS, "通过过街天桥" );
sIconName.put( IconType.PARK, "通过公园" );
sIconName.put( IconType.RIGHT, "右转" );
sIconName.put( IconType.RIGHT_BACK, "右后方" );
sIconName.put( IconType.RIGHT_FRONT, "右前方" );
sIconName.put( IconType.SIGHTSEEING_BUSLINE, "通过观光车路线" );
sIconName.put( IconType.SKY_CHANNEL, "通过空中通道" );
sIconName.put( IconType.SLIDEWAY, "通过滑道" );
sIconName.put( IconType.SLOPE, "通过斜坡" );
sIconName.put( IconType.SPECIAL_CONTINUE, "顺行" );
sIconName.put( IconType.SQUARE, "通过广场" );
sIconName.put( IconType.STAIRCASE, "通过扶梯" );
sIconName.put( IconType.STRAIGHT, "直行" );
sIconName.put( IconType.SUBWAY, "通过地铁通道" );
sIconName.put( IconType.U_TURN_RIGHT, "右转掉头" );
sIconName.put( IconType.UNDERPASS, "通过地下通道" );
sIconName.put( IconType.WALK_ROAD, "通过行人道路" );
}
private static int lastIconType = 0;
private static int lastIconResId = 0;
public static String getNameByIconType( int iconType ) {
return sIconName.get( iconType );
}
public static int getResIdByIconType( Context context, int iconType ) {
try {
if ( iconType == lastIconType ) {
return lastIconResId;
}
int target = context.getResources().getIdentifier( "ic_" + iconType, "drawable", context.getPackageName() );
lastIconType = iconType;
lastIconResId = target;
return target;
} catch ( Exception e ) {
return -1;
}
}
}

View File

@@ -1,5 +1,6 @@
package com.mogo.map.impl.amap.utils;
import android.content.Context;
import android.graphics.Bitmap;
import android.view.View;
@@ -622,7 +623,7 @@ public class ObjectUtils {
return mogoPoiResult;
}
public static MogoNaviInfo fromAMap( NaviInfo naviInfo ) {
public static MogoNaviInfo fromAMap( Context context, NaviInfo naviInfo ) {
if ( naviInfo == null ) {
return null;
}
@@ -631,7 +632,7 @@ public class ObjectUtils {
mogoNaviInfo.setCurrentSpeed( naviInfo.getCurrentSpeed() );
mogoNaviInfo.setCurStepRetainDistance( naviInfo.getCurStepRetainDistance() );
mogoNaviInfo.setCurStepRetainTime( naviInfo.getCurStepRetainTime() );
mogoNaviInfo.setIconType( naviInfo.getIconType() );
mogoNaviInfo.setIconResId( IconTypeUtils.getResIdByIconType( context, naviInfo.getIconType() ) );
mogoNaviInfo.setNextRoadName( naviInfo.getNextRoadName() );
mogoNaviInfo.setPathRetainDistance( naviInfo.getPathRetainDistance() );
mogoNaviInfo.setPathRetainTime( naviInfo.getPathRetainTime() );

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -48,4 +48,11 @@ public interface IMogoMarkerManager {
* @return
*/
List< IMogoMarker > getMarkers( String tag );
/**
* 仅保留指定类型的tag
*
* @param tag 需要保留的类型
*/
void removeMarkersExcept( String tag );
}

View File

@@ -1,5 +1,7 @@
package com.mogo.map.marker;
import android.text.TextUtils;
import com.mogo.map.listener.IMogoMapListener;
import com.mogo.map.listener.IMogoMapListenerRegister;
@@ -112,4 +114,23 @@ public class MogoMarkersHandler implements IMogoMarkerClickListener, IMogoMarker
}
return false;
}
/**
* @param tag 需要保留的类型
*/
public void deleteAllExcept( String tag ) {
if ( TextUtils.isEmpty( tag ) ) {
return;
}
List< IMogoMarker > mogoMarkerList = mServicesMarkers.remove( tag );
for ( List< IMogoMarker > value : mServicesMarkers.values() ) {
if ( value != null && !value.isEmpty() ) {
for ( IMogoMarker mogoMarker : value ) {
mogoMarker.destroy();
}
value.clear();
}
}
mServicesMarkers.put( tag, mogoMarkerList );
}
}

View File

@@ -3,6 +3,8 @@ package com.mogo.map.navi;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.DrawableRes;
/**
* @author congtaowang
* @since 2019-12-25
@@ -32,9 +34,10 @@ public class MogoNaviInfo implements Parcelable {
private int curStepRetainTime;
/**
* 导航转向图标
* 导航转向图标资源ID
*/
private int iconType;
@DrawableRes
private int iconResId;
/**
* 下条路名
@@ -83,12 +86,12 @@ public class MogoNaviInfo implements Parcelable {
this.curStepRetainTime = curStepRetainTime;
}
public int getIconType() {
return iconType;
public int getIconResId() {
return iconResId;
}
public void setIconType( int iconType ) {
this.iconType = iconType;
public void setIconResId( int iconResId ) {
this.iconResId = iconResId;
}
public String getNextRoadName() {
@@ -126,7 +129,7 @@ public class MogoNaviInfo implements Parcelable {
dest.writeInt( this.currentSpeed );
dest.writeInt( this.curStepRetainDistance );
dest.writeInt( this.curStepRetainTime );
dest.writeInt( this.iconType );
dest.writeInt( this.iconResId );
dest.writeString( this.nextRoadName );
dest.writeInt( this.pathRetainTime );
dest.writeInt( this.pathRetainDistance );
@@ -140,7 +143,7 @@ public class MogoNaviInfo implements Parcelable {
this.currentSpeed = in.readInt();
this.curStepRetainDistance = in.readInt();
this.curStepRetainTime = in.readInt();
this.iconType = in.readInt();
this.iconResId = in.readInt();
this.nextRoadName = in.readString();
this.pathRetainTime = in.readInt();
this.pathRetainDistance = in.readInt();

View File

@@ -76,4 +76,9 @@ public class MogoMarkerManager implements IMogoMarkerManager {
public List< IMogoMarker > getMarkers( String tag ) {
return MogoMarkersHandler.getInstance().getMarkers( tag );
}
@Override
public void removeMarkersExcept( String tag ) {
MogoMarkersHandler.getInstance().deleteAllExcept( tag );
}
}