您当前的位置: Android HUD SDK > 开发指南 > 机动点
机动点

概述

导航机动点信息指的是根据用户当前GPS定位点生成的引导用户到下一驾驶操作点的信息,如下图所示:

guide_maneuveinfo.png

关键代码

获取此信息的关键代码为如下回调函数:

@Override
public void onManeuver(BNRGManeuver arg0) {
	Log.d(BNRemoteConstants.MODULE_TAG, "onManeuver...........name = " + arg0.getManeuverName() + ", distance = " + 
          arg0.getManeuverDistance() + ",nextRoadName = " + arg0.getNextRoadName());
 
	final String afterMeterS = getFormatAfterMeters(arg0.getManeuverDistance());
	final String nextRoadName = arg0.getNextRoadName();
	final boolean isAlong = arg0.mIsStraight;
	String turnName = arg0.name;
	int turnIconResId = SimpleGuideModle.gTurnIconID[0];
 
	if (turnName != null && !"".equalsIgnoreCase(turnName)) {
turnName = turnName + ".png";
	}
 
	if (turnName != null && !"".equalsIgnoreCase(turnName)) {
turnIconResId = SimpleGuideModle.getInstance().getTurnIconResId(turnName);
	}
 
	final int turnIcon = turnIconResId;
 
	mMainHandler.post(new Runnable() {
 
@Override
public void run() {
	mAfterMetersInfoTV.setText(afterMeterS);
	mGoWhereInfoTV.setText(nextRoadName);
 
	mNaviAfterView.setVisibility(View.VISIBLE);
	mAlongRoadView.setVisibility(View.GONE);
	mTurnIcon.setImageDrawable(getResources().getDrawable(turnIcon));
}
	});
}
 
/**
	   * 根据剩余距离获取格式化的字符串,如  200米后
	   * @param nextRemainDist
	   * @return
	   */
	   private String getFormatAfterMeters(int nextRemainDist) {
      StringBuffer distance = new StringBuffer();
      StringUtils.formatDistance(nextRemainDist, UnitLangEnum.ZH, distance);
      return getResources().getString(R.string.nsdk_string_rg_sg_after_meters, distance);
	   }
 
        /**
         * 定义了机动点转向标的对应关系,如 turnIconName 为 turn_back 时,对应显示图标ID为 R.drawable.nsdk_drawable_rg_ic_turn_back,具体图标请用户自行设计。
         */
