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