地图模块代码更新3.0.0
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
package com.autonavi.nge.guidance;
|
||||
|
||||
|
||||
import com.zhidaoauto.map.sdk.inner.obj.NavMsg;
|
||||
|
||||
public class GuidanceMessage {
|
||||
public final static int GUIDANCE_MSG_TYPE_NONE = 0; //无效消息
|
||||
public final static int GUIDANCE_MSG_TYPE_NEWPOS = 1; //新的位置
|
||||
public final static int GUIDANCE_MSG_TYPE_NEWINFO = 2; //新的导航信息
|
||||
public final static int GUIDANCE_MSG_TYPE_NEWSPEECH = 3; //新的TTS语音
|
||||
public final static int GUIDANCE_MSG_TYPE_NEWSTATUS = 4; //新的导航状态
|
||||
public final static int GUIDANCE_MSG_TYPE_ROUTEFOUND = 5; //路线计算完成
|
||||
public final static int GUIDANCE_MSG_TYPE_ROUTENORES = 6; //无导航路线
|
||||
|
||||
public final static int GUIDANCE_STATUS_IDLE = (int) (0x0001); //空闲状态
|
||||
public final static int GUIDANCE_STATUS_CALCROUTE = (int) (0x0001 << 1); //正在计算路线
|
||||
//public final static int GUIDANCE_STATUS_WAITGPSSTART= (int)(0x0001<<2); //等待GPS位置作为出发地
|
||||
public final static int GUIDANCE_STATUS_GPSNAVI = (int) (0x0001 << 3); //正在进行GPS导航
|
||||
public final static int GUIDANCE_STATUS_SIMNAVI = (int) (0x0001 << 4); //正在进行模拟导航
|
||||
public final static int GUIDANCE_STATUS_NAVIFINISH = (int) (0x0001 << 5); //导航结束
|
||||
public final static int GUIDANCE_STATUS_REROUTING = (int) (0x0001 << 6); //正在重新规划路线
|
||||
public final static int GUIDANCE_STATUS_OFFROUTE = (int) (0x0001 << 7); //偏离路线
|
||||
|
||||
public static volatile GuidanceMessage instance = null;
|
||||
private Guidanceinterface m_GuidanceInterface = null;
|
||||
|
||||
public static GuidanceMessage getInstance() {
|
||||
if (null == instance) {
|
||||
synchronized (GuidanceMessage.class) {
|
||||
if (null == instance) {
|
||||
instance = new GuidanceMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void setGuidanceInterfaceAct(Guidanceinterface inter) {
|
||||
m_GuidanceInterface = inter;
|
||||
}
|
||||
|
||||
public void OnReceiveMessage(NavMsg navMsg) {
|
||||
if (m_GuidanceInterface != null) {
|
||||
m_GuidanceInterface.OnReceiveMessage(navMsg);
|
||||
}
|
||||
}
|
||||
|
||||
public void exit() {
|
||||
instance = null;
|
||||
m_GuidanceInterface = null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,448 @@
|
||||
//package com.autonavi.nge.guidance;
|
||||
//
|
||||
//import android.util.Log;
|
||||
//
|
||||
//import com.autonavi.nge.dm.INavigationCore;
|
||||
//import com.zhidaoauto.map.sdk.inner.CompileConfig;
|
||||
//import com.zhidaoauto.map.sdk.inner.common.NavHelper;
|
||||
//
|
||||
//import java.nio.ByteBuffer;
|
||||
//import java.nio.ByteOrder;
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.List;
|
||||
//
|
||||
//public class GuidanceProvider {
|
||||
//
|
||||
// private static final String TAG = "GuidanceProvider";
|
||||
//
|
||||
// public GuidanceProvider(INavigationCore naviCore) {
|
||||
// load(naviCore);
|
||||
// }
|
||||
//
|
||||
// {
|
||||
// System.loadLibrary("datascript");
|
||||
// System.loadLibrary("ndssystem");
|
||||
// System.loadLibrary("ndssqlite");
|
||||
// System.loadLibrary("ndsprovider");
|
||||
// System.loadLibrary("datamgr");
|
||||
// System.loadLibrary("guidance");
|
||||
// }
|
||||
//
|
||||
// public void destroyProvider() {
|
||||
// unload();
|
||||
// }
|
||||
//
|
||||
// public RouteBook getRouteBookData(int session, int start, int end) throws Exception {
|
||||
// List<RouteBookItem> list = new ArrayList<RouteBookItem>();
|
||||
// RouteBook route = null;
|
||||
// byte[] bookdata = getBookData(session, start, end);
|
||||
// if (bookdata != null && bookdata.length > 0) {
|
||||
// ByteBuffer databuf = ByteBuffer.wrap(bookdata);
|
||||
// databuf.order(ByteOrder.LITTLE_ENDIAN);
|
||||
// int bufferSize = databuf.getInt();
|
||||
// int TotalLengthlength = databuf.getInt();
|
||||
// int TotalTime = databuf.getInt();
|
||||
// int size = databuf.getInt();
|
||||
// {
|
||||
// RouteBookItem item = new RouteBookItem();
|
||||
// list.add(item);
|
||||
// }
|
||||
// for (int i = 0; i < size; i++) {
|
||||
// RouteBookItem item = new RouteBookItem();
|
||||
// item.titleID = databuf.getInt();
|
||||
// item.linkid = databuf.getInt();
|
||||
// item.routelength = databuf.getInt();
|
||||
// item.routeTime = databuf.getInt();
|
||||
//
|
||||
// int namelength = databuf.get();
|
||||
// String routeName = null;
|
||||
// if (namelength > 0) {
|
||||
// byte[] name = new byte[namelength];
|
||||
// for (int idx = 0; idx < namelength; idx++) {
|
||||
// name[idx] = (byte) databuf.get();
|
||||
// }
|
||||
// item.routeName = new String(name, "UTF-8");
|
||||
// }
|
||||
//
|
||||
// item.lon = databuf.getInt();
|
||||
// item.lat = databuf.getInt();
|
||||
// item.turnID = databuf.getInt();
|
||||
//
|
||||
// namelength = databuf.get();
|
||||
// String turnSpeech = null;
|
||||
// if (namelength > 0) {
|
||||
// byte[] name = new byte[namelength];
|
||||
// for (int idx = 0; idx < namelength; idx++) {
|
||||
// name[idx] = (byte) databuf.get();
|
||||
// }
|
||||
// item.routeSpeech = new String(name, "UTF-8");
|
||||
// }
|
||||
// list.add(item);
|
||||
// }
|
||||
// route = new RouteBook(TotalLengthlength, TotalTime, size, list);
|
||||
// }
|
||||
//
|
||||
// return route;
|
||||
//
|
||||
// }
|
||||
//
|
||||
// public NaviInfo getNaviInfoData() throws Exception {
|
||||
// byte[] data = getNaviInfo();
|
||||
// if (data != null) {
|
||||
// NaviInfo naviinfo = new NaviInfo();
|
||||
// ByteBuffer databuf = ByteBuffer.wrap(data);
|
||||
// databuf.order(ByteOrder.LITTLE_ENDIAN);
|
||||
// naviinfo.m_nNaviStatus = (byte) databuf.get();
|
||||
// naviinfo.m_nDistanceToDest = databuf.getInt();
|
||||
// naviinfo.m_nTimeToDest = databuf.getInt();
|
||||
// naviinfo.m_nDistanceToTurn = databuf.getInt();
|
||||
// naviinfo.m_nDistanceToNextTurn = databuf.getInt();
|
||||
// naviinfo.m_nTurnID = databuf.getInt();
|
||||
// naviinfo.m_nNextTurnID = databuf.getInt();
|
||||
// naviinfo.m_nBindLon = databuf.getInt();
|
||||
// naviinfo.m_nBindLat = databuf.getInt();
|
||||
// naviinfo.m_nImageUr = databuf.getInt();
|
||||
// naviinfo.m_nImageBg = databuf.getInt();
|
||||
// naviinfo.m_nImageArrow = databuf.getInt();
|
||||
// naviinfo.m_nImageType = (byte) databuf.get();
|
||||
// naviinfo.m_nSGPImageUr = databuf.getInt();
|
||||
// naviinfo.m_nSGPImageBg = databuf.getInt();
|
||||
// naviinfo.m_nSGPImageArrow = databuf.getInt();
|
||||
// naviinfo.m_nSGPImageType = (byte) databuf.get();
|
||||
// naviinfo.m_nSpeed = databuf.getInt();
|
||||
// naviinfo.m_LaneType = (byte) databuf.get();//车道数
|
||||
// naviinfo.m_Angle = (short) databuf.getShort();
|
||||
// naviinfo.m_IsExport = (byte) databuf.get();
|
||||
// naviinfo.m_EntranceDist = databuf.getShort();
|
||||
// naviinfo.m_ExitDist = databuf.getShort();
|
||||
// naviinfo.m_ServerDist = databuf.getShort();
|
||||
//
|
||||
// int namelength = databuf.get();
|
||||
// if (namelength > 0) {
|
||||
// byte[] name = new byte[namelength];
|
||||
// for (int idx = 0; idx < namelength; idx++) {
|
||||
// name[idx] = (byte) databuf.get();
|
||||
// }
|
||||
// naviinfo.m_pStrCurName = new String(name, "UTF-8");
|
||||
// }
|
||||
// if (naviinfo.m_pStrCurName == null) {
|
||||
// naviinfo.m_pStrCurName = "无名路";
|
||||
// }
|
||||
// namelength = databuf.get();
|
||||
// if (namelength > 0) {
|
||||
// byte[] name = new byte[namelength];
|
||||
// for (int idx = 0; idx < namelength; idx++) {
|
||||
// name[idx] = (byte) databuf.get();
|
||||
// }
|
||||
// naviinfo.m_pStrNextName = new String(name, "UTF-8");
|
||||
// }
|
||||
// if (naviinfo.m_pStrNextName == null) {
|
||||
// naviinfo.m_pStrNextName = "无名路";
|
||||
// }
|
||||
//
|
||||
// namelength = databuf.get();
|
||||
// if (namelength > 0) {
|
||||
// byte[] name = new byte[namelength];
|
||||
// for (int idx = 0; idx < namelength; idx++) {
|
||||
// name[idx] = (byte) databuf.get();
|
||||
// }
|
||||
// naviinfo.m_EntranceName = new String(name, "UTF-8");
|
||||
// }
|
||||
// if (naviinfo.m_EntranceName == null) {
|
||||
// naviinfo.m_EntranceName = "";
|
||||
// }
|
||||
//
|
||||
// namelength = databuf.get();
|
||||
// if (namelength > 0) {
|
||||
// byte[] name = new byte[namelength];
|
||||
// for (int idx = 0; idx < namelength; idx++) {
|
||||
// name[idx] = (byte) databuf.get();
|
||||
// }
|
||||
// naviinfo.m_ExitName = new String(name, "UTF-8");
|
||||
// }
|
||||
// if (naviinfo.m_ExitName == null) {
|
||||
// naviinfo.m_ExitName = "";
|
||||
// }
|
||||
//
|
||||
// namelength = databuf.get();
|
||||
// if (namelength > 0) {
|
||||
// byte[] name = new byte[namelength];
|
||||
// for (int idx = 0; idx < namelength; idx++) {
|
||||
// name[idx] = (byte) databuf.get();
|
||||
// }
|
||||
// naviinfo.m_ServerName = new String(name, "UTF-8");
|
||||
// }
|
||||
// if (naviinfo.m_ServerName == null) {
|
||||
// naviinfo.m_ServerName = "";
|
||||
// }
|
||||
// if(!NavHelper.INSTANCE.getMNavParams().isCrossingDrawingEnabled()){
|
||||
// naviinfo.m_nImageType = 0;
|
||||
// }
|
||||
// if(!NavHelper.INSTANCE.getMNavParams().isOpenNextRoadInfo()){
|
||||
// naviinfo.m_nNextTurn = 0;
|
||||
// }else {
|
||||
// naviinfo.m_nNextTurn = 1;
|
||||
// }
|
||||
//
|
||||
// if(CompileConfig.INSTANCE.getDEBUG()){
|
||||
// Log.i(TAG, "navop-getNaviInfoData: "+naviinfo);
|
||||
// }
|
||||
// return naviinfo;
|
||||
// } else {
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public NaviInfo getNaviInfoData(byte[] data) throws Exception {
|
||||
// if (data != null) {
|
||||
// NaviInfo naviinfo = new NaviInfo();
|
||||
// ByteBuffer databuf = ByteBuffer.wrap(data);
|
||||
// databuf.order(ByteOrder.LITTLE_ENDIAN);
|
||||
// naviinfo.m_nNaviStatus = (byte) databuf.get();
|
||||
// naviinfo.m_nDistanceToDest = databuf.getInt();
|
||||
// naviinfo.m_nTimeToDest = databuf.getInt();
|
||||
// naviinfo.m_nDistanceToTurn = databuf.getInt();
|
||||
// naviinfo.m_nDistanceToNextTurn = databuf.getInt();
|
||||
// naviinfo.m_nTurnID = databuf.getInt();
|
||||
// naviinfo.m_nNextTurnID = databuf.getInt();
|
||||
// naviinfo.m_nBindLon = databuf.getInt();
|
||||
// naviinfo.m_nBindLat = databuf.getInt();
|
||||
// naviinfo.m_nImageUr = databuf.getInt();
|
||||
// naviinfo.m_nImageBg = databuf.getInt();
|
||||
// naviinfo.m_nImageArrow = databuf.getInt();
|
||||
// naviinfo.m_nImageType = (byte) databuf.get();
|
||||
// naviinfo.m_nSGPImageUr = databuf.getInt();
|
||||
// naviinfo.m_nSGPImageBg = databuf.getInt();
|
||||
// naviinfo.m_nSGPImageArrow = databuf.getInt();
|
||||
// naviinfo.m_nSGPImageType = (byte) databuf.get();
|
||||
// naviinfo.m_nSpeed = databuf.getInt();
|
||||
// naviinfo.m_LaneType = (byte) databuf.get();//车道数
|
||||
// naviinfo.m_Angle = (short) databuf.getShort();
|
||||
// naviinfo.m_IsExport = (byte) databuf.get();
|
||||
// naviinfo.m_EntranceDist = databuf.getShort();
|
||||
// naviinfo.m_ExitDist = databuf.getShort();
|
||||
// naviinfo.m_ServerDist = databuf.getShort();
|
||||
//
|
||||
// int namelength = databuf.get();
|
||||
// if (namelength > 0) {
|
||||
// byte[] name = new byte[namelength];
|
||||
// for (int idx = 0; idx < namelength; idx++) {
|
||||
// name[idx] = (byte) databuf.get();
|
||||
// }
|
||||
// naviinfo.m_pStrCurName = new String(name, "UTF-8");
|
||||
// }
|
||||
// if (naviinfo.m_pStrCurName == null) {
|
||||
// naviinfo.m_pStrCurName = "无名路";
|
||||
// }
|
||||
// namelength = databuf.get();
|
||||
// if (namelength > 0) {
|
||||
// byte[] name = new byte[namelength];
|
||||
// for (int idx = 0; idx < namelength; idx++) {
|
||||
// name[idx] = (byte) databuf.get();
|
||||
// }
|
||||
// naviinfo.m_pStrNextName = new String(name, "UTF-8");
|
||||
// }
|
||||
// if (naviinfo.m_pStrNextName == null) {
|
||||
// naviinfo.m_pStrNextName = "无名路";
|
||||
// }
|
||||
//
|
||||
// namelength = databuf.get();
|
||||
// if (namelength > 0) {
|
||||
// byte[] name = new byte[namelength];
|
||||
// for (int idx = 0; idx < namelength; idx++) {
|
||||
// name[idx] = (byte) databuf.get();
|
||||
// }
|
||||
// naviinfo.m_EntranceName = new String(name, "UTF-8");
|
||||
// }
|
||||
// if (naviinfo.m_EntranceName == null) {
|
||||
// naviinfo.m_EntranceName = "";
|
||||
// }
|
||||
//
|
||||
// namelength = databuf.get();
|
||||
// if (namelength > 0) {
|
||||
// byte[] name = new byte[namelength];
|
||||
// for (int idx = 0; idx < namelength; idx++) {
|
||||
// name[idx] = (byte) databuf.get();
|
||||
// }
|
||||
// naviinfo.m_ExitName = new String(name, "UTF-8");
|
||||
// }
|
||||
// if (naviinfo.m_ExitName == null) {
|
||||
// naviinfo.m_ExitName = "";
|
||||
// }
|
||||
//
|
||||
// namelength = databuf.get();
|
||||
// if (namelength > 0) {
|
||||
// byte[] name = new byte[namelength];
|
||||
// for (int idx = 0; idx < namelength; idx++) {
|
||||
// name[idx] = (byte) databuf.get();
|
||||
// }
|
||||
// naviinfo.m_ServerName = new String(name, "UTF-8");
|
||||
// }
|
||||
// if (naviinfo.m_ServerName == null) {
|
||||
// naviinfo.m_ServerName = "";
|
||||
// }
|
||||
// if(!NavHelper.INSTANCE.getMNavParams().isCrossingDrawingEnabled()){
|
||||
// naviinfo.m_nImageType = 0;
|
||||
// }
|
||||
// if(!NavHelper.INSTANCE.getMNavParams().isOpenNextRoadInfo()){
|
||||
// naviinfo.m_nNextTurn = 0;
|
||||
// }else {
|
||||
// naviinfo.m_nNextTurn = 1;
|
||||
// }
|
||||
// return naviinfo;
|
||||
// } else {
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public String getGuidanceTTS() throws Exception {
|
||||
// String res = null;
|
||||
// byte[] data = getGuidanceSpeech();
|
||||
// if (data != null) {
|
||||
// ByteBuffer databuf = ByteBuffer.wrap(data);
|
||||
// databuf.order(ByteOrder.LITTLE_ENDIAN);
|
||||
// int isRead = databuf.get();
|
||||
// if (isRead == 0) {
|
||||
// return null;
|
||||
// }
|
||||
// int namelength = databuf.get();
|
||||
// if (namelength > 0) {
|
||||
// byte[] name = new byte[namelength];
|
||||
// for (int idx = 0; idx < namelength; idx++) {
|
||||
// name[idx] = (byte) databuf.get();
|
||||
// }
|
||||
// res = new String(name, "UTF-8");
|
||||
// }
|
||||
// }
|
||||
// return res;
|
||||
// }
|
||||
//
|
||||
// public RouteImage getRouteImage(int imageUr, int imageBg, int imageArrow, int type) {
|
||||
// byte[] data = getGuidanceImage(imageUr, imageBg, imageArrow, type);
|
||||
// try {
|
||||
// RouteImage routeImage = new RouteImage();
|
||||
// routeImage.imageArrowID = imageArrow;
|
||||
// routeImage.imageBgID = imageBg;
|
||||
// ByteBuffer databuf = ByteBuffer.wrap(data);
|
||||
// databuf.order(ByteOrder.LITTLE_ENDIAN);
|
||||
// //记录图片1的长度 -- 背景
|
||||
// int bgSize = databuf.getInt();
|
||||
// byte[] image = new byte[bgSize];
|
||||
// for (int idx = 0; idx < bgSize; idx++) {
|
||||
// image[idx] = (byte) databuf.get();
|
||||
// }
|
||||
// routeImage.imageBg = image;
|
||||
// bgSize = databuf.getInt();
|
||||
// byte[] imageArrows = new byte[bgSize];
|
||||
// for (int idx = 0; idx < bgSize; idx++) {
|
||||
// imageArrows[idx] = (byte) databuf.get();
|
||||
// }
|
||||
// routeImage.imageArrow = imageArrows;
|
||||
// return routeImage;
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// public LaneMask getGuidanceNaviLane() {
|
||||
// byte[] data = getGuidanceLane();
|
||||
//
|
||||
// if (data != null && data.length > 0) {
|
||||
// LaneMask mask = new LaneMask();
|
||||
// ByteBuffer databuf = ByteBuffer.wrap(data);
|
||||
// databuf.order(ByteOrder.LITTLE_ENDIAN);
|
||||
// int size = databuf.get();//车道数
|
||||
// mask.m_iSzie = size;
|
||||
//
|
||||
// List<LaneMarkInfo> list = new ArrayList<LaneMarkInfo>(size);
|
||||
// for (int i = 0; i < size; i++) {
|
||||
// LaneMarkInfo info = new LaneMarkInfo();
|
||||
//
|
||||
// int type = databuf.get();
|
||||
// boolean iST = false;
|
||||
// if ((type & LaneMarkTools.UTURN_BIT_MASK) > 0) {
|
||||
// info.isUTurn = true;
|
||||
// iST = true;
|
||||
// }
|
||||
//
|
||||
// if ((type & LaneMarkTools.AHEAD_BIT_MASK) > 0) {
|
||||
// info.isAhead = true;
|
||||
// iST = true;
|
||||
// }
|
||||
//
|
||||
// if ((type & LaneMarkTools.LEFT_ONE_BIT_MASK) > 0) {
|
||||
// info.isLeftOne = true;
|
||||
// iST = true;
|
||||
// }
|
||||
//
|
||||
// if ((type & LaneMarkTools.LEFT_THREE_BIT_MASK) > 0) {
|
||||
// info.isLeftThree = true;
|
||||
// iST = true;
|
||||
// }
|
||||
//
|
||||
// if ((type & LaneMarkTools.LEFT_TWO_BIT_MASK) > 0) {
|
||||
// info.isLeftTwo = true;
|
||||
// iST = true;
|
||||
// }
|
||||
//
|
||||
// if ((type & LaneMarkTools.RIGHT_ONE_BIT_MASK) > 0) {
|
||||
// info.isRightOne = true;
|
||||
// iST = true;
|
||||
// }
|
||||
//
|
||||
// if ((type & LaneMarkTools.RIGHT_THREE_BIT_MASK) > 0) {
|
||||
// info.isRightThree = true;
|
||||
// iST = true;
|
||||
// }
|
||||
//
|
||||
// if ((type & LaneMarkTools.RIGHT_TWO_BIT_MASK) > 0) {
|
||||
// info.isRightTwo = true;
|
||||
// iST = true;
|
||||
// }
|
||||
//
|
||||
// if (iST == false) {
|
||||
// info.isAhead = true;
|
||||
// }
|
||||
//
|
||||
// list.add(info);
|
||||
// }
|
||||
// if (size > 0) {
|
||||
// mask.isHighLightID = databuf.get();//高亮
|
||||
// }
|
||||
// mask.m_nLaneMark = list;
|
||||
// return mask;
|
||||
// } else {
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private native boolean load( INavigationCore naviCore);
|
||||
//
|
||||
// private native void unload();
|
||||
//
|
||||
// public native void startNavi(int type);
|
||||
//
|
||||
// public native void stopNavi();
|
||||
//
|
||||
// public native void pauseSimNavi();
|
||||
//
|
||||
// public native void resumeSimNavi();
|
||||
//
|
||||
// public native void updatePosition(float x, float y, float speed, float heading);
|
||||
//
|
||||
// public native void setSimSpeed(int speed);
|
||||
//
|
||||
// public native byte[] getBookData(int session, int start, int end);
|
||||
//
|
||||
// public native byte[] getNaviInfo();
|
||||
//
|
||||
// public native byte[] getGuidanceSpeech();
|
||||
//
|
||||
// public native byte[] getGuidanceImage(int imageUr, int imageBg, int imageArrow, int type);
|
||||
//
|
||||
// public native byte[] getGuidanceLane();
|
||||
//
|
||||
// public native double getRoadAngle();
|
||||
//
|
||||
//}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.autonavi.nge.guidance;
|
||||
|
||||
import com.zhidaoauto.map.sdk.inner.obj.NavMsg;
|
||||
|
||||
public interface Guidanceinterface {
|
||||
public void OnReceiveMessage(NavMsg navMsg);
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.autonavi.nge.guidance;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
public class LaneMarkInfo implements Parcelable{
|
||||
public static final Creator<LaneMarkInfo> CREATOR = new Creator<LaneMarkInfo>() {
|
||||
public LaneMarkInfo createFromParcel(Parcel in) {
|
||||
LaneMarkInfo info = new LaneMarkInfo();
|
||||
info.isUTurn = in.readByte() == 0 ? false : true;
|
||||
info.isRightOne = in.readByte() == 0 ? false : true;
|
||||
info.isRightTwo = in.readByte() == 0 ? false : true;
|
||||
info.isRightThree = in.readByte() == 0 ? false : true;
|
||||
info.isAhead = in.readByte() == 0 ? false : true;
|
||||
info.isLeftThree = in.readByte() == 0 ? false : true;
|
||||
info.isLeftTwo = in.readByte() == 0 ? false : true;
|
||||
info.isLeftOne = in.readByte() == 0 ? false : true;
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
public LaneMarkInfo[] newArray(int size) {
|
||||
return new LaneMarkInfo[size];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
boolean isUTurn = false;
|
||||
boolean isRightOne = false;
|
||||
boolean isRightTwo = false;
|
||||
boolean isRightThree = false;
|
||||
boolean isAhead = false;
|
||||
boolean isLeftThree = false;
|
||||
boolean isLeftTwo = false;
|
||||
boolean isLeftOne = false;
|
||||
@Override
|
||||
public int describeContents() {
|
||||
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public void writeToParcel(Parcel out, int flags) {
|
||||
|
||||
out.writeByte((byte) (isUTurn?1:0));
|
||||
out.writeByte((byte) (isRightOne?1:0));
|
||||
out.writeByte((byte) (isRightTwo?1:0));
|
||||
out.writeByte((byte) (isRightThree?1:0));
|
||||
out.writeByte((byte) (isAhead?1:0));
|
||||
out.writeByte((byte) (isLeftThree?1:0));
|
||||
out.writeByte((byte) (isLeftTwo?1:0));
|
||||
out.writeByte((byte) (isLeftOne?1:0));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LaneMarkInfo{" +
|
||||
"isUTurn=" + isUTurn +
|
||||
", isRightOne=" + isRightOne +
|
||||
", isRightTwo=" + isRightTwo +
|
||||
", isRightThree=" + isRightThree +
|
||||
", isAhead=" + isAhead +
|
||||
", isLeftThree=" + isLeftThree +
|
||||
", isLeftTwo=" + isLeftTwo +
|
||||
", isLeftOne=" + isLeftOne +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,75 @@
|
||||
package com.autonavi.nge.guidance;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LaneMask implements Parcelable{
|
||||
|
||||
public static final Creator<LaneMask> CREATOR = new Creator<LaneMask>() {
|
||||
public LaneMask createFromParcel(Parcel in) {
|
||||
int size = in.readByte();
|
||||
int hight = in.readByte();
|
||||
List<LaneMarkInfo> item = (ArrayList<LaneMarkInfo>)(in.readArrayList(LaneMarkInfo.class.getClassLoader()));
|
||||
return new LaneMask(size, hight, item);
|
||||
}
|
||||
|
||||
public LaneMask[] newArray(int size) {
|
||||
return new LaneMask[size];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
int m_iSzie;
|
||||
List<LaneMarkInfo> m_nLaneMark = new ArrayList<LaneMarkInfo>();
|
||||
int isHighLightID = 0;
|
||||
|
||||
public LaneMask()
|
||||
{}
|
||||
|
||||
public LaneMask(int size,int highID,List<LaneMarkInfo> info)
|
||||
{
|
||||
m_iSzie = size;
|
||||
isHighLightID = highID;
|
||||
m_nLaneMark = info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public void writeToParcel(Parcel out, int flags) {
|
||||
|
||||
out.writeByte((byte) m_iSzie);
|
||||
out.writeByte((byte) isHighLightID);
|
||||
out.writeList(m_nLaneMark);
|
||||
}
|
||||
|
||||
public int getM_iSzie() {
|
||||
return m_iSzie;
|
||||
}
|
||||
|
||||
public void setM_iSzie(int m_iSzie) {
|
||||
this.m_iSzie = m_iSzie;
|
||||
}
|
||||
|
||||
public List<LaneMarkInfo> getM_nLaneMark() {
|
||||
return m_nLaneMark;
|
||||
}
|
||||
|
||||
public void setM_nLaneMark(List<LaneMarkInfo> m_nLaneMark) {
|
||||
this.m_nLaneMark = m_nLaneMark;
|
||||
}
|
||||
|
||||
public int getIsHighLightID() {
|
||||
return isHighLightID;
|
||||
}
|
||||
|
||||
public void setIsHighLightID(int isHighLightID) {
|
||||
this.isHighLightID = isHighLightID;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.autonavi.nge.guidance;
|
||||
|
||||
|
||||
import com.zhidaoauto.map.sdk.R;
|
||||
|
||||
public class NaviDirRes {
|
||||
private static int m_idirNum = 50;
|
||||
private static int[] m_idirID = new int[m_idirNum];
|
||||
private static int[] m_iresID = new int[m_idirNum];
|
||||
private static int[] m_iNaviResID = new int[m_idirNum];
|
||||
|
||||
static {
|
||||
int i = 0;
|
||||
m_idirID[i] = 1;
|
||||
m_iresID[i] = R.mipmap.icon1001;
|
||||
m_iNaviResID[i++] = R.mipmap.navi_s_1;
|
||||
m_idirID[i] = 2;
|
||||
m_iresID[i] = R.mipmap.icon1002;
|
||||
m_iNaviResID[i++] = R.mipmap.navi_s_2;
|
||||
m_idirID[i] = 3;
|
||||
m_iresID[i] = R.mipmap.icon1003;
|
||||
m_iNaviResID[i++] = R.mipmap.navi_s_3;
|
||||
m_idirID[i] = 4;
|
||||
m_iresID[i] = R.mipmap.icon1004;
|
||||
m_iNaviResID[i++] = R.mipmap.navi_s_4;
|
||||
m_idirID[i] = 5;
|
||||
m_iresID[i] = R.mipmap.icon1005;
|
||||
m_iNaviResID[i++] = R.mipmap.navi_s_5;
|
||||
m_idirID[i] = 6;
|
||||
m_iresID[i] = R.mipmap.icon1006;
|
||||
m_iNaviResID[i++] = R.mipmap.navi_s_6;
|
||||
m_idirID[i] = 7;
|
||||
m_iresID[i] = R.mipmap.icon1007;
|
||||
m_iNaviResID[i++] = R.mipmap.navi_s_7;
|
||||
m_idirID[i] = 8;
|
||||
m_iresID[i] = R.mipmap.icon1008;
|
||||
m_iNaviResID[i++] = R.mipmap.navi_s_8;
|
||||
m_idirID[i] = 9;
|
||||
m_iresID[i] = R.mipmap.icon1009;
|
||||
m_iNaviResID[i++] = R.mipmap.navi_s_9;
|
||||
m_idirID[i] = 10;
|
||||
m_iresID[i] = R.mipmap.icon1010;
|
||||
m_iNaviResID[i++] = R.mipmap.navi_s_10;
|
||||
m_idirID[i] = 11;
|
||||
m_iresID[i] = R.mipmap.icon1011;
|
||||
m_iNaviResID[i++] = R.mipmap.navi_s_11;
|
||||
m_idirID[i] = 12;
|
||||
m_iresID[i] = R.mipmap.icon1012;
|
||||
m_iNaviResID[i++] = R.mipmap.navi_s_12;
|
||||
m_idirID[i] = 13;
|
||||
m_iresID[i] = R.mipmap.icon1013;
|
||||
m_iNaviResID[i++] = R.mipmap.navi_s_13;
|
||||
m_idirID[i] = 14;
|
||||
m_iresID[i] = R.mipmap.icon1014;
|
||||
m_iNaviResID[i++] = R.mipmap.navi_s_14;
|
||||
m_idirID[i] = 15;
|
||||
m_iresID[i] = R.mipmap.icon1015;
|
||||
m_iNaviResID[i++] = R.mipmap.navi_s_15;
|
||||
m_idirID[i] = 22;
|
||||
m_iresID[i] = R.mipmap.icon1022;
|
||||
m_iNaviResID[i++] = R.mipmap.navi_s_22;
|
||||
m_idirID[i] = 27;
|
||||
m_iresID[i] = R.mipmap.icon1027;
|
||||
m_iNaviResID[i++] = R.mipmap.navi_s_27;
|
||||
m_idirID[i] = 28;
|
||||
m_iresID[i] = R.mipmap.icon1028;
|
||||
m_iNaviResID[i++] = R.mipmap.navi_s_28;
|
||||
m_idirID[i] = 29;
|
||||
m_iresID[i] = R.mipmap.icon1029;
|
||||
m_iNaviResID[i++] = R.mipmap.navi_s_29;
|
||||
/*m_idirID[i] = 30;
|
||||
m_iresID[i] = R.mipmap.icon1030;
|
||||
*/
|
||||
m_idirID[i] = 35;
|
||||
m_iresID[i] = R.mipmap.icon1035;
|
||||
m_iNaviResID[i++] = R.mipmap.navi_s_35;
|
||||
m_idirID[i] = 42;
|
||||
m_iresID[i] = R.mipmap.icon1042;
|
||||
m_iNaviResID[i++] = R.mipmap.navi_s_42;
|
||||
m_idirID[i] = 43;
|
||||
m_iresID[i] = R.mipmap.icon1043;
|
||||
m_iNaviResID[i++] = R.mipmap.navi_s_43;
|
||||
m_idirID[i] = 44;
|
||||
m_iresID[i] = R.mipmap.icon1044;
|
||||
m_iNaviResID[i++] = R.mipmap.navi_s_44;
|
||||
/*m_idirID[i] = 45;
|
||||
m_iresID[i] = R.mipmap.icon1045;*/
|
||||
m_idirID[i] = 501;
|
||||
m_iresID[i] = R.mipmap.icon1501;
|
||||
m_iNaviResID[i++] = R.mipmap.navi_s_501;
|
||||
m_idirID[i] = 502;
|
||||
m_iresID[i] = R.mipmap.icon1502;
|
||||
m_iNaviResID[i++] = R.mipmap.navi_s_502;
|
||||
m_idirID[i] = 503;
|
||||
m_iresID[i] = R.mipmap.icon1503;
|
||||
m_iNaviResID[i++] = R.mipmap.navi_s_503;
|
||||
|
||||
}
|
||||
|
||||
public static int getNextNaviResID(int nID)
|
||||
{
|
||||
|
||||
for (int i = 0; i < m_idirID.length; i++) {
|
||||
if (m_idirID[i] == nID) {
|
||||
return m_iresID[i];
|
||||
}
|
||||
}
|
||||
return R.mipmap.icon1001;
|
||||
|
||||
}
|
||||
|
||||
public static int getNaviResID(int nID)
|
||||
{
|
||||
for (int i = 0; i < m_idirID.length; i++) {
|
||||
if (m_idirID[i] == nID) {
|
||||
return m_iNaviResID[i];
|
||||
}
|
||||
}
|
||||
return R.mipmap.navi_s_1;
|
||||
}
|
||||
/**
|
||||
* @param nID
|
||||
* @return
|
||||
*/
|
||||
public static int getResID(int nID) {
|
||||
for (int i = 0; i < m_idirID.length; i++) {
|
||||
if (m_idirID[i] == nID) {
|
||||
return m_iresID[i];
|
||||
}
|
||||
}
|
||||
|
||||
return R.mipmap.icon1001;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
package com.autonavi.nge.guidance;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
public class NaviInfo implements Parcelable {
|
||||
|
||||
public static final Creator<NaviInfo> CREATOR = new Creator<NaviInfo>() {
|
||||
public NaviInfo createFromParcel(Parcel in) {
|
||||
int nDistanceToDest = in.readInt();
|
||||
int nTimeToDest = in.readInt();
|
||||
int nDistanceToTurn = in.readInt();
|
||||
int nDistanceToNextTurn = in.readInt();
|
||||
int nTurnID = in.readInt();
|
||||
int nNextTurnID = in.readInt();
|
||||
int lon = in.readInt();
|
||||
int lat = in.readInt();
|
||||
int imageur = in.readInt();
|
||||
int imagebg = in.readInt();
|
||||
int imagearrow = in.readInt();
|
||||
byte imagetype = in.readByte();
|
||||
int sgpimageur = in.readInt();
|
||||
int sgpimagebg = in.readInt();
|
||||
int sgpimagearrow = in.readInt();
|
||||
byte sgpimagetype = in.readByte();
|
||||
String pStrCurName = in.readString();
|
||||
String pStrNextName = in.readString();
|
||||
int speed = in.readInt();
|
||||
byte laneType = in.readByte();
|
||||
short angle = (short) in.readInt();
|
||||
byte export = in.readByte();
|
||||
byte status = in.readByte();
|
||||
int entrance = in.readInt();
|
||||
int server = in.readInt();
|
||||
int exit = in.readInt();
|
||||
String servername = in.readString();
|
||||
String exitname = in.readString();
|
||||
String entrancename = in.readString();
|
||||
|
||||
return new NaviInfo(nDistanceToDest, nTimeToDest, nDistanceToTurn, nDistanceToNextTurn, nTurnID, nNextTurnID, lon, lat, imageur,
|
||||
imagebg, imagearrow, imagetype, sgpimageur, sgpimagebg, sgpimagearrow, sgpimagetype, pStrCurName,
|
||||
pStrNextName, speed, laneType, angle, export, status, entrance, server, exit, servername, exitname, entrancename);
|
||||
}
|
||||
|
||||
public NaviInfo[] newArray(int size) {
|
||||
return new NaviInfo[size];
|
||||
}
|
||||
};
|
||||
|
||||
public byte m_nNaviStatus;//导航状态
|
||||
public int m_nDistanceToDest;//到达目的地的距离
|
||||
public int m_nTimeToDest;//到达目的地的时间
|
||||
public int m_nDistanceToTurn;//距离转向点距离
|
||||
public int m_nDistanceToNextTurn;//距离下一个转向点距离
|
||||
public int m_nTurnID;//转向点图标id
|
||||
public int m_nNextTurnID; //下一转向点图标id
|
||||
|
||||
public int m_nBindLon; //绑定点经度
|
||||
public int m_nBindLat; //绑定点纬度
|
||||
|
||||
public int m_nSpeed; //速度
|
||||
|
||||
public int m_nImageUr; //UR id, 省
|
||||
public int m_nImageBg; //背景id
|
||||
public int m_nImageArrow;//箭头id
|
||||
public byte m_nImageType;//是否显示 0 不显示 1 显示
|
||||
|
||||
public int m_nSGPImageUr;//方向看板 UR id
|
||||
public int m_nSGPImageBg;//方向看板 背景id
|
||||
public int m_nSGPImageArrow;//方向看板 箭头id
|
||||
public byte m_nSGPImageType;//方向看板 是否显示
|
||||
|
||||
public String m_pStrCurName;//当前路名
|
||||
public String m_pStrNextName;//下一条路名
|
||||
|
||||
public byte m_LaneType; //车道标记
|
||||
|
||||
public short m_Angle; //车头角度
|
||||
|
||||
public byte m_IsExport; //是否是出口
|
||||
public int m_ServerDist; //服务区距离
|
||||
public int m_EntranceDist; //入口距离
|
||||
public int m_ExitDist; //出口距离
|
||||
|
||||
public String m_ServerName; //服务器名称
|
||||
public String m_ExitName; //出口名称
|
||||
public String m_EntranceName;//入口名称
|
||||
public int m_nNextTurn; //第二个路口转向是否显示 0 不显示 1 显示
|
||||
|
||||
public NaviInfo() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public NaviInfo(int disTodest, int time, int disToturn, int disToNextTurn, int turnID, int nextruenID, int bindlon, int bindlat, int imageur, int imagebg, int imagearrow, byte imagetype,
|
||||
int sgpimageur, int sgpimagebg, int sgpimagearrow, byte sgpimagetype, String curName, String nextName,
|
||||
int speed, byte lane, short angle, byte export, byte status, int entrance, int server, int exit, String servername, String exitname, String enterfacename) {
|
||||
m_nDistanceToDest = disTodest;
|
||||
m_nTimeToDest = time;
|
||||
m_nDistanceToTurn = disToturn;
|
||||
m_nDistanceToNextTurn = disToNextTurn;
|
||||
m_nTurnID = turnID;
|
||||
m_pStrCurName = curName;
|
||||
m_pStrNextName = nextName;
|
||||
m_nBindLon = bindlon;
|
||||
m_nBindLat = bindlat;
|
||||
m_nImageUr = imageur;
|
||||
m_nImageBg = imagebg;
|
||||
m_nImageArrow = imagearrow;
|
||||
m_nImageType = imagetype;
|
||||
m_nSGPImageUr = sgpimageur;
|
||||
m_nSGPImageBg = sgpimagebg;
|
||||
m_nSGPImageArrow = sgpimagearrow;
|
||||
m_nSGPImageType = sgpimagetype;
|
||||
m_nNextTurnID = nextruenID;
|
||||
m_nSpeed = speed;
|
||||
m_LaneType = lane;
|
||||
m_Angle = angle;
|
||||
m_IsExport = export;
|
||||
m_nNaviStatus = status;
|
||||
m_ServerDist = server;
|
||||
m_EntranceDist = entrance;
|
||||
m_ExitDist = exit;
|
||||
|
||||
m_ServerName = servername;
|
||||
m_ExitName = exitname;
|
||||
m_EntranceName = enterfacename;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel out, int flags) {
|
||||
|
||||
out.writeInt(m_nDistanceToDest);
|
||||
out.writeInt(m_nTimeToDest);
|
||||
out.writeInt(m_nDistanceToTurn);
|
||||
out.writeInt(m_nDistanceToNextTurn);
|
||||
out.writeInt(m_nTurnID);
|
||||
out.writeInt(m_nNextTurnID);
|
||||
out.writeInt(m_nBindLon);
|
||||
out.writeInt(m_nBindLat);
|
||||
out.writeInt(m_nImageUr);
|
||||
out.writeInt(m_nImageBg);
|
||||
out.writeInt(m_nImageArrow);
|
||||
out.writeByte(m_nImageType);
|
||||
out.writeInt(m_nSGPImageUr);
|
||||
out.writeInt(m_nSGPImageBg);
|
||||
out.writeInt(m_nSGPImageArrow);
|
||||
out.writeByte(m_nSGPImageType);
|
||||
out.writeString(m_pStrCurName);
|
||||
out.writeString(m_pStrNextName);
|
||||
out.writeInt(m_nSpeed);
|
||||
out.writeByte(m_LaneType);
|
||||
out.writeInt(m_Angle);
|
||||
out.writeByte(m_IsExport);
|
||||
out.writeByte(m_nNaviStatus);
|
||||
out.writeInt(m_EntranceDist);
|
||||
out.writeInt(m_ServerDist);
|
||||
out.writeInt(m_ExitDist);
|
||||
out.writeString(m_ServerName);
|
||||
out.writeString(m_ExitName);
|
||||
out.writeString(m_EntranceName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NaviInfo{" +
|
||||
"m_nNaviStatus=" + m_nNaviStatus +
|
||||
", m_nDistanceToDest=" + m_nDistanceToDest +
|
||||
", m_nTimeToDest=" + m_nTimeToDest +
|
||||
", m_nDistanceToTurn=" + m_nDistanceToTurn +
|
||||
", m_nDistanceToNextTurn=" + m_nDistanceToNextTurn +
|
||||
", m_nTurnID=" + m_nTurnID +
|
||||
", m_nNextTurnID=" + m_nNextTurnID +
|
||||
", m_nBindLon=" + m_nBindLon +
|
||||
", m_nBindLat=" + m_nBindLat +
|
||||
", m_nSpeed=" + m_nSpeed +
|
||||
", m_nImageUr=" + m_nImageUr +
|
||||
", m_nImageBg=" + m_nImageBg +
|
||||
", m_nImageArrow=" + m_nImageArrow +
|
||||
", m_nImageType=" + m_nImageType +
|
||||
", m_nSGPImageUr=" + m_nSGPImageUr +
|
||||
", m_nSGPImageBg=" + m_nSGPImageBg +
|
||||
", m_nSGPImageArrow=" + m_nSGPImageArrow +
|
||||
", m_nSGPImageType=" + m_nSGPImageType +
|
||||
", m_pStrCurName='" + m_pStrCurName + '\'' +
|
||||
", m_pStrNextName='" + m_pStrNextName + '\'' +
|
||||
", m_LaneType=" + m_LaneType +
|
||||
", m_Angle=" + m_Angle +
|
||||
", m_IsExport=" + m_IsExport +
|
||||
", m_ServerDist=" + m_ServerDist +
|
||||
", m_EntranceDist=" + m_EntranceDist +
|
||||
", m_ExitDist=" + m_ExitDist +
|
||||
", m_ServerName='" + m_ServerName + '\'' +
|
||||
", m_ExitName='" + m_ExitName + '\'' +
|
||||
", m_EntranceName='" + m_EntranceName + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.autonavi.nge.guidance;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RouteBook implements Parcelable{
|
||||
|
||||
public static final Creator<RouteBook> CREATOR = new Creator<RouteBook>() {
|
||||
public RouteBook createFromParcel(Parcel in) {
|
||||
int totalLength = in.readInt();
|
||||
int totalTime = in.readInt();
|
||||
int itemLength = in.readInt();
|
||||
List<RouteBookItem> item = (ArrayList<RouteBookItem>)(in.readArrayList(RouteBookItem.class.getClassLoader()));
|
||||
return new RouteBook(totalLength, totalTime, itemLength, item);
|
||||
}
|
||||
|
||||
public RouteBook[] newArray(int size) {
|
||||
return new RouteBook[size];
|
||||
}
|
||||
};
|
||||
|
||||
public int totalLength;
|
||||
public int totalTime;
|
||||
public int itemSize;
|
||||
public List<RouteBookItem> bookdata = new ArrayList<RouteBookItem>();
|
||||
|
||||
public RouteBook(int totalLength,int totalTime,int itemSize,List<RouteBookItem> items)
|
||||
{
|
||||
this.totalLength = totalLength;
|
||||
this.totalTime = totalTime;
|
||||
this.itemSize = itemSize;
|
||||
this.bookdata = items;
|
||||
}
|
||||
@Override
|
||||
public int describeContents() {
|
||||
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public void writeToParcel(Parcel out, int paramInt) {
|
||||
|
||||
out.writeInt(totalLength);
|
||||
out.writeInt(totalTime);
|
||||
out.writeInt(itemSize);
|
||||
out.writeList(bookdata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RouteBook{" +
|
||||
"totalLength=" + totalLength +
|
||||
", totalTime=" + totalTime +
|
||||
", itemSize=" + itemSize +
|
||||
", bookdata=" + bookdata +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.autonavi.nge.guidance
|
||||
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.zhidaoauto.map.sdk.R
|
||||
import com.zhidaoauto.map.sdk.inner.CompileConfig
|
||||
import java.text.DecimalFormat
|
||||
|
||||
class RouteBookAdapter : BaseQuickAdapter<RouteBookItem, BaseViewHolder>(R.layout.routebook_child_item) {
|
||||
|
||||
private val TAG = javaClass.simpleName
|
||||
|
||||
|
||||
override fun getDefItemCount(): Int {
|
||||
return super.getDefItemCount()
|
||||
}
|
||||
|
||||
override fun convert(helper: BaseViewHolder, item: RouteBookItem) {
|
||||
if (CompileConfig.DEBUG) {
|
||||
Log.i(TAG, "routebookop--helper.adapterPosition:${helper.adapterPosition}")
|
||||
}
|
||||
when (helper.adapterPosition) {
|
||||
0 -> {
|
||||
helper.getView<LinearLayout>(R.id.routebook_child_item_info_ll).visibility = View.VISIBLE
|
||||
helper.getView<ImageView>(R.id.imgView).setImageResource(NaviDirRes.getResID(501))
|
||||
helper.getView<TextView>(R.id.orientation).text = "从${item.routeName?:"起点"}出发"
|
||||
helper.getView<TextView>(R.id.length).visibility = View.GONE
|
||||
}
|
||||
else -> {
|
||||
helper.getView<TextView>(R.id.orientation).text = item.routeName
|
||||
helper.getView<ImageView>(R.id.imgView).setImageResource(NaviDirRes.getResID(item.turnID))
|
||||
if (item.routeName == "目的地") {
|
||||
helper.getView<TextView>(R.id.length).visibility = View.GONE
|
||||
} else {
|
||||
helper.getView<TextView>(R.id.length).visibility = View.VISIBLE
|
||||
val i = item.routelength
|
||||
if (i > 1000) {
|
||||
val df = DecimalFormat("#.0")
|
||||
val string = df.format(i.toDouble() / 1000)
|
||||
val strs = string.split(".")
|
||||
if (strs.size >= 2 && strs[1] == "0") {
|
||||
helper.getView<TextView>(R.id.length).text = """继续前行${strs[0]}km${item.routeSpeech}""".trimIndent()
|
||||
} else {
|
||||
helper.getView<TextView>(R.id.length).text = """继续前行${string}km${item.routeSpeech}""".trimIndent()
|
||||
}
|
||||
} else {
|
||||
helper.getView<TextView>(R.id.length).text = """继续前行${i}m${item.routeSpeech}""".trimIndent()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.autonavi.nge.guidance;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
public class RouteBookItem implements Parcelable{
|
||||
|
||||
public static final Creator<RouteBookItem> CREATOR = new Creator<RouteBookItem>() {
|
||||
public RouteBookItem createFromParcel(Parcel in) {
|
||||
int titleID = in.readInt();
|
||||
int linkid = in.readInt();
|
||||
int routelength = in.readInt();
|
||||
int routeTime = in.readInt();
|
||||
String routeName = in.readString();
|
||||
String routeSpeech = in.readString();
|
||||
int lon = in.readInt();
|
||||
int lat = in.readInt();
|
||||
int turnID = in.readInt();
|
||||
|
||||
return new RouteBookItem(titleID,linkid,routelength,routeTime,routeName,routeSpeech,lon,lat,turnID);
|
||||
}
|
||||
|
||||
public RouteBookItem[] newArray(int size) {
|
||||
return new RouteBookItem[size];
|
||||
}
|
||||
};
|
||||
public RouteBookItem()
|
||||
{}
|
||||
|
||||
public RouteBookItem(int titleID,int linkid,int routelength,int routeTime,String routeName,
|
||||
String routeSpeech,int lon,int lat,int turnID)
|
||||
{
|
||||
this.titleID = titleID;
|
||||
this.linkid = linkid;
|
||||
this.routelength = routelength;
|
||||
this.routeTime = routeTime;
|
||||
this.routeName = routeName;
|
||||
this.routeSpeech = routeSpeech;
|
||||
this.lon = lon;
|
||||
this.lat = lat;
|
||||
this.turnID = turnID;
|
||||
}
|
||||
|
||||
public int titleID;
|
||||
public int linkid;
|
||||
public int routelength;
|
||||
public int routeTime;
|
||||
public String routeName;
|
||||
public String routeSpeech;
|
||||
public int lon;
|
||||
public int lat;
|
||||
public int turnID;
|
||||
// 显示使用
|
||||
public int type = 0;
|
||||
@Override
|
||||
public int describeContents() {
|
||||
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public void writeToParcel(Parcel out, int paramInt) {
|
||||
|
||||
out.writeInt(titleID);
|
||||
out.writeInt(linkid);
|
||||
out.writeInt(routelength);
|
||||
out.writeInt(routeTime);
|
||||
out.writeString(routeName);
|
||||
out.writeString(routeSpeech);
|
||||
out.writeInt(lon);
|
||||
out.writeInt(lat);
|
||||
out.writeInt(turnID);
|
||||
}
|
||||
|
||||
public void readFromParcel(Parcel in) {
|
||||
titleID = in.readInt();
|
||||
linkid = in.readInt();
|
||||
routelength = in.readInt();
|
||||
routeTime = in.readInt();
|
||||
routeName = in.readString();
|
||||
routeSpeech = in.readString();
|
||||
lon = in.readInt();
|
||||
lat = in.readInt();
|
||||
turnID = in.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RouteBookItem{" +
|
||||
"titleID=" + titleID +
|
||||
", linkid=" + linkid +
|
||||
", routelength=" + routelength +
|
||||
", routeTime=" + routeTime +
|
||||
", routeName='" + routeName + '\'' +
|
||||
", routeSpeech='" + routeSpeech + '\'' +
|
||||
", lon=" + lon +
|
||||
", lat=" + lat +
|
||||
", turnID=" + turnID +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.autonavi.nge.guidance;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
public class RouteImage implements Parcelable{
|
||||
|
||||
public static final Creator<RouteImage> CREATOR = new Creator<RouteImage>() {
|
||||
public RouteImage createFromParcel(Parcel in) {
|
||||
int imageBgID = in.readInt();
|
||||
int imageBgSize = in.readInt();
|
||||
byte[] imageBg = new byte[imageBgSize];
|
||||
in.readByteArray(imageBg);
|
||||
int imageArrowID = in.readInt();
|
||||
int imageArrowSize = in.readInt();
|
||||
byte[] imageArrow = new byte[imageArrowSize];
|
||||
in.readByteArray(imageArrow);
|
||||
|
||||
return new RouteImage(imageBg, imageArrow);
|
||||
}
|
||||
|
||||
public RouteImage[] newArray(int size) {
|
||||
return new RouteImage[size];
|
||||
}
|
||||
};
|
||||
|
||||
public RouteImage()
|
||||
{}
|
||||
public RouteImage(byte[] imageBgs,byte[] imageArrows)
|
||||
{
|
||||
imageBg = imageBgs;
|
||||
imageArrow = imageArrows;
|
||||
}
|
||||
|
||||
public int imageBgID = 0;
|
||||
public int imageArrowID = 0;
|
||||
public byte[] imageBg = new byte[0];
|
||||
public byte[] imageArrow = new byte[0];
|
||||
@Override
|
||||
public int describeContents() {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
|
||||
dest.writeInt(imageBgID);
|
||||
dest.writeInt(imageBg.length);
|
||||
dest.writeByteArray(imageBg);
|
||||
dest.writeInt(imageArrowID);
|
||||
dest.writeInt(imageArrow.length);
|
||||
dest.writeByteArray(imageArrow);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user