public static final int[] gTurnIconID = {
	R.drawable.nsdk_drawable_rg_ic_turn_back  ,	      /**<  无效值 */
	R.drawable.nsdk_drawable_rg_ic_turn_front  ,	      /**<  直行 */
	R.drawable.nsdk_drawable_rg_ic_turn_right_front  ,  /**<  右前方转弯 */
	R.drawable.nsdk_drawable_rg_ic_turn_right  ,	      /**<  右转 */
	R.drawable.nsdk_drawable_rg_ic_turn_right_back  ,      /**<  右后方转弯 */
	R.drawable.nsdk_drawable_rg_ic_turn_back  ,  /**<  掉头 */
	R.drawable.nsdk_drawable_rg_ic_turn_left_back  ,      /**<  左后方转弯 */
	R.drawable.nsdk_drawable_rg_ic_turn_left  ,  /**<  左转 */
	R.drawable.nsdk_drawable_rg_ic_turn_left_front  ,      /**<  左前方转弯 */
	R.drawable.nsdk_drawable_rg_ic_turn_ring  ,  /**<  环岛 */
	R.drawable.nsdk_drawable_rg_ic_turn_ring_out  ,	  /**<  环岛出口 */
	R.drawable.nsdk_drawable_rg_ic_turn_left_side  ,      /**<  普通/JCT/SAPA二分歧 靠左 */
	R.drawable.nsdk_drawable_rg_ic_turn_right_side  ,      /**<  普通/JCT/SAPA二分歧 靠右 */
	R.drawable.nsdk_drawable_rg_ic_turn_left_side_main  ,	      /**<  左侧走本线 */
    R.drawable.nsdk_drawable_rg_ic_turn_branch_left_straight  , /**<  靠最左走本线 */
	R.drawable.nsdk_drawable_rg_ic_turn_right_side_main  ,	  /**<  右侧走本线 */
    R.drawable.nsdk_drawable_rg_ic_turn_branch_right_straight , /**<  靠最右走本线 */
    R.drawable.nsdk_drawable_rg_ic_turn_branch_center  ,        /**<  中间走本线 */
	R.drawable.nsdk_drawable_rg_ic_turn_left_side_ic  ,  /**<  IC二分歧左侧走IC */
	R.drawable.nsdk_drawable_rg_ic_turn_right_side_ic  ,	      /**<  IC二分歧右侧走IC */
	R.drawable.nsdk_drawable_rg_ic_turn_branch_left  ,  /**<  普通三分歧/JCT/SAPA 靠最左 */
	R.drawable.nsdk_drawable_rg_ic_turn_branch_right  ,  /**<  普通三分歧/JCT/SAPA 靠最右 */
	R.drawable.nsdk_drawable_rg_ic_turn_branch_center  ,	      /**<  普通三分歧/JCT/SAPA 靠中间 */
	R.drawable.nsdk_drawable_rg_ic_turn_start  ,	      /**<  起始地 */
	R.drawable.nsdk_drawable_rg_ic_turn_dest  ,	      /**<  目的地 */
	R.drawable.nsdk_drawable_rg_ic_turn_via_1,	      /**<  途径点1 */
	R.drawable.nsdk_drawable_rg_ic_turn_via_1,	      /**<  途径点2 */
	R.drawable.nsdk_drawable_rg_ic_turn_via_1,	      /**<  途径点3 */
	R.drawable.nsdk_drawable_rg_ic_turn_via_1,          /**<  途径点4 */
	R.drawable.nsdk_drawable_rg_ic_turn_inferry  ,	  /**<  进入渡口 */
	R.drawable.nsdk_drawable_rg_ic_turn_inferry ,	  /**<  脱出渡口 */
    R.drawable.nsdk_drawable_rg_ic_turn_tollgate  ,             /**<  收费站 */
    R.drawable.nsdk_drawable_rg_ic_turn_left_side_main  ,       /**<  IC二分歧左侧直行走IC */
	R.drawable.nsdk_drawable_rg_ic_turn_right_side_main  ,      /**<  IC二分歧右侧直行走IC */
	R.drawable.nsdk_drawable_rg_ic_turn_left_side_main  ,       /**<  普通/JCT/SAPA二分歧左侧 直行 */
	R.drawable.nsdk_drawable_rg_ic_turn_right_side_main  ,      /**<  普通/JCT/SAPA二分歧右侧 直行 */
	R.drawable.nsdk_drawable_rg_ic_turn_branch_left_straight  , /**<  普通/JCT/SAPA三分歧左侧 直行 */
	R.drawable.nsdk_drawable_rg_ic_turn_branch_center  ,        /**<  普通/JCT/SAPA三分歧中央 直行 */
	R.drawable.nsdk_drawable_rg_ic_turn_branch_right_straight  ,/**<  普通/JCT/SAPA三分歧右侧 直行 */
    R.drawable.nsdk_drawable_rg_ic_turn_branch_left  ,          /**<  IC三分歧左侧走IC */
	R.drawable.nsdk_drawable_rg_ic_turn_branch_center  ,        /**<  IC三分歧中央走IC */
	R.drawable.nsdk_drawable_rg_ic_turn_branch_right  ,         /**<  IC三分歧右侧走IC */
    R.drawable.nsdk_drawable_rg_ic_turn_branch_left_straight  , /**<  IC三分歧左侧直行 */
	R.drawable.nsdk_drawable_rg_ic_turn_branch_center  ,	      /**<  IC三分歧中间直行 */
	R.drawable.nsdk_drawable_rg_ic_turn_branch_right_straight,   /**<  IC三分歧右侧直行 */
  	R.drawable.nsdk_drawable_rg_ic_turn_left_side_main,  /**<  八方向靠左直行*/
	R.drawable.nsdk_drawable_rg_ic_turn_right_side_main,  /**<  八方向靠右直行*/
	R.drawable.nsdk_drawable_rg_ic_turn_branch_left_straight, /**<  八方向靠最左侧直行*/
	R.drawable.nsdk_drawable_rg_ic_turn_branch_center,  /**<  八方向沿中间直行*/
	R.drawable.nsdk_drawable_rg_ic_turn_branch_right_straight,  /**<  八方向靠最右侧直行*/
	R.drawable.nsdk_drawable_rg_ic_turn_left_2branch_left,  /**<  八方向左转+随后靠左*/
	R.drawable.nsdk_drawable_rg_ic_turn_left_2branch_right,  /**<  八方向左转+随后靠右*/
	R.drawable.nsdk_drawable_rg_ic_turn_left_3branch_left,  /**<  八方向左转+随后靠最左*/
	R.drawable.nsdk_drawable_rg_ic_turn_left_3branch_middle,/**<  八方向左转+随后沿中间*/
	R.drawable.nsdk_drawable_rg_ic_turn_left_3branch_right,  /**<  八方向左转+随后靠最右*/
	R.drawable.nsdk_drawable_rg_ic_turn_right_2branch_left, /**<  八方向右转+随后靠左 */
	R.drawable.nsdk_drawable_rg_ic_turn_right_2branch_right,  /**<  八方向右转+随后靠右*/
	R.drawable.nsdk_drawable_rg_ic_turn_right_3branch_left, /**<  八方向右转+随后靠最左*/
	R.drawable.nsdk_drawable_rg_ic_turn_right_3branch_middle, /**<  八方向右转+随后沿中间 */
	R.drawable.nsdk_drawable_rg_ic_turn_right_3branch_right,  /**<  八方向右转+随后靠最右*/
	R.drawable.nsdk_drawable_rg_ic_turn_lf_2branch_left ,    /**<  八方向左前方靠左侧 */
    R.drawable.nsdk_drawable_rg_ic_turn_lf_2branch_right ,    /**<  八方向左前方靠右侧 */  
    R.drawable.nsdk_drawable_rg_ic_turn_rf_2branch_left ,     /**<  八方向右前方靠左侧 */
    R.drawable.nsdk_drawable_rg_ic_turn_rf_2branch_right     /**<  八方向右前方靠右侧 */
};
 
