您当前的位置: Android HUD SDK > 开发指南 > 诱导辅助
诱导辅助

概述

辅助诱导信息为导航或者电子狗诱导过程中的路面状况、测速摄像头等交通道路信息。在导航中通常在如下区域展示:

guide_assistinfo.png

关键代码

在导航辅助诱导数据中,assistantType参数代表的辅助诱导类型,请根据实际需要对应自定义的诱导图标。

@Override
public void onAssistant(BNRGAssistant arg0) {
	Log.d(BNRemoteConstants.MODULE_TAG, "onAssistant......distance = " + arg0.getAssistantDistance() + ", type = " + arg0.getAssistantType());
 
	String assistantTips = "";
	String assistantTypeS = "合流";
	if (arg0.getAssistantDistance() > 0) {			
		switch (arg0.getAssistantType()) {
			case HUDConstants.AssistantType.JOINT:
				assistantTypeS = "合流";
				assistantTips = "前方" + getFormatAfterMeters(arg0.getAssistantDistance()) + assistantTypeS;
				break;
			case HUDConstants.AssistantType.TUNNEL:
				assistantTypeS = "隧道";
				assistantTips = "前方" + getFormatAfterMeters(arg0.getAssistantDistance()) + assistantTypeS;
				break;
			case HUDConstants.AssistantType.BRIDGE:
				assistantTypeS = "桥梁";
				assistantTips = "前方" + getFormatAfterMeters(arg0.getAssistantDistance()) + assistantTypeS;
				break;
			case HUDConstants.AssistantType.RAILWAY:
				assistantTypeS = "铁路";
				assistantTips = "前方" + getFormatAfterMeters(arg0.getAssistantDistance()) + assistantTypeS;
				break;
			case HUDConstants.AssistantType.BLIND_BEND:
				assistantTypeS = "急转弯";
				assistantTips = "前方" + getFormatAfterMeters(arg0.getAssistantDistance()) + assistantTypeS;
				break;
			case HUDConstants.AssistantType.BLIND_SLOPE:
				assistantTypeS = "陡坡";
				assistantTips = "前方" + getFormatAfterMeters(arg0.getAssistantDistance()) + assistantTypeS;
				break;
			case HUDConstants.AssistantType.ROCKFALL:
				assistantTypeS = "落石";
				assistantTips = "前方" + getFormatAfterMeters(arg0.getAssistantDistance()) + assistantTypeS;
				break;
			case HUDConstants.AssistantType.ACCIDENT:
				assistantTypeS = "事故多发区";
				assistantTips = "前方" + getFormatAfterMeters(arg0.getAssistantDistance()) + assistantTypeS;
				break;
			case HUDConstants.AssistantType.SPEED_CAMERA:
				assistantTypeS = "测速摄像";
				assistantTips = "前方" + getFormatAfterMeters(arg0.getAssistantDistance()) + assistantTypeS + "限速: " + arg0.getAssistantLimitedSpeed();
				break;
			case HUDConstants.AssistantType.TRAFFIC_LIGHT_CAMERA:
				assistantTypeS = "交通信号灯摄像";
				assistantTips = "前方" + getFormatAfterMeters(arg0.getAssistantDistance()) + assistantTypeS;
				break;
			case HUDConstants.AssistantType.INTERVAL_CAMERA:
				assistantTypeS = "区间测速";
				assistantTips = "前方" + getFormatAfterMeters(arg0.getAssistantDistance()) + assistantTypeS;
				break;
			case HUDConstants.AssistantType.CHILDREN:
				assistantTypeS = "注意儿童";
				assistantTips = "前方" + getFormatAfterMeters(arg0.getAssistantDistance()) + assistantTypeS;
				break;
			case HUDConstants.AssistantType.UNEVEN:
				assistantTypeS = "路面不平";
				assistantTips = "前方" + getFormatAfterMeters(arg0.getAssistantDistance()) + assistantTypeS;
				break;
			case HUDConstants.AssistantType.NARROW:
				assistantTypeS = "道路变窄";
				assistantTips = "前方" + getFormatAfterMeters(arg0.getAssistantDistance()) + assistantTypeS;
				break;
			case HUDConstants.AssistantType.VILLAGE:
				assistantTypeS = "前面村庄";
				assistantTips = "前方" + getFormatAfterMeters(arg0.getAssistantDistance()) + assistantTypeS;
				break;
			case HUDConstants.AssistantType.SLIP:
				assistantTypeS = "路面易滑";
				assistantTips = "前方" + getFormatAfterMeters(arg0.getAssistantDistance()) + assistantTypeS;
				break;
			case HUDConstants.AssistantType.OVER_TAKE_FORBIDEN:
				assistantTypeS = "禁止超车";
				assistantTips = "前方" + getFormatAfterMeters(arg0.getAssistantDistance()) + assistantTypeS;
				break;
			case HUDConstants.AssistantType.HONK:
				assistantTypeS = "请铭喇叭";
				assistantTips = "前方" + getFormatAfterMeters(arg0.getAssistantDistance()) + assistantTypeS;
				break;
			default:
				break;
			}
	}
 
	final String assistantTipstr = assistantTips;
	mMainHandler.post(new Runnable() {
 
		@Override
		public void run() {
			mNavilogTv.setText(assistantTipstr);
		}
	});
}
 
/**
 * 导航诱导图标类型
 */
public static class AssistantType {
	/**  合流 */
	public final static int Joint  = 0 ;
	/**  隧道 */
	public final static int Tunnel = 1 ;
	/**  桥梁 */
	public final static int Bridge = 2 ;
	/**  铁道 */
	public final static int Railway = 3 ;
	/**  急转弯 */
	public final static int BlindBend = 4 ;
	/**  陡坡 */
	public final static int BlindSlope = 5 ;
	/**  落石区 */
	public final static int Rockfall = 6 ;
	/**  事故多发区 */
	public final static int Accident = 7 ;
	/**  测速摄像头 */
	public final static int SpeedCamera = 8 ;
	/**  交通信号灯摄像头 */
	public final static int TrafficLightCamera = 9 ;
	/**  违章摄像头 */
	public final static int PeccanryCamera = 10 ;
	/**  区间测速摄像头 */
	public final static int IntervalCamera = 11 ;
	/**  注意儿童 */
	public final static int Children = 12 ;
	/**  路面不平 */
	public final static int Uneven = 13 ;
	/**  道路变窄 */
	public final static int Narrow = 14 ;
	/**  前面村庄 */
	public final static int Viliage = 15 ;
	/**  路面易滑 */
	public final static int Slip = 16 ;
	/**  禁止超车 */
	public final static int OverTakeForbidden= 17 ;
	/**  请鸣喇叭 */
	public final static int Honk = 18 ;
}