/**
 * 车道图标,对应每一个车道的转向箭头图标,用户可自行设计对应的显示图标。
 */
public class NaviLane {
	/** 左转(高亮) */
	public static final int NAVILANE_TURN_LEFT_90 = 0x11000000;
	/** 左转 */
	public static final int NAVILANE_TURN_LEFT_90_GRAY = 0x10000000;
	/** 右转(高亮) */
	public static final int NAVILANE_TURN_RIGHT_90 = 0x00110000;
	/** 右转 */
	public static final int NAVILANE_TURN_RIGHT_90_GRAY = 0x00100000;
	/** 直行(高亮) */
	public static final int NAVILANE_STRAIGHT = 0x00001100;
	/** 直行 */
	public static final int NAVILANE_STRAIGHT_GRAY = 0x00001000;
	/** 左调头(高亮) */
	public static final int NAVILANE_TURN_AROUND_LEFT = 0x00000011;
	/** 左调头 */
	public static final int NAVILANE_TURN_AROUND_LEFT_GRAY = 0x00000010;
	/** 左转+直行 */
	public static final int NAVILANE_2CROSS_LEFT_STRAIGHT_GRAY = 0x10001000;
	/** 左转(高亮)+直行 */
	public static final int NAVILANE_2CROSS_TURN_LEFT = 0x11001000;
	/** 左转+直行(高亮) */
	public static final int NAVILANE_2CROSS_LEFT_STRAIGHT = 0x10001100;
	/** 右转+直行 */
	public static final int NAVILANE_2CROSS_RIGHT_STRAIGHT_GRAY = 0x00101000;
	/** 右转(高亮)+直行 */
	public static final int NAVILANE_2CROSS_TURN_RIGHT = 0x00111000;
	/** 右转+直行(高亮) */
	public static final int NAVILANE_2CROSS_RIGHT_STRAIGHT = 0x00101100;
	/** 左转+直行+右转 */
	public static final int NAVILANE_3CROSS_GRAY = 0x10101000;
	/** 左转(高亮)+直行+右转 */
	public static final int NAVILANE_3CROSS_TURN_LEFT = 0x11101000;
	/** 左转+直行+右转(高亮) */
	public static final int NAVILANE_3CROSS_TURN_RIGHT = 0x10111000;
	/** 左转+直行(高亮)+右转 */
	public static final int NAVILANE_3CROSS_STRAIGHT = 0x10101100;
	/** 左转+左调头 */
	public static final int NAVILANE_AROUND_AND_LEFT_GRAY = 0x10000010;
	/** 左转(高亮)+左调头 */
	public static final int NAVILANE_LEFT_AND_AROUND = 0x11000010;
	/** 左转+左调头(高亮) */
	public static final int NAVILANE_AROUND_AND_LEFT = 0x10000011;
	/** 左转+右转 */
	public static final int NAVILANE_LEFT_AND_RIGHT_GRAY = 0x10100000;
	/** 左转(高亮)+右转 */
	public static final int NAVILANE_LEFT_AND_RIGHT = 0x11100000;
	/** 左转+右转(高亮) */
	public static final int NAVILANE_RIGHT_AND_LEFT = 0x10110000;
	/** 右转+左调头 */
	public static final int NAVILANE_AROUND_AND_RIGHT_GRAY = 0x00100010;
	/** 右转(高亮)+左调头 */
	public static final int NAVILANE_RIGHT_AND_AROUND = 0x00110010;
	/** 右转+左调头(高亮) */
	public static final int NAVILANE_AROUND_AND_RIGHT = 0x00100011;
	/** 直行+左调头 */
	public static final int NAVILANE_AROUND_AND_STRAIGHT_GRAY = 0x00001010;
	/** 直行(高亮)+左调头 */
	public static final int NAVILANE_STRAIGHT_AND_AROUND = 0x00001110;
	/** 直行+左调头(高亮) */
	public static final int NAVILANE_AROUND_AND_STRAIGHT = 0x00001011;
	/** 左转+右转+左调头 */
	public static final int NAVILANE_AROUND_LEFT_RIGHT_GRAY = 0x10100010;
	/** 左转(高亮)+右转+左调头 */
	public static final int NAVILANE_LEFT_AROUND_RIGHT = 0x11100010;
	/** 左转+右转(高亮)+左调头 */
	public static final int NAVILANE_RIGHT_AROUND_LEFT = 0x10110010;
	/** 左转+右转+左调头(高亮) */
	public static final int NAVILANE_AROUND_LEFT_RIGHT = 0x10100011;
	/** 左转+直行+左调头 */
	public static final int NAVILANE_AROUND_LEFT_STRAIGHT_GRAY = 0x10001010;
	/** 左转(高亮)+直行+左调头 */
	public static final int NAVILANE_LEFT_AROUND_STRAIGHT = 0x11001010;
	/** 左转+直行(高亮)+左调头 */
	public static final int NAVILANE_STRAIGHT_LEFT_AROUND = 0x10001110;
	/** 左转+直行+左调头(高亮) */
	public static final int NAVILANE_AROUND_LEFT_STRAIGHT = 0x10001011;
	/** 右转+直行+左调头 */
	public static final int NAVILANE_AROUND_RIGHT_STRAIGHT_GRAY = 0x00101010;
	/** 右转(高亮)+直行+左调头 */
	public static final int NAVILANE_RIGHT_AROUND_STRAIGHT = 0x00111010;
	/** 右转+直行(高亮)+左调头 */
	public static final int NAVILANE_STRAIGHT_RIGHT_AROUND = 0x00101110;
	/** 右转+直行+左调头(高亮) */
	public static final int NAVILANE_AROUND_RIGHT_STRAIGHT = 0x00101011;
	/** 左转+右转+直行+左调头 */
	public static final int NAVILANE_AROUND_LEFT_RIGHT_STRAIGHT_GRAY = 0x10101010;
	/** 左转(高亮)+右转+直行+左调头 */
	public static final int NAVILANE_LEFT_AROUND_RIGHT_STRAIGHT = 0x11101010;
	/** 左转+右转(高亮)+直行+左调头 */
	public static final int NAVILANE_RIGHT_AROUND_LEFT_STRAIGHT = 0x10111010;
	/** 左转+右转+直行(高亮)+左调头 */
	public static final int NAVILANE_STRAIGHT_AROUND_LEFT_RIGHT = 0x10101110;
	/** 左转+右转+直行+左调头(高亮) */
	public static final int NAVILANE_AROUND_LEFT_RIGHT_STRAIGHT = 0x10101011;
}



机动点图标在百度导航app里如下图所示,用户可以根据范例自行设计图标

youdaotu1.png