地图模块代码更新3.0.0
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
package com.autonavi.nge;
|
||||
|
||||
public class Common {
|
||||
static {
|
||||
System.loadLibrary("common");
|
||||
}
|
||||
public native void setCfgKeyVal(String key, String val);
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.autonavi.nge;
|
||||
|
||||
import static com.amap.api.navi.AmapNaviPage.TAG;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.zhidaoauto.map.sdk.inner.CompileConfig;
|
||||
import com.zhidaoauto.map.sdk.inner.road.RoadResultController;
|
||||
|
||||
public class MapBox {
|
||||
static {
|
||||
System.loadLibrary("map");
|
||||
}
|
||||
public MapBox(){
|
||||
llaInit(this);
|
||||
}
|
||||
public native void llaInit(MapBox mapBox);
|
||||
public native void llaGetCenterLine(double dLon, double dLat, float fAngle);
|
||||
public native void llaStopLine(double dLon, double dLat, float fAngle);
|
||||
public native void llaGetZebraLine(double dLon, double dLat, float fAngle);
|
||||
public native void llaGetTrafficLight(double dLon, double dLat, float fAngle);
|
||||
public native void llaMergedRoadRect(double dLon, double dLat, float fAngle);
|
||||
public native void llaGetRoadLimitSpeed(double dLon, double dLat, float fAngle);
|
||||
public native void llaGetCenterLineRange(double dLon, double dLat, float fAngle,float fDis);
|
||||
public native void llaGetRoadName(double dLon, double dLat, float fAngle);
|
||||
public native void llaGetCenterLineRoadNode(double dLon, double dLat, float fAngle,float fDis);
|
||||
public native void llaGetCrossRoad(double dLon, double dLat, float fAngle);
|
||||
public native void llaGetCrossRoadById(int tileId, long id);
|
||||
public native void llaIsInZebraLine(double dLon, double dLat, float fAngle);
|
||||
public native void llaGetZebraLineByDistance(double dLon, double dLat, float fAngle,float dis);
|
||||
|
||||
public native void updateCacheFile();
|
||||
public native void modifyRedisFileVersion(int version);
|
||||
|
||||
/*@return value format: cityCode1,chineseCityName1,englishCityName1,isCache1;cityCode2,chineseCityName2,englishCityName2,isCache2;...;*/
|
||||
public native void getAllCityCode();
|
||||
|
||||
public native void cacheHDDataByCity(int id);
|
||||
|
||||
public native void getCityCode(double lon, double lat);
|
||||
|
||||
public native void getCacheProgressByCity(int id);
|
||||
|
||||
public native void cacheHDDataByCityLonLat(double lon,double lat);
|
||||
public native void cancelCacheHDData();
|
||||
public native void initFileCacheByCity(double lon, double lat);
|
||||
|
||||
public native void getHdDataVersionByCity(double lon,double lat);
|
||||
|
||||
public native void llaRelease();
|
||||
|
||||
static void resultCallback(String key,String result){
|
||||
if(CompileConfig.INSTANCE.getDEBUG()){
|
||||
Log.d(TAG, "roadop--resultCallback: " +"key:" + key + " result:" + result);
|
||||
}
|
||||
RoadResultController.getInstance().dispatchRoadResult(0,key,result);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.autonavi.nge
|
||||
|
||||
object NLog {
|
||||
|
||||
/**设置log等级,控制log输出
|
||||
* @param level 0,error,1,warn,2,info
|
||||
*/
|
||||
external fun setLevel(level : Int)
|
||||
/**设置是否输出文件日志
|
||||
* @param write 是否输出文件日志
|
||||
*/
|
||||
external fun setWriteFile(write: Boolean)
|
||||
/**
|
||||
*关闭log输出
|
||||
*/
|
||||
external fun close()
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.autonavi.nge;
|
||||
|
||||
public class PBJNI {
|
||||
// declaration of id1
|
||||
public static final int ID1_NETWORK = 1;
|
||||
public static final int ID1_ROUTING = 2;
|
||||
public static final int ID1_SEARCH = 3;
|
||||
public static final int ID1_GUIDANCE = 4;
|
||||
public static final int ID1_DISPLAY = 5;
|
||||
|
||||
// delcaration of id2 in network
|
||||
public static final int ID2_NETWORK = 1;
|
||||
public static final int ID2_REGION = 2;
|
||||
public static final int ID2_TILE = 3;
|
||||
public static final int ID2_NODE = 4;
|
||||
public static final int ID2_LINK = 5;
|
||||
public static final int ID2_MAPMATCH = 6;
|
||||
|
||||
// declaration of id2 in routing
|
||||
public static final int ID2_ROUTE = 1;
|
||||
public static final int ID2_ETA = 2;
|
||||
|
||||
// declaration of id2 in search
|
||||
public static final int ID2_AUTOCOMPLETE = 1;
|
||||
public static final int ID2_POISEARCH = 2;
|
||||
|
||||
// declaration of id2 in guidance
|
||||
public static final int ID2_GUIDANCE = 1;
|
||||
|
||||
// declaration of id2 in display
|
||||
public static final int ID2_DISPLAY = 1;
|
||||
|
||||
public byte[] fetchData(int id1, int id2, byte[] data) {
|
||||
return pb_service(id1, id2, data);
|
||||
}
|
||||
|
||||
public boolean pbLoad(Object dm) {
|
||||
return pb_load(dm);
|
||||
}
|
||||
|
||||
public void pbunload() {
|
||||
pb_unload();
|
||||
}
|
||||
|
||||
private native static boolean pb_load(Object binder);
|
||||
private native static void pb_unload();
|
||||
private static native byte[] pb_service(int id1, int id2, byte[] data);
|
||||
}
|
||||
@@ -0,0 +1,237 @@
|
||||
package com.autonavi.nge.dataaccdss;
|
||||
|
||||
import android.os.IBinder;
|
||||
import android.util.Log;
|
||||
|
||||
import com.autonavi.nge.obj.Category;
|
||||
import com.autonavi.nge.obj.PoiBase;
|
||||
import com.autonavi.nge.obj.SubCategory;
|
||||
import com.autonavi.nge.obj.UpdateRegion;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DataAccessProvider {
|
||||
|
||||
private IBinder mBinder;
|
||||
public DataAccessProvider(IBinder binder) {
|
||||
|
||||
mBinder = binder;
|
||||
loadda(mBinder);
|
||||
}
|
||||
|
||||
{
|
||||
System.loadLibrary("datascript");
|
||||
System.loadLibrary("ndssystem");
|
||||
System.loadLibrary("ndssqlite");
|
||||
System.loadLibrary("ndsprovider");
|
||||
System.loadLibrary("datamgr");
|
||||
System.loadLibrary("dataaccess");
|
||||
}
|
||||
|
||||
public void destroyProvider()
|
||||
{
|
||||
unloadda();
|
||||
}
|
||||
/*
|
||||
public void getBmdTileByDA(int urid, int tileid)
|
||||
{
|
||||
getBmdTile( urid, tileid);
|
||||
}
|
||||
|
||||
public void getDtmTileByDA(int urid, int tileid)
|
||||
{
|
||||
getDtmTile( urid, tileid);
|
||||
}
|
||||
|
||||
public void getTexImgByDA(int urid, int texid)
|
||||
{
|
||||
getTexImg ( urid, texid);
|
||||
}
|
||||
|
||||
public void getSpaBlobByDA(int urid, int treeid)
|
||||
{
|
||||
getSpaBlob( urid, treeid);
|
||||
}
|
||||
|
||||
public void getGeoBlobByDA(int urid, int objid)
|
||||
{
|
||||
getGeoBlob( urid, objid);
|
||||
}
|
||||
|
||||
public void getRtTileByDA (int urid, int tileid)
|
||||
{
|
||||
getRtTile ( urid, tileid);
|
||||
}
|
||||
|
||||
public void getRtGTileByDA(int urid, int tileid)
|
||||
{
|
||||
getRtGTile( urid, tileid);
|
||||
}
|
||||
*/
|
||||
public List<UpdateRegion> getURListByDA(int prodid) throws Exception {
|
||||
List<UpdateRegion> list = new ArrayList<UpdateRegion>();
|
||||
//native方法
|
||||
byte[] urData = getURList(prodid);
|
||||
if (null != urData && urData.length > 0) {
|
||||
ByteBuffer databuf = ByteBuffer.wrap(urData);
|
||||
int urCnt = databuf.getInt();
|
||||
for (int iLoop = 0; iLoop < urCnt; ++iLoop) {
|
||||
UpdateRegion ur = new UpdateRegion();
|
||||
ur.setUrId(databuf.getInt());
|
||||
ur.setUrNameId(databuf.getInt());
|
||||
int strlength = databuf.get();
|
||||
String urName = null;
|
||||
if (strlength > 0) {
|
||||
byte[] tempStr = new byte[strlength];
|
||||
for (int idx = 0; idx < strlength; idx++) {
|
||||
tempStr[idx] = (byte) databuf.get();
|
||||
}
|
||||
urName = new String(tempStr, "UTF8");
|
||||
}
|
||||
ur.setUrName(urName);
|
||||
if(urName != null && !urName.contains("null")) {
|
||||
list.add(ur);
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Category> getCatDataByDA(int urid) throws Exception {
|
||||
List<Category> list = new ArrayList<Category>();
|
||||
byte[] catData = getCatData(urid);
|
||||
if (null != catData && catData.length > 0) {
|
||||
ByteBuffer databuf = ByteBuffer.wrap(catData);
|
||||
int cateCnt = databuf.getInt();
|
||||
for (int iLoop = 0; iLoop < cateCnt; ++iLoop) {
|
||||
Category cate = new Category();
|
||||
cate.setSubNum(databuf.getInt());
|
||||
List<SubCategory> subCateList = new ArrayList<SubCategory>();
|
||||
for (int jLoop = 0; jLoop < cate.getSubNum(); ++jLoop) {
|
||||
SubCategory subCate = new SubCategory();
|
||||
subCate.setKindId(databuf.getInt());
|
||||
int strlength = databuf.get();
|
||||
String sSubCatName = null;
|
||||
if (strlength > 0) {
|
||||
byte[] tempStr = new byte[strlength];
|
||||
for (int idx = 0; idx < strlength; idx++) {
|
||||
tempStr[idx] = (byte) databuf.get();
|
||||
}
|
||||
sSubCatName = new String(tempStr, "UTF8");
|
||||
}
|
||||
subCate.setCatName(sSubCatName);
|
||||
subCateList.add(subCate);
|
||||
}
|
||||
cate.setSubCategory(subCateList);
|
||||
cate.setKindId(databuf.getInt());
|
||||
int strlength = databuf.get();
|
||||
String sCatName = null;
|
||||
if (strlength > 0) {
|
||||
byte[] tempStr = new byte[strlength];
|
||||
for (int idx = 0; idx < strlength; idx++) {
|
||||
tempStr[idx] = (byte) databuf.get();
|
||||
}
|
||||
sCatName = new String(tempStr, "UTF8");
|
||||
}
|
||||
cate.setCatName(sCatName);
|
||||
list.add(cate);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<PoiBase> getFTSDataByDA( int urid, String keyStr, int keytype, int maxResultCount)throws Exception
|
||||
{
|
||||
Log.d("liushj", "DataAccess getFTSDataByDA 1");
|
||||
List<PoiBase> list = new ArrayList<PoiBase>();
|
||||
Log.d("liushj", "DataAccess getFTSDataByDA 2");
|
||||
byte[] poidata = getFTSData( urid, keyStr, keytype, maxResultCount);
|
||||
Log.d("liushj", "DataAccess getFTSDataByDA 3");
|
||||
if (poidata != null && poidata.length > 0) {
|
||||
ByteBuffer databuf = ByteBuffer.wrap(poidata);
|
||||
int poiCnt = databuf.getInt();
|
||||
for (int i=0; i<poiCnt; i++) {
|
||||
|
||||
int poiid = databuf.getInt();
|
||||
int kindid = databuf.getInt();
|
||||
int lon = (int) (databuf.getInt() * 3.6);
|
||||
int lat = (int) (databuf.getInt() * 3.6);
|
||||
|
||||
int namelength = databuf.get();
|
||||
String nameStr = null;
|
||||
if (namelength > 0) {
|
||||
byte[] name = new byte[namelength];
|
||||
for (int idx=0; idx < namelength; idx++) {
|
||||
name[idx] = (byte) databuf.get();
|
||||
}
|
||||
nameStr = new String(name, "UTF8");
|
||||
}
|
||||
|
||||
int addrlength = databuf.get();
|
||||
String addrStr = null;
|
||||
if (addrlength > 0) {
|
||||
byte[] addr = new byte[addrlength];
|
||||
for (int idx=0; idx < addrlength; idx++) {
|
||||
addr[idx] = (byte) databuf.get();
|
||||
}
|
||||
addrStr = new String(addr, "UTF8");
|
||||
}
|
||||
|
||||
int phonelength = databuf.get();
|
||||
String phoneStr = null;
|
||||
if (phonelength > 0) {
|
||||
byte[] phone = new byte[phonelength];
|
||||
for (int idx=0; idx < phonelength; idx++) {
|
||||
phone[idx] = (byte) databuf.get();
|
||||
}
|
||||
phoneStr = new String(phone, "UTF8");
|
||||
}
|
||||
|
||||
PoiBase poi = new PoiBase(nameStr, addrStr, phoneStr, lon, lat, poiid);
|
||||
list.add(poi);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<String> getInputResultByDA() throws Exception {
|
||||
List<String> list = new ArrayList<String>();
|
||||
byte[] strData = getInputResult();
|
||||
if (strData != null && strData.length > 0) {
|
||||
ByteBuffer databuf = ByteBuffer.wrap(strData);
|
||||
int strCnt = databuf.getInt();
|
||||
for (int i = 0; i < strCnt; i++) {
|
||||
int strlength = databuf.get();
|
||||
String str = null;
|
||||
if (strlength > 0) {
|
||||
byte[] tempStr = new byte[strlength];
|
||||
for (int idx = 0; idx < strlength; idx++) {
|
||||
tempStr[idx] = (byte) databuf.get();
|
||||
}
|
||||
str = new String(tempStr, "UTF8");
|
||||
}
|
||||
list.add(str);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private native static boolean loadda(IBinder binder);
|
||||
private native static void unloadda();
|
||||
private native static void getBmdTile(int urid, int tileid);
|
||||
private native static void getDtmTile(int urid, int tileid);
|
||||
private native static void getTexImg (int urid, int texid);
|
||||
private native static void getSpaBlob(int urid, int treeid);
|
||||
private native static void getGeoBlob(int urid, int objid);
|
||||
private native static void getRtTile (int urid, int tileid);
|
||||
private native static void getRtGTile(int urid, int tileid);
|
||||
private native static byte[] getURList (int prodid);
|
||||
private native static byte[] getCatData(int urid);
|
||||
//private native static void getSpaSrh (long lonlat, int radius, int kind);
|
||||
private native static byte[] getFTSData( int urid, String keyStr, int keytype, int maxResultCount);
|
||||
private native static void getNVCBlob(int urid, int nameid, int scid, int subtreeid, int datatype);
|
||||
private native static void getRtPath (float slon, float slat, float dlon, float dlat);
|
||||
private native static byte[] getInputResult();
|
||||
}
|
||||
@@ -0,0 +1,462 @@
|
||||
//package com.autonavi.nge.dm;
|
||||
//
|
||||
//import android.os.RemoteException;
|
||||
//import android.util.Log;
|
||||
//import android.util.Pair;
|
||||
//
|
||||
//import com.autonavi.nge.dataaccdss.DataAccessProvider;
|
||||
//import com.autonavi.nge.guidance.GuidanceProvider;
|
||||
//import com.autonavi.nge.guidance.GuidanceStatListener;
|
||||
//import com.autonavi.nge.guidance.LaneMask;
|
||||
//import com.autonavi.nge.guidance.NaviInfo;
|
||||
//import com.autonavi.nge.guidance.RouteBook;
|
||||
//import com.autonavi.nge.guidance.RouteImage;
|
||||
//import com.autonavi.nge.map.LonLat;
|
||||
//import com.autonavi.nge.obj.Category;
|
||||
//import com.autonavi.nge.obj.PoiBase;
|
||||
//import com.autonavi.nge.obj.UpdateRegion;
|
||||
//import com.autonavi.nge.routing.RoutingProvider;
|
||||
//import com.autonavi.nge.search.SPCategories;
|
||||
//import com.autonavi.nge.search.SPLatLonPoint;
|
||||
//import com.autonavi.nge.search.SPPoiItem;
|
||||
//import com.autonavi.nge.search.SPQuery;
|
||||
//import com.autonavi.nge.search.SPSearchResult;
|
||||
//import com.autonavi.nge.search.SearchProvider;
|
||||
//import com.autonavi.nge.trafficInfo.TMCID;
|
||||
//import com.pdager.tts.CMDPlayer;
|
||||
//import com.zhidaoauto.map.sdk.inner.CompileConfig;
|
||||
//import com.zhidaoauto.map.sdk.inner.controller.CommonController;
|
||||
//
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.List;
|
||||
//
|
||||
///**
|
||||
// * @author Administrator
|
||||
// */
|
||||
//public class NavigationCore extends INavigationCore.Stub {
|
||||
//
|
||||
// private static final String TAG = "NavigationCore";
|
||||
//// private IBinder mHandler;
|
||||
// private SharedMemoryService mShM;
|
||||
// private RoutingProvider mRouteingProvider;
|
||||
// private GuidanceProvider mGuidanceProvider;
|
||||
// private SearchProvider mSearchProvider;
|
||||
// private DataAccessProvider mDataAccessProvider;
|
||||
// private CMDPlayer mCMDPlayer;
|
||||
//
|
||||
// private GuidanceStatListener mListener;
|
||||
//
|
||||
// public NavigationCore(SharedMemoryService shm) {
|
||||
// mShM = shm;
|
||||
//// mHandler = handler;
|
||||
// mRouteingProvider = new RoutingProvider();
|
||||
// mSearchProvider = new SearchProvider();
|
||||
// mGuidanceProvider = new GuidanceProvider( this);
|
||||
//// mDataAccessProvider = new DataAccessProvider(handler);
|
||||
// mCMDPlayer = new CMDPlayer(CommonController.getInstance().getContext());
|
||||
// try {
|
||||
// startServer();
|
||||
// } catch (RemoteException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//// @Override
|
||||
//// public IBinder getHandler() throws RemoteException {
|
||||
//// return mHandler;
|
||||
//// }
|
||||
//
|
||||
// @Override
|
||||
// public void Routing_SetOrigin(float lon, float lat, int sessionid)
|
||||
// throws RemoteException {
|
||||
// mRouteingProvider.setOrigin(lon, lat, sessionid);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void Routing_SetDest(float lon, float lat, int sessionid)
|
||||
// throws RemoteException {
|
||||
// mRouteingProvider.setDest(lon, lat, sessionid);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void Routing_GetRoute(int sessionid) throws RemoteException {
|
||||
// mRouteingProvider.getRoute(sessionid);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean Routing_GetStatus(int sessionid) throws RemoteException {
|
||||
// return mRouteingProvider.getStatus(sessionid);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void Routing_Reset(int sessionid) throws RemoteException {
|
||||
// mRouteingProvider.reset(sessionid);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void Routing_ClearTour(int sessionid) throws RemoteException {
|
||||
// mRouteingProvider.clearTour(sessionid);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void Guidance_UpdatePosition(float lon, float lat, float speed, float heading)
|
||||
// throws RemoteException {
|
||||
// mGuidanceProvider.updatePosition(lon, lat, speed, heading);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void Guidance_StartNavi(int type) throws RemoteException {
|
||||
// mGuidanceProvider.startNavi(type);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void Guidance_StopNavi() throws RemoteException {
|
||||
// mGuidanceProvider.stopNavi();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void Guidance_SetSimSpeed(int speed) throws RemoteException {
|
||||
// mGuidanceProvider.setSimSpeed(speed);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void Guidance_PauseSimNavi() throws RemoteException {
|
||||
// mGuidanceProvider.pauseSimNavi();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void Guidance_ResumeSimNavi() throws RemoteException {
|
||||
// mGuidanceProvider.resumeSimNavi();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public RouteBook Guidance_RouteBook(int session, int start, int end) throws RemoteException {
|
||||
//
|
||||
// try {
|
||||
// return mGuidanceProvider.getRouteBookData(session, start, end);
|
||||
// } catch (Exception e) {
|
||||
//
|
||||
// e.printStackTrace();
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public NaviInfo Guidance_NaviInfo() throws RemoteException {
|
||||
//
|
||||
// try {
|
||||
// return mGuidanceProvider.getNaviInfoData();
|
||||
// } catch (Exception e) {
|
||||
//
|
||||
// e.printStackTrace();
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public NaviInfo GetNaviInfo(byte[] datas) {
|
||||
// try {
|
||||
// return mGuidanceProvider.getNaviInfoData(datas);
|
||||
// } catch (Exception e) {
|
||||
//
|
||||
// e.printStackTrace();
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String Guidance_TTS() throws RemoteException {
|
||||
// try {
|
||||
// return mGuidanceProvider.getGuidanceTTS();s
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public LaneMask Guidance_LaneMask() throws RemoteException {
|
||||
//
|
||||
// try {
|
||||
// return mGuidanceProvider.getGuidanceNaviLane();
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<SPPoiItem> Search_getSearchResult(int productId, double lon, double lat, double radius, int kindfilterId, int updateregionId, String keyWord, int pageIdx, int searchType) throws RemoteException {
|
||||
//// int[] kindfilter = new int[1];
|
||||
//// if (kindfilterId > 0) {
|
||||
//// kindfilter[0] = kindfilterId;
|
||||
//// }
|
||||
//// try {
|
||||
//// return SearchProvider.getPoiItemListByType(productId, updateregionId, searchType, keyWord, pageIdx);
|
||||
//// } catch (Exception e) {
|
||||
////
|
||||
//// e.printStackTrace();
|
||||
//// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<PoiBase> getFTSDataByDA(int urid, String keyStr, int keytype,
|
||||
// int maxResultCount) throws RemoteException {
|
||||
//
|
||||
// try {
|
||||
// return mDataAccessProvider.getFTSDataByDA(urid, keyStr, keytype, maxResultCount);
|
||||
// } catch (Exception e) {
|
||||
//
|
||||
// e.printStackTrace();
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void play(String text,boolean forcePlay) throws RemoteException {
|
||||
// if(CompileConfig.INSTANCE.getDEBUG()){
|
||||
// Log.i(TAG, "voiceop--navop--play: "+text+",mCMDPlayer:"+mCMDPlayer);
|
||||
// }
|
||||
// mCMDPlayer.play(text, forcePlay);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void RoutingSetCostModel(int model, int sessionid)
|
||||
// throws RemoteException {
|
||||
// mRouteingProvider.setCostModel(model, sessionid);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void RoutingSetAvoidHighway(boolean isAvoidHighway, int sessionid)
|
||||
// throws RemoteException {
|
||||
// mRouteingProvider.setAvoidHighway(isAvoidHighway, sessionid);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void RoutingSetAvoidToll(boolean isAvoidToll, int sessionid)
|
||||
// throws RemoteException {
|
||||
// mRouteingProvider.setAvoidToll(isAvoidToll, sessionid);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<String> getInputResult(int productId, int updateregionId, String inputStr)
|
||||
// throws RemoteException {
|
||||
//// try {
|
||||
//// return mSearchProvider.getInputResult(productId, updateregionId, inputStr);
|
||||
//// } catch (UnsupportedEncodingException e) {
|
||||
//// e.printStackTrace();
|
||||
//// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<String> getInputResultByDA() throws RemoteException {
|
||||
// try {
|
||||
// return mDataAccessProvider.getInputResultByDA();
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<Category> getCatList(int urid) throws RemoteException {
|
||||
//// try {
|
||||
//// return mSearchProvider.getCatList(1, urid);
|
||||
//// } catch (Exception e) {
|
||||
////
|
||||
//// e.printStackTrace();
|
||||
//// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<UpdateRegion> getURListByDA(int prodid) throws RemoteException {
|
||||
// try {
|
||||
// return mDataAccessProvider.getURListByDA(prodid);
|
||||
// } catch (Exception e) {
|
||||
//
|
||||
// e.printStackTrace();
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public RouteImage Guidance_Image(int imageUr, int imageBg, int imageArrow, int type)
|
||||
// throws RemoteException {
|
||||
//
|
||||
// try {
|
||||
// return mGuidanceProvider.getRouteImage(imageUr, imageBg, imageArrow, type);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void RoutingSetUseTraffic(boolean useTraffic, int sessionid)
|
||||
// throws RemoteException {
|
||||
// mRouteingProvider.setUseTraffic(useTraffic, sessionid);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int RoutingGetRouteNum(int sessionid) throws RemoteException {
|
||||
// return mRouteingProvider.getRouteNum(sessionid);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int RoutingGetLength(int route, int sessionid)
|
||||
// throws RemoteException {
|
||||
// return mRouteingProvider.getLength(route, sessionid);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int RoutingGetSTime(int route, int sessionid) throws RemoteException {
|
||||
// return mRouteingProvider.getSTime(route, sessionid);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int RoutingGetDTime(int route, int sessionid) throws RemoteException {
|
||||
// return mRouteingProvider.getDTime(route, sessionid);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void Traffic_Update(List<TMCID> ids, int evt) throws RemoteException {
|
||||
// mRouteingProvider.setTrafStat(ids, evt);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void Traffic_UpdateByTile(int tile, int[] ids, byte[] speeds) {
|
||||
// mRouteingProvider.setTrafSpeedByTile(tile, ids, speeds);
|
||||
// }
|
||||
//
|
||||
// //@Override void
|
||||
//
|
||||
// @Override
|
||||
// public int RoutingGetSearchedCnt(int route, int sessionid) throws RemoteException {
|
||||
// return RoutingProvider.getsearchedcnt(route, sessionid);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int[] getMemoryInfo() throws RemoteException {
|
||||
// // return mShM.getMemoryInfo();
|
||||
// return new int[]{0};
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void startServer() throws RemoteException {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void stopServer() throws RemoteException {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void addwaypoint(float lon, float lat, int heading, int sessionid)
|
||||
// throws RemoteException {
|
||||
// mRouteingProvider.addWayPoint(lon, lat, heading, sessionid);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void clearwaypoints(int sessionid) throws RemoteException {
|
||||
// mRouteingProvider.clearWayPoints(sessionid);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int getMDSVersion() throws RemoteException {
|
||||
//
|
||||
// return 1;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getDataVersion() throws RemoteException {
|
||||
//
|
||||
// return "";
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getCopyRight() throws RemoteException {
|
||||
//
|
||||
// return "";
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getCompilerVersion() throws RemoteException {
|
||||
//
|
||||
// return "";
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public double Guidance_getRoadAngle() throws RemoteException {
|
||||
//
|
||||
// return mGuidanceProvider.getRoadAngle();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onGuidanceStatusChanged(int statCode, byte[] datas) {
|
||||
// if (mListener != null) {
|
||||
// try {
|
||||
// mListener.onGuidanceStatusChanged(statCode, datas);
|
||||
// } catch (RemoteException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void setGuidanceStatListener(GuidanceStatListener listener)
|
||||
// throws RemoteException {
|
||||
// mListener = listener;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public SPCategories getAllPoiCategories(int languageCode) throws RemoteException {
|
||||
// List<Pair<Integer, String>> list = SearchProvider.getAllPoiCategories(languageCode);
|
||||
// SPCategories spCategories = new SPCategories();
|
||||
// spCategories.setCategories(list);
|
||||
// return spCategories;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<SPSearchResult> getPoiItemList(SPQuery query) throws RemoteException {
|
||||
// return SearchProvider.getPoiItemList(query);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public SPPoiItem getPoiItemByPoiId(int poiId) {
|
||||
// return SearchProvider.getPoiItemByPoiId(poiId);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<SPPoiItem> getPoiItemListByLonLat(int prodId, int urId, float lon, float lat, int pageCount, int pageIdx) {
|
||||
// return null;//SearchProvider.getPoiItemListByLonLat(prodId, urId, lon, lat, pageCount, pageIdx);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<SPPoiItem> queryPoiItemByCircle(float centerLon, float centerLat, float radius) {
|
||||
// Log.i(TAG, "searchop--queryPoiItemByCircle: " + centerLon + "," + centerLat);
|
||||
// return null;//SearchProvider.getPoiItemByCircle(new SPLatLonPoint(centerLon, centerLat), radius);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<SPPoiItem> queryPoiItemByRect(float topLeftLon, float topLeftLat, float bottomRightLon, float bottomRightLat) {
|
||||
// return null;//SearchProvider.getPoiItemByRect(new SPLatLonPoint(topLeftLon, topLeftLat), new SPLatLonPoint(bottomRightLon, bottomRightLat));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<SPPoiItem> queryPoiItemByPolygon(List<LonLat> latLonPoints) {
|
||||
// if (latLonPoints == null || latLonPoints.size() < 3) {
|
||||
// return null;
|
||||
// }
|
||||
// List<SPLatLonPoint> list = new ArrayList<>();
|
||||
// for (LonLat lonLat : latLonPoints) {
|
||||
// list.add(new SPLatLonPoint((float) lonLat.getLon(), (float) lonLat.getLat()));
|
||||
// }
|
||||
// return null;//SearchProvider.getPoiItemByPolygon(list);
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.autonavi.nge.dm;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.autonavi.nge.hdmap.HDMapProvider;
|
||||
import com.zhidaoauto.map.sdk.inner.CompileConfig;
|
||||
import com.zhidaoauto.map.sdk.inner.common.MapHelper;
|
||||
import com.zhidaoauto.map.sdk.inner.utils.CommonUtils;
|
||||
import com.zhidaoauto.map.sdk.inner.utils.Constant;
|
||||
|
||||
|
||||
public class SharedMemoryService {
|
||||
|
||||
private static final String TAG = "SharedMemoryService";
|
||||
|
||||
static {
|
||||
System.loadLibrary("datamgr");
|
||||
}
|
||||
|
||||
private volatile static SharedMemoryService mInstance;
|
||||
|
||||
public static SharedMemoryService getInstance(Context context) {
|
||||
if (mInstance == null) {
|
||||
synchronized (SharedMemoryService.class) {
|
||||
if (mInstance == null) {
|
||||
mInstance = new SharedMemoryService(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
private SharedMemoryService(Context context) {
|
||||
init(context);
|
||||
}
|
||||
|
||||
public void exit() {
|
||||
mInstance = null;
|
||||
unload();
|
||||
}
|
||||
|
||||
private native static int initSharedMemory_Native(String dir, String tilesDir,int[] tileFilter);
|
||||
|
||||
private native static boolean testRoutingTile(int i, int j, int k);
|
||||
|
||||
public native static void unload();
|
||||
|
||||
|
||||
private void init(Context context) {
|
||||
|
||||
HDMapProvider.setDataFileSource(MapHelper.INSTANCE.getMMapParams().getDataFileSource());
|
||||
HDMapProvider.setDataRedisSource(MapHelper.INSTANCE.getMMapParams().getDataRedisFileSource());
|
||||
if (!TextUtils.isEmpty(MapHelper.INSTANCE.getMMapParams().getHdmapPath())) {
|
||||
HDMapProvider.setDataDir(MapHelper.INSTANCE.getMMapParams().getHdmapPath());
|
||||
}
|
||||
|
||||
String dir = Constant.getNDSDataPath();
|
||||
String cachePath = MapHelper.INSTANCE.getMMapParams().getCachePath();
|
||||
if (TextUtils.isEmpty(cachePath)) {
|
||||
cachePath = CommonUtils.INSTANCE.getCachePath(context);
|
||||
}
|
||||
if (CompileConfig.INSTANCE.getDEBUG()) {
|
||||
Log.i(TAG, "autoop-dir:" + dir+",SharedMemory--cachePath:"+cachePath);
|
||||
}
|
||||
initSharedMemory_Native(dir, cachePath,MapHelper.INSTANCE.getMMapParams().getQzoneFilterArray());
|
||||
}
|
||||
|
||||
|
||||
public int[] getMemoryInfo() {
|
||||
return null; //getMemoryInfo_Native();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.autonavi.nge.hdmap;
|
||||
|
||||
class HDMapBlock {
|
||||
private var laneNo = 0
|
||||
private var routeId = 0
|
||||
private var lonLats: ArrayList<LonLat?>? = null
|
||||
private var width = 0f
|
||||
|
||||
fun getLaneNo(): Int {
|
||||
return laneNo
|
||||
}
|
||||
|
||||
fun setLaneNo(laneNo: Int) {
|
||||
this.laneNo = laneNo
|
||||
}
|
||||
|
||||
fun getRouteId(): Int {
|
||||
return routeId
|
||||
}
|
||||
|
||||
fun setRouteId(routeId: Int) {
|
||||
this.routeId = routeId
|
||||
}
|
||||
|
||||
fun getLonLats(): ArrayList<LonLat?>? {
|
||||
return lonLats
|
||||
}
|
||||
|
||||
fun setLonLats(lonLats: ArrayList<LonLat?>?) {
|
||||
this.lonLats = lonLats
|
||||
}
|
||||
|
||||
fun getWidth(): Float {
|
||||
return width
|
||||
}
|
||||
|
||||
fun setWidth(width: Float) {
|
||||
this.width = width
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "HDMapBlock{" +
|
||||
"laneNo=" + laneNo +
|
||||
", routeId=" + routeId +
|
||||
", lonLats=" + lonLats +
|
||||
", width=" + width +
|
||||
'}'
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.autonavi.nge.hdmap
|
||||
|
||||
class HDMapProvider {
|
||||
companion object {
|
||||
@JvmStatic external fun setDataDir(dataDir: String?)
|
||||
|
||||
/**f:设置数据的源。参数说明: 1,本地文件。非1,redis获取。默认,非1 */
|
||||
@JvmStatic external fun setDataFileSource(source: Int)
|
||||
|
||||
/**f:设置redis源。1,测试redis(42)。非1,正式redis(根据域名访问的)。默认,非1 */
|
||||
@JvmStatic external fun setDataRedisSource(source: Int)
|
||||
|
||||
init {
|
||||
System.loadLibrary("hdmap")
|
||||
}
|
||||
}
|
||||
|
||||
fun getLaneCenterLine(tileId: Int, routeId: Int): ArrayList<HDMapBlock>? {
|
||||
return if (mObj != 0L) {
|
||||
getLaneCenterLineJni(mObj, tileId, routeId)
|
||||
} else null
|
||||
}
|
||||
|
||||
fun getTrafficSign(tileId: Int): ArrayList<TrafficSign>? {
|
||||
return if (mObj != 0L) {
|
||||
getTrafficSignJni(mObj, tileId)
|
||||
} else null
|
||||
}
|
||||
|
||||
fun release() {
|
||||
if (mObj != 0L) {
|
||||
releaseJni(mObj)
|
||||
mObj = 0
|
||||
}
|
||||
}
|
||||
private external fun initJni(): Long
|
||||
private external fun getLaneCenterLineJni(obj: Long, tileId: Int, routeId: Int): ArrayList<HDMapBlock>?
|
||||
private external fun getTrafficLightJni(obj: Long, tileId: Int, routeId: Int): ArrayList<TrafficLight?>?
|
||||
private external fun getTrafficLightJni(obj: Long, lon: Double, lat: Double, angle: Float): ArrayList<TrafficLight?>?
|
||||
private external fun getTrafficSignJni(obj: Long, tileId: Int): ArrayList<TrafficSign>?
|
||||
private external fun releaseJni(obj: Long)
|
||||
private var mObj: Long = 0
|
||||
|
||||
init {
|
||||
mObj = initJni()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.autonavi.nge.hdmap;
|
||||
|
||||
class LonLat {
|
||||
private var lon = 0.0
|
||||
private var lat = 0.0
|
||||
|
||||
fun getLon(): Double {
|
||||
return lon
|
||||
}
|
||||
|
||||
fun setLon(lon: Double) {
|
||||
this.lon = lon
|
||||
}
|
||||
|
||||
fun getLat(): Double {
|
||||
return lat
|
||||
}
|
||||
|
||||
fun setLat(lat: Double) {
|
||||
this.lat = lat
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "LonLat{" +
|
||||
"lon=" + lon +
|
||||
", lat=" + lat +
|
||||
'}'
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.autonavi.nge.hdmap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class TrafficLight {
|
||||
public TrafficLight() {
|
||||
|
||||
}
|
||||
|
||||
private int tileId;
|
||||
private int roadId;
|
||||
private int type;
|
||||
private ArrayList<Integer> laneNo;
|
||||
private int shape;
|
||||
private LonLat start;
|
||||
private LonLat end;
|
||||
|
||||
public int getTileId() {
|
||||
return tileId;
|
||||
}
|
||||
|
||||
public void setTileId(int tileId) {
|
||||
this.tileId = tileId;
|
||||
}
|
||||
|
||||
public int getRoadId() {
|
||||
return roadId;
|
||||
}
|
||||
|
||||
public void setRoadId(int roadId) {
|
||||
this.roadId = roadId;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public ArrayList<Integer> getLaneNo() {
|
||||
return laneNo;
|
||||
}
|
||||
|
||||
public void setLaneNo(ArrayList<Integer> laneNo) {
|
||||
this.laneNo = laneNo;
|
||||
}
|
||||
|
||||
public int getShape() {
|
||||
return shape;
|
||||
}
|
||||
|
||||
public void setShape(int shape) {
|
||||
this.shape = shape;
|
||||
}
|
||||
|
||||
public LonLat getStart() {
|
||||
return start;
|
||||
}
|
||||
|
||||
public void setStart(LonLat start) {
|
||||
this.start = start;
|
||||
}
|
||||
|
||||
public LonLat getEnd() {
|
||||
return end;
|
||||
}
|
||||
|
||||
public void setEnd(LonLat end) {
|
||||
this.end = end;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TrafficLight{" +
|
||||
"tileId=" + tileId +
|
||||
", roadId=" + roadId +
|
||||
", type=" + type +
|
||||
", laneNo=" + laneNo +
|
||||
", shape=" + shape +
|
||||
", start=" + start +
|
||||
", end=" + end +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.autonavi.nge.hdmap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class TrafficSign {
|
||||
public TrafficSign(){
|
||||
}
|
||||
|
||||
private int id;
|
||||
private int tileId;
|
||||
private int roadId;
|
||||
private int type;
|
||||
private int shape;
|
||||
private int color;
|
||||
private int content;
|
||||
private ArrayList<TrafficSignPosition> position;
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getTileId() {
|
||||
return tileId;
|
||||
}
|
||||
|
||||
public void setTileId(int tileId) {
|
||||
this.tileId = tileId;
|
||||
}
|
||||
|
||||
public int getRoadId() {
|
||||
return roadId;
|
||||
}
|
||||
public void setRoadId(int roadId) {
|
||||
this.roadId = roadId;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getShape() { return shape; }
|
||||
public void setShape(int shape) { this.shape = shape; }
|
||||
|
||||
public int getColor() { return color; }
|
||||
public void setColor(int color) { this.color = color; }
|
||||
|
||||
public int getContent() { return content; }
|
||||
public void setContent(int content) { this.content = content; }
|
||||
|
||||
public ArrayList<TrafficSignPosition> getPosition() {
|
||||
return position;
|
||||
}
|
||||
|
||||
public void setPosition(ArrayList<TrafficSignPosition> position) {
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TrafficSign{" +
|
||||
"tileId=" + tileId +
|
||||
", roadId=" + roadId +
|
||||
", type=" + type +
|
||||
", shape=" + shape +
|
||||
", color=" + color +
|
||||
", content="+ content+
|
||||
", position=" + position +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.autonavi.nge.hdmap;
|
||||
|
||||
public class TrafficSignPosition {
|
||||
public TrafficSignPosition(){
|
||||
|
||||
}
|
||||
private double lon;
|
||||
private double lat;
|
||||
private double hight;
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public double getHight() {
|
||||
return hight;
|
||||
}
|
||||
|
||||
public void setHight(double hight) {
|
||||
this.hight = hight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TrafficSignPosition{" +
|
||||
"lon=" + lon +
|
||||
", lat=" + lat +
|
||||
", hight=" + hight +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.autonavi.nge.map;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
public class LonLat implements Parcelable {
|
||||
private double lon;
|
||||
private double lat;
|
||||
private double alt;
|
||||
|
||||
|
||||
public LonLat() {
|
||||
}
|
||||
|
||||
public LonLat(double lon, double lat) {
|
||||
this.lon = lon;
|
||||
this.lat = lat;
|
||||
}
|
||||
public LonLat(double lon, double lat, double alt) {
|
||||
this.lon = lon;
|
||||
this.lat = lat;
|
||||
this.alt = alt;
|
||||
}
|
||||
|
||||
protected LonLat(Parcel in) {
|
||||
lon = in.readDouble();
|
||||
lat = in.readDouble();
|
||||
alt = in.readDouble();
|
||||
}
|
||||
|
||||
public static final Creator<LonLat> CREATOR = new Creator<LonLat>() {
|
||||
@Override
|
||||
public LonLat createFromParcel(Parcel in) {
|
||||
return new LonLat(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LonLat[] newArray(int size) {
|
||||
return new LonLat[size];
|
||||
}
|
||||
};
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public double getAlt() {
|
||||
return alt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LonLat{" +
|
||||
"lon=" + lon +
|
||||
", lat=" + lat +
|
||||
", alt=" + alt +
|
||||
'}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeDouble(lon);
|
||||
dest.writeDouble(lat);
|
||||
dest.writeDouble(alt);
|
||||
}
|
||||
}
|
||||
1603
libraries/mapmodule/src/main/java/com/autonavi/nge/map/MapEngine.kt
Normal file
1603
libraries/mapmodule/src/main/java/com/autonavi/nge/map/MapEngine.kt
Normal file
File diff suppressed because it is too large
Load Diff
1367
libraries/mapmodule/src/main/java/com/autonavi/nge/map/MapView.kt
Normal file
1367
libraries/mapmodule/src/main/java/com/autonavi/nge/map/MapView.kt
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
package com.autonavi.nge.map
|
||||
|
||||
import android.graphics.Bitmap
|
||||
|
||||
interface OnMapScreenShotListener {
|
||||
fun onMapScreenShot(bitmap: Bitmap?)
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.autonavi.nge.map
|
||||
|
||||
interface OnMapStatusChangeListener {
|
||||
fun onMapStatusChangeListener(type: Int, value: Int)
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.autonavi.nge.map;
|
||||
|
||||
public class Pixels {
|
||||
private float x;
|
||||
private float y;
|
||||
|
||||
public float getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public float getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Pixels{" +
|
||||
"x=" + x +
|
||||
", y=" + y +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.autonavi.nge.map
|
||||
|
||||
|
||||
internal object PrimitiveManager {
|
||||
external fun drawLine(
|
||||
name: String?,
|
||||
points: DoubleArray?,
|
||||
lineWidth: Int,
|
||||
r: Char,
|
||||
g: Char,
|
||||
b: Char,
|
||||
a: Char,
|
||||
isLoop: Boolean
|
||||
)
|
||||
|
||||
external fun drawCircle(name: String?, lonlats: DoubleArray?, r: Char, g: Char, b: Char, a: Char)
|
||||
|
||||
external fun drawEllipse(name: String?, lonlats: DoubleArray?, r: Char, g: Char, b: Char, a: Char)
|
||||
|
||||
external fun drawPolygon(name: String?, lonlats: DoubleArray?, r: Char, g: Char, b: Char, a: Char)
|
||||
|
||||
external fun removePrimitiveByNameId(name: String?)
|
||||
|
||||
external fun drawLine(jsonOption: String?)
|
||||
|
||||
external fun drawThickLine(strJsonOption: String?)
|
||||
|
||||
external fun setVisiable(id: String?, bVisiable: Boolean)
|
||||
|
||||
external fun setWidth(id: String?, width: Float)
|
||||
|
||||
external fun setGeodesic(id: String?, bGeodesic: Boolean)
|
||||
|
||||
external fun setTransparency(id: String?, transparency: Float)
|
||||
|
||||
external fun setColor(id: String?, color: Int)
|
||||
|
||||
external fun setZIndex(id: String?, zIndex: Float)
|
||||
|
||||
external fun useGradient(id: String?, bUseGradient: Boolean)
|
||||
|
||||
external fun setDottedLineType(id: String?, type: Int)
|
||||
|
||||
external fun setOption(id: String?, strJsonOption: String?)
|
||||
|
||||
external fun draw3DPolygon(id: String?, lonlatArr: DoubleArray?, height: Float, width: Float, count: Int, color: FloatArray?)
|
||||
|
||||
external fun clearAllPrimitives(): Boolean
|
||||
|
||||
external fun drawDeadZone(strJsonOption: String?)
|
||||
|
||||
external fun setDeadZoneVisiable(b: Boolean)
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.autonavi.nge.obj;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Category implements Parcelable{
|
||||
|
||||
public static final Creator<Category> CREATOR = new Creator<Category>() {
|
||||
public Category createFromParcel(Parcel in) {
|
||||
Category category = new Category();
|
||||
category.setCatName(in.readString());
|
||||
category.setKindId(in.readInt());
|
||||
category.setSubCategory(in.readArrayList(SubCategory.class.getClassLoader()));
|
||||
category.setSubNum(in.readInt());
|
||||
return category;
|
||||
}
|
||||
|
||||
public Category[] newArray(int size) {
|
||||
return new Category[size];
|
||||
}
|
||||
};
|
||||
|
||||
private String m_sCatName = "";
|
||||
private int m_iKindId = 0;
|
||||
private List<SubCategory> m_oSubCategory = null;
|
||||
private int m_iSubNum = 0;
|
||||
|
||||
public String getCatName() {
|
||||
return m_sCatName;
|
||||
}
|
||||
|
||||
public int getKindId() {
|
||||
return m_iKindId;
|
||||
}
|
||||
|
||||
public List<SubCategory> getSubCategory() {
|
||||
return m_oSubCategory;
|
||||
}
|
||||
|
||||
public int getSubNum() {
|
||||
return m_iSubNum;
|
||||
}
|
||||
|
||||
public void setCatName(String sCatName) {
|
||||
this.m_sCatName = sCatName;
|
||||
}
|
||||
|
||||
public void setKindId(int iKindId) {
|
||||
this.m_iKindId = iKindId;
|
||||
}
|
||||
|
||||
public void setSubCategory(List<SubCategory> subCateList) {
|
||||
this.m_oSubCategory = subCateList;
|
||||
}
|
||||
|
||||
public void setSubNum(int iSubNum) {
|
||||
this.m_iSubNum = iSubNum;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel out, int arg1) {
|
||||
out.writeString(m_sCatName);
|
||||
out.writeInt(m_iKindId);
|
||||
out.writeList(m_oSubCategory);
|
||||
out.writeInt(m_iSubNum);
|
||||
}
|
||||
|
||||
public void readFromParcel(Parcel in) {
|
||||
m_sCatName = in.readString();
|
||||
m_iKindId = in.readInt();
|
||||
m_oSubCategory = in.readArrayList(SubCategory.class.getClassLoader());
|
||||
m_iSubNum = in.readInt();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.autonavi.nge.obj;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Dest
|
||||
* @author
|
||||
*
|
||||
*/
|
||||
public class DestObj implements Serializable{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private PoiBase poi;
|
||||
private long ID;
|
||||
//0:添加的 1:回家 2:上班
|
||||
private int kind = 0;
|
||||
//创建时间
|
||||
private String strCreateDate;
|
||||
|
||||
public DestObj() {
|
||||
|
||||
}
|
||||
/**
|
||||
* 一般用于添加新Dest
|
||||
* @param poi
|
||||
* @param kind
|
||||
*/
|
||||
public DestObj(PoiBase poi) {
|
||||
this.poi = poi;
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
|
||||
this.strCreateDate = sdf.format(new Date());
|
||||
}
|
||||
|
||||
/**
|
||||
* 一般用于更新Dest
|
||||
* @param id
|
||||
* @param name
|
||||
* @param deslon
|
||||
* @param deslat
|
||||
* @param desname
|
||||
*/
|
||||
public DestObj(long id, String name, int deslon, int deslat, String desname) {
|
||||
PoiBase mPoiBase = new PoiBase(name, desname, deslon, deslat);
|
||||
this.poi = mPoiBase;
|
||||
this.ID = id;
|
||||
}
|
||||
|
||||
public PoiBase getPoi() {
|
||||
if(poi == null) //不应该出现
|
||||
poi = new PoiBase("", "", 0, 0);
|
||||
return poi;
|
||||
}
|
||||
public void setPoi(PoiBase poi) {
|
||||
this.poi = poi;
|
||||
}
|
||||
public long getId() {
|
||||
return ID;
|
||||
}
|
||||
public void setId(long ID) {
|
||||
this.ID = ID;
|
||||
}
|
||||
public int getKind() {
|
||||
return kind;
|
||||
}
|
||||
public void setKind(int kind) {
|
||||
this.kind = kind;
|
||||
}
|
||||
public String getCreateDate() {
|
||||
return strCreateDate;
|
||||
}
|
||||
public void setCreateDate(String strCreateDate) {
|
||||
this.strCreateDate = strCreateDate;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.autonavi.nge.obj;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class History implements Serializable {
|
||||
private static final long serialVersionUID = 759861585179477287L;
|
||||
|
||||
private PoiBase poi;
|
||||
private int ID;
|
||||
|
||||
public PoiBase getPoi() {
|
||||
return poi;
|
||||
}
|
||||
public void setPoi(PoiBase poi) {
|
||||
this.poi = poi;
|
||||
}
|
||||
public int getID() {
|
||||
return ID;
|
||||
}
|
||||
public void setID(int ID) {
|
||||
this.ID = ID;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.autonavi.nge.obj;
|
||||
|
||||
import android.R;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
import com.zhidaoauto.map.sdk.inner.element.MapCoordinate;
|
||||
|
||||
|
||||
public class OverlayItem
|
||||
{
|
||||
protected final MapCoordinate m_Coordinate;
|
||||
protected final String m_Title;
|
||||
protected final String m_Snippet;
|
||||
protected Drawable m_Marker;
|
||||
|
||||
public static final int ITEM_STATE_FOCUSED_MASK = 4;
|
||||
public static final int ITEM_STATE_SELECTED_MASK = 2;
|
||||
public static final int ITEM_STATE_PRESSED_MASK = 1;
|
||||
private static final int ITEM_STATE_TO_STATE_SET[][] = {
|
||||
{
|
||||
-R.attr.state_focused, -R.attr.state_selected, -R.attr.state_pressed
|
||||
}, {
|
||||
-R.attr.state_focused, -R.attr.state_selected, R.attr.state_pressed
|
||||
}, {
|
||||
-R.attr.state_focused, R.attr.state_selected, -R.attr.state_pressed
|
||||
}, {
|
||||
-R.attr.state_focused, R.attr.state_selected, R.attr.state_pressed
|
||||
}, {
|
||||
R.attr.state_focused, -R.attr.state_selected, -R.attr.state_pressed
|
||||
}, {
|
||||
R.attr.state_focused, -R.attr.state_selected, R.attr.state_pressed
|
||||
}, {
|
||||
R.attr.state_focused, R.attr.state_selected, -R.attr.state_pressed
|
||||
}, {
|
||||
R.attr.state_focused, R.attr.state_selected, R.attr.state_pressed
|
||||
}
|
||||
};
|
||||
|
||||
public OverlayItem(MapCoordinate point, String title, String snippet)
|
||||
{
|
||||
m_Marker = null;
|
||||
m_Coordinate = point;
|
||||
m_Title = title;
|
||||
m_Snippet = snippet;
|
||||
}
|
||||
|
||||
public void setMarker(Drawable marker)
|
||||
{
|
||||
m_Marker = marker;
|
||||
}
|
||||
|
||||
public Drawable getMarker(int stateBitset)
|
||||
{
|
||||
if(m_Marker != null)
|
||||
{
|
||||
setState(m_Marker, stateBitset);
|
||||
}
|
||||
return m_Marker;
|
||||
}
|
||||
|
||||
public static void setState(Drawable drawable, int stateBitset)
|
||||
{
|
||||
drawable.setState(ITEM_STATE_TO_STATE_SET[stateBitset]);
|
||||
}
|
||||
|
||||
public String getTitle()
|
||||
{
|
||||
return m_Title;
|
||||
}
|
||||
|
||||
public String getSnippet()
|
||||
{
|
||||
return m_Snippet;
|
||||
}
|
||||
|
||||
public MapCoordinate getPoint()
|
||||
{
|
||||
return m_Coordinate;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
package com.autonavi.nge.obj;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.zhidaoauto.map.sdk.inner.element.MapCoordinate;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class PoiBase extends OverlayItem implements Parcelable, Serializable {
|
||||
|
||||
public static final Creator<PoiBase> CREATOR = new Creator<PoiBase>() {
|
||||
@Override
|
||||
public PoiBase createFromParcel(Parcel in) {
|
||||
String name = in.readString();
|
||||
String address = in.readString();
|
||||
String tel = in.readString();
|
||||
int x = in.readInt();
|
||||
int y = in.readInt();
|
||||
int id = in.readInt();
|
||||
return new PoiBase(name, address, tel, x, y, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PoiBase[] newArray(int size) {
|
||||
return new PoiBase[size];
|
||||
}
|
||||
};
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
public String name = "";
|
||||
public String address = "";
|
||||
public String tel = "";
|
||||
public String sDeepDetail = "";
|
||||
public int nPicId = 0;
|
||||
public int x = 0;
|
||||
public int y = 0;
|
||||
public int id = 0;
|
||||
|
||||
public PoiBase(String name, String address, int x, int y) {
|
||||
super(new MapCoordinate(x, y), name, null);
|
||||
this.name = name;
|
||||
this.address = address;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public PoiBase(String name, String address, String tel, int x, int y) {
|
||||
super(new MapCoordinate(x, y), name, null);
|
||||
this.name = name;
|
||||
this.address = address;
|
||||
this.tel = tel;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public PoiBase(String name, String address, String tel, int x, int y, int id) {
|
||||
super(new MapCoordinate(x, y), name, null);
|
||||
this.name = name;
|
||||
this.address = address;
|
||||
this.tel = tel;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public PoiBase(String name, String address, String sDeepDetail, String tel, int picId, int x, int y, int id, Drawable icon) {
|
||||
super(new MapCoordinate(x, y), name, null);
|
||||
this.name = name;
|
||||
this.address = address;
|
||||
this.tel = tel;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.id = id;
|
||||
this.nPicId = picId;
|
||||
this.sDeepDetail = sDeepDetail;
|
||||
if (null != icon) {
|
||||
m_Marker = icon;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public String getTel() {
|
||||
return tel;
|
||||
}
|
||||
|
||||
public void setTel(String tel) {
|
||||
this.tel = tel;
|
||||
}
|
||||
|
||||
public String getsDeepDetail() {
|
||||
return sDeepDetail;
|
||||
}
|
||||
|
||||
public void setsDeepDetail(String sDeepDetail) {
|
||||
this.sDeepDetail = sDeepDetail;
|
||||
}
|
||||
|
||||
public int getnPicId() {
|
||||
return nPicId;
|
||||
}
|
||||
|
||||
public void setnPicId(int nPicId) {
|
||||
this.nPicId = nPicId;
|
||||
}
|
||||
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public void setX(int x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public void setY(int y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel out, int arg1) {
|
||||
out.writeString(name);
|
||||
out.writeString(address);
|
||||
out.writeString(tel);
|
||||
out.writeInt(x);
|
||||
out.writeInt(y);
|
||||
out.writeInt(id);
|
||||
}
|
||||
|
||||
public void readFromParcel(Parcel in) {
|
||||
name = in.readString();
|
||||
address = in.readString();
|
||||
tel = in.readString();
|
||||
x = in.readInt();
|
||||
y = in.readInt();
|
||||
id = in.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PoiBase{" +
|
||||
"name='" + name + '\'' +
|
||||
", address='" + address + '\'' +
|
||||
", tel='" + tel + '\'' +
|
||||
", sDeepDetail='" + sDeepDetail + '\'' +
|
||||
", nPicId=" + nPicId +
|
||||
", x=" + x +
|
||||
", y=" + y +
|
||||
", id=" + id +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.autonavi.nge.obj;
|
||||
|
||||
public class StaticResult {
|
||||
public long startTime = 0;
|
||||
public double totalDuration;
|
||||
public int index;
|
||||
public double travelDuration;
|
||||
public double meanSpeed = 0;
|
||||
public double MaxSpeed;
|
||||
public double tollSpeed;
|
||||
public int num;
|
||||
public double idlingDuration;
|
||||
public double lowSpeedDuration;
|
||||
public double midSpeedDuration;
|
||||
public double highSpeedDuration;
|
||||
public double hotCarDuration;
|
||||
public double stopCarDuration;
|
||||
public double roallSpeed;
|
||||
public int rpSpeedUpNum;
|
||||
public int rpSpeedDownNum;
|
||||
public int rpTurnNum;
|
||||
public int rspeedUpnum;
|
||||
public int rspeedDownnum;
|
||||
public int rturn;
|
||||
public double computationalLoad;
|
||||
public double batteryVoltageL;
|
||||
public double coolantTemperature;
|
||||
public double throttlePosition;
|
||||
public double faultcode;
|
||||
public double speed;
|
||||
private static StaticResult instance = null;
|
||||
|
||||
public StaticResult() {
|
||||
totalDuration = 0;
|
||||
travelDuration = 0;
|
||||
meanSpeed = 0;
|
||||
MaxSpeed = 0;
|
||||
tollSpeed = 0;
|
||||
num = 0;
|
||||
idlingDuration = 0;
|
||||
lowSpeedDuration = 0;
|
||||
midSpeedDuration = 0;
|
||||
highSpeedDuration = 0;
|
||||
hotCarDuration = 0;
|
||||
stopCarDuration = 0;
|
||||
rpSpeedUpNum = 0;
|
||||
rpSpeedDownNum = 0;
|
||||
rpTurnNum = 0;
|
||||
roallSpeed = -1;
|
||||
rspeedUpnum = 0;
|
||||
rspeedDownnum = 0;
|
||||
rturn = 0;
|
||||
faultcode = 0;
|
||||
computationalLoad = -Double.MAX_VALUE;
|
||||
batteryVoltageL = -Double.MAX_VALUE;
|
||||
coolantTemperature = -Double.MAX_VALUE;
|
||||
throttlePosition = -Double.MAX_VALUE;
|
||||
speed = 0;
|
||||
}
|
||||
|
||||
public static StaticResult getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new StaticResult();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void initialize(long startTime) {
|
||||
this.startTime = startTime;
|
||||
totalDuration = 0;
|
||||
travelDuration = 0;
|
||||
meanSpeed = 0;
|
||||
MaxSpeed = 0;
|
||||
tollSpeed = 0;
|
||||
num = 0;
|
||||
idlingDuration = 0;
|
||||
lowSpeedDuration = 0;
|
||||
midSpeedDuration = 0;
|
||||
highSpeedDuration = 0;
|
||||
hotCarDuration = 0;
|
||||
stopCarDuration = 0;
|
||||
rpSpeedUpNum = 0;
|
||||
rpSpeedDownNum = 0;
|
||||
rpTurnNum = 0;
|
||||
roallSpeed = -1;
|
||||
rspeedUpnum = 0;
|
||||
rspeedDownnum = 0;
|
||||
rturn = 0;
|
||||
faultcode = 0;
|
||||
computationalLoad = -Double.MAX_VALUE;
|
||||
batteryVoltageL = -Double.MAX_VALUE;
|
||||
coolantTemperature = -Double.MAX_VALUE;
|
||||
throttlePosition = -Double.MAX_VALUE;
|
||||
speed = 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.autonavi.nge.obj;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
public class SubCategory implements Parcelable{
|
||||
|
||||
public static final Creator<SubCategory> CREATOR = new Creator<SubCategory>() {
|
||||
@Override
|
||||
public SubCategory[] newArray(int size) {
|
||||
|
||||
return new SubCategory[size];
|
||||
}
|
||||
|
||||
@Override
|
||||
public SubCategory createFromParcel(Parcel in) {
|
||||
SubCategory subCategory = new SubCategory();
|
||||
subCategory.setKindId(in.readInt());
|
||||
subCategory.setCatName(in.readString());
|
||||
return subCategory;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
int m_iKindId = 0;
|
||||
String m_sCatName = "";
|
||||
|
||||
public int getKindId() {
|
||||
return m_iKindId;
|
||||
}
|
||||
|
||||
public String getCatName() {
|
||||
return m_sCatName;
|
||||
}
|
||||
|
||||
public void setKindId(int iKindId) {
|
||||
this.m_iKindId = iKindId;
|
||||
}
|
||||
|
||||
public void setCatName(String sCatName) {
|
||||
this.m_sCatName = sCatName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel out, int arg1) {
|
||||
out.writeInt(m_iKindId);
|
||||
out.writeString(m_sCatName);
|
||||
}
|
||||
|
||||
public void readFromParcel(Parcel in) {
|
||||
m_iKindId = in.readInt();
|
||||
m_sCatName = in.readString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.autonavi.nge.obj;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
public class UpdateRegion implements Parcelable{
|
||||
|
||||
public static final Creator<UpdateRegion> CREATOR = new Creator<UpdateRegion>() {
|
||||
|
||||
@Override
|
||||
public UpdateRegion[] newArray(int size) {
|
||||
|
||||
return new UpdateRegion[size];
|
||||
}
|
||||
|
||||
@Override
|
||||
public UpdateRegion createFromParcel(Parcel in) {
|
||||
UpdateRegion updateRegion = new UpdateRegion();
|
||||
updateRegion.setUrId(in.readInt());
|
||||
updateRegion.setUrNameId(in.readInt());
|
||||
updateRegion.setUrName(in.readString());
|
||||
return updateRegion;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
int m_urId;
|
||||
int m_urNameId;
|
||||
String m_urName;
|
||||
|
||||
public int getUrId() {
|
||||
return m_urId;
|
||||
}
|
||||
|
||||
public void setUrId(int urId) {
|
||||
this.m_urId = urId;
|
||||
}
|
||||
|
||||
public int getUrNameId() {
|
||||
return m_urNameId;
|
||||
}
|
||||
|
||||
public void setUrNameId(int urNameId) {
|
||||
this.m_urNameId = urNameId;
|
||||
}
|
||||
|
||||
public String getUrName() {
|
||||
return m_urName;
|
||||
}
|
||||
|
||||
public void setUrName(String urName) {
|
||||
this.m_urName = urName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel out, int arg1) {
|
||||
out.writeInt(m_urId);
|
||||
out.writeInt(m_urNameId);
|
||||
out.writeString(m_urName);
|
||||
}
|
||||
|
||||
public void readFromParcel(Parcel in) {
|
||||
m_urId = in.readInt();
|
||||
m_urNameId = in.readInt();
|
||||
m_urName = in.readString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UpdateRegion{" +
|
||||
"m_urId=" + m_urId +
|
||||
", m_urNameId=" + m_urNameId +
|
||||
", m_urName='" + m_urName + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.autonavi.nge.routeinfo;
|
||||
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
|
||||
import com.zhidaoauto.map.sdk.inner.CompileConfig;
|
||||
|
||||
public class RouteInfoProvider {
|
||||
|
||||
{
|
||||
System.loadLibrary("map");
|
||||
}
|
||||
|
||||
|
||||
private static final String TAG = "RouteInfoProvider";
|
||||
|
||||
public RouteInfoProvider() {
|
||||
if (CompileConfig.INSTANCE.getDEBUG()) {
|
||||
Log.i(TAG, "roadop load database");
|
||||
}
|
||||
|
||||
String shmdataDir = Environment.getExternalStorageDirectory().getAbsolutePath() + "/shmdata/";
|
||||
RouteInfoProvider.init(shmdataDir);
|
||||
}
|
||||
|
||||
private native static boolean init(String dir);
|
||||
@Deprecated
|
||||
public native String getRouteInfo(float centerLon, float centerLat,int type, int nFuncClass);
|
||||
@Deprecated
|
||||
public native float getRouteAngle(float startLon, float startLat,float endLon, float endLat);
|
||||
@Deprecated
|
||||
public native double [] matchPointOnRoad(double[] allPoint, boolean bGetAllPoints);
|
||||
@Deprecated
|
||||
public native String matchSinglePointOnRoad(float fLon, float fLat, float fAngle);
|
||||
|
||||
public native String matchHDSinglePointOnRoad(double fLon, double fLat, float fAngle, float fDistance, float fDetaAngle, boolean isZeroNo);
|
||||
public native double getOffRoadDistance(double dLon, double dLat, double dAngle);
|
||||
public native static void release();
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
package com.autonavi.nge.routing;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.autonavi.nge.trafficInfo.TMCID;
|
||||
import com.zhidaoauto.map.sdk.inner.CompileConfig;
|
||||
import com.zhidaoauto.map.sdk.inner.utils.Constant;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RoutingProvider {
|
||||
|
||||
private static final String TAG = "RoutingProvider";
|
||||
|
||||
// cost model
|
||||
public static final int COSTMODEL_DEFAULT = 0; // default cost model
|
||||
public static final int COSTMODEL_FASTEST = 1; // fast test cost model, consider eta mostly
|
||||
public static final int COSTMODEL_SHORTEST = 2; // shortest cost model, consider distance mostly
|
||||
public static final int COSTMODEL_SUGGEST = 3; // suggested cost model, consider varius factors
|
||||
public static final int COSTMODEL_ECO = 4; // eco cost model ,consider economy factor mostly
|
||||
|
||||
// route style definition
|
||||
public static final int ROUTESTYLE_DEFAULT = 0; // default route style
|
||||
public static final int ROUTESTYLE_VEHICLE = 1; // vehicle route style
|
||||
public static final int ROUTESTYLE_PEDESTRIAN = 2; // pedestrian route style, for walking
|
||||
public static final int ROUTESTYLE_BICYCLE = 3; // bicycle route style
|
||||
public static final int ROUTESTYLE_TRUCK = 4; // truck route style
|
||||
|
||||
private boolean enableAlter = false;
|
||||
|
||||
public RoutingProvider() {
|
||||
String dir = Constant.getNDSDataPath();
|
||||
load(dir, "autonavi", null);
|
||||
//setloglevel(1, 4);
|
||||
}
|
||||
|
||||
{
|
||||
// System.loadLibrary("datascript");
|
||||
// System.loadLibrary("ndssqlite");
|
||||
// System.loadLibrary("ndssystem");
|
||||
// System.loadLibrary("ndsprovider");
|
||||
// System.loadLibrary("datamgr");
|
||||
System.loadLibrary("routing");
|
||||
// System.loadLibrary("pbjni");
|
||||
}
|
||||
|
||||
public void destroyProvider() { unload(); }
|
||||
|
||||
public void setOrigin(double lon, double lat, int sessionid) {
|
||||
setorigin(lon, lat, -1, sessionid);
|
||||
//setloglevel(1, 4);
|
||||
}
|
||||
|
||||
public void setDest(double lon, double lat, int sessionid) {
|
||||
setdest(lon, lat, sessionid);
|
||||
}
|
||||
public void getRoute(int sessionid) {
|
||||
if (CompileConfig.INSTANCE.getDEBUG()) {
|
||||
Log.i(TAG, "navop-getRoute:start:sessionid:"+sessionid);
|
||||
}
|
||||
if (enableAlter) {
|
||||
startnavi(1, sessionid);
|
||||
} else {
|
||||
startnavi(0, sessionid);
|
||||
}
|
||||
if (CompileConfig.INSTANCE.getDEBUG()) {
|
||||
Log.i(TAG, "navop-getRoute:end:sessionid:"+sessionid);
|
||||
}
|
||||
}
|
||||
|
||||
public void setCostModel(int costmodel, int sessionid) {
|
||||
setcostmodel(costmodel, sessionid);
|
||||
}
|
||||
|
||||
public void setRouteStyle(int costmodel, int sessionid) {
|
||||
setroutestyle(costmodel, sessionid);
|
||||
}
|
||||
|
||||
public void setAvoidHighway(boolean avoidHwy, int sessionid) {
|
||||
if (avoidHwy) {
|
||||
setavoidhighway(1, sessionid);
|
||||
} else {
|
||||
setavoidhighway(0, sessionid);
|
||||
}
|
||||
}
|
||||
|
||||
public void setAvoidToll(boolean avoidToll, int sessionid) {
|
||||
if (avoidToll) {
|
||||
setavoidtoll(1, sessionid);
|
||||
} else {
|
||||
setavoidtoll(0, sessionid);
|
||||
}
|
||||
}
|
||||
|
||||
public void setUseTraffic(boolean useTraffic, int sessionid) {
|
||||
if (useTraffic) {
|
||||
setusetraffic(1, sessionid);
|
||||
} else {
|
||||
setusetraffic(0, sessionid);
|
||||
}
|
||||
}
|
||||
|
||||
public int getRouteNum(int sessionid) {
|
||||
return getroutenum(sessionid);
|
||||
}
|
||||
|
||||
public int getLength(int route, int sessionid) {
|
||||
return getlength(route, sessionid);
|
||||
}
|
||||
|
||||
// get static time
|
||||
public int getSTime(int route, int sessionid) {
|
||||
return getstime(route, sessionid);
|
||||
}
|
||||
|
||||
// get dynamic time
|
||||
public int getDTime(int route, int sessionid) {
|
||||
return getdtime(route, sessionid);
|
||||
}
|
||||
|
||||
public void setTrafStat(List<TMCID> ids, int evt) {
|
||||
int[] tmcs = new int[ids.size()];
|
||||
byte[] dirs = new byte[ids.size()];
|
||||
|
||||
for (int i = 0; i < ids.size(); i++) {
|
||||
tmcs[i] = ids.get(i).getId();
|
||||
dirs[i] = ids.get(i).getDir();
|
||||
}
|
||||
|
||||
settrafstat(tmcs, dirs, evt);
|
||||
}
|
||||
|
||||
public void setTrafSpeedByTile(int tile, int[] ids, byte[] speeds) {
|
||||
settrafspeedbytile(tile, ids, speeds);
|
||||
}
|
||||
|
||||
public void addWayPoint(float lon, float lat, int heading, int sessionid){
|
||||
addwaypoint(lon, lat, heading, sessionid);
|
||||
}
|
||||
|
||||
public void clearWayPoints(int sessionid){
|
||||
clearwaypoints(sessionid);
|
||||
}
|
||||
|
||||
|
||||
private native static void setavoidtoll(boolean avoidtoll);
|
||||
private native static void setroutestyle(int routestyle);
|
||||
|
||||
public boolean getStatus(int sessionid) { return getstatus(sessionid); }
|
||||
public void reset(int sessionid) { resetnavi(sessionid); }
|
||||
public void clearTour(int sessionid) { cleartour(sessionid); }
|
||||
|
||||
|
||||
private native static boolean load(String dir, String vendor, String region);
|
||||
private native static void unload();
|
||||
private native static void setorigin(double lon, double lat, int heading, int sessionid);
|
||||
private native static void setdest(double lon, double lat, int sessionid);
|
||||
private native static void addwaypoint(float lon, float lat, int heading, int sessionid);
|
||||
private native static void clearwaypoints(int sessionid);
|
||||
private native static void setpreferroad(String roadname, int sessionid);
|
||||
private native static void startnavi(int isalter, int sessionid);
|
||||
private native static boolean getstatus(int sessionid);
|
||||
private native static void resetnavi(int sessionid);
|
||||
private native static void cleartour(int sessionid);
|
||||
private native static void setcostmodel(int costmodel, int sessionid);
|
||||
private native static void setavoidhighway(int avoidhwy, int sessionid);
|
||||
private native static void setavoidtoll(int avoidtoll, int sessionid);
|
||||
private native static void setroutestyle(int routestyle, int sessionid);
|
||||
private native static void setusetraffic(int usetraffic, int sessionid);
|
||||
private native static int getroutenum(int sessionid);
|
||||
private native static int getlength(int route, int sessionid);
|
||||
private native static int getstime(int route, int sessionid);
|
||||
private native static int getdtime(int route, int sessionid);
|
||||
private native static void settrafstat(int[] ids, byte[] dirs, int evt);
|
||||
private native static void settrafspeedbytile(int tile, int[] ids, byte[] speeds);
|
||||
private native static void setloglevel(int appender, int level);
|
||||
public native static int getsearchedcnt(int route, int sessionid);
|
||||
} /// class RoutingProvider
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.autonavi.nge.search;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.util.Pair;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public class SPCategories implements Parcelable, Serializable {
|
||||
private List<Pair<Integer, String>> categories;
|
||||
|
||||
|
||||
public SPCategories() {
|
||||
}
|
||||
|
||||
protected SPCategories(Parcel in) {
|
||||
}
|
||||
|
||||
public static final Creator<SPCategories> CREATOR = new Creator<SPCategories>() {
|
||||
@Override
|
||||
public SPCategories createFromParcel(Parcel in) {
|
||||
return new SPCategories(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SPCategories[] newArray(int size) {
|
||||
return new SPCategories[size];
|
||||
}
|
||||
};
|
||||
|
||||
public List<Pair<Integer, String>> getCategories() {
|
||||
return categories;
|
||||
}
|
||||
|
||||
public void setCategories(List<Pair<Integer, String>> categories) {
|
||||
this.categories = categories;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SPCategories{" +
|
||||
"categories=" + categories +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.autonavi.nge.search;
|
||||
|
||||
public final class SPConstants {
|
||||
// 语言码
|
||||
public static int LANGUAGE_CODE_ZH_CN = 31;
|
||||
public static int LANGUAGE_CODE_EN = 182;
|
||||
|
||||
// 检索关键字的类型。NOTE: 注释的部分为暂时不支持的检索方式
|
||||
public static int SEARCH_TYPE_POI = 0;
|
||||
public static int SEARCH_TYPE_POI_NAME = 1;
|
||||
// public static int SEARCH_TYPE_POI_ADDRESS = 2;
|
||||
public static int SEARCH_TYPE_POI_TELEPHONE = 3;
|
||||
// public static int SEARCH_TYPE_POI_POSTCODE = 4;
|
||||
// public static int SEARCH_TYPE_ROAD = 5;
|
||||
// public static int SEARCH_TYPE_ROAD_NAME = 6;
|
||||
// public static int SEARCH_TYPE_CROSS_ROAD = 7;
|
||||
// public static int SEARCH_TYPE_ADMIN = 8;
|
||||
// public static int SEARCH_TYPE_FTS_BOUND = 9;
|
||||
// public static int SEARCH_TYPE_POI_BOUND = 10;
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.autonavi.nge.search;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class SPLatLonPoint implements Parcelable, Serializable {
|
||||
public float lat;
|
||||
public float lon;
|
||||
public SPLatLonPoint(float lat, float lon) {
|
||||
this.lat = lat;
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public SPLatLonPoint(double lat, double lon) {
|
||||
this((float)lat,(float)lon);
|
||||
}
|
||||
|
||||
public SPLatLonPoint(int latE6, int lonE6) {
|
||||
this.lat = E6ToDMS(latE6);
|
||||
this.lon = E6ToDMS(lonE6);
|
||||
}
|
||||
|
||||
protected SPLatLonPoint(Parcel in) {
|
||||
lat = in.readFloat();
|
||||
lon = in.readFloat();
|
||||
}
|
||||
|
||||
public static final Creator<SPLatLonPoint> CREATOR = new Creator<SPLatLonPoint>() {
|
||||
@Override
|
||||
public SPLatLonPoint createFromParcel(Parcel in) {
|
||||
return new SPLatLonPoint(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SPLatLonPoint[] newArray(int size) {
|
||||
return new SPLatLonPoint[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("(%.7f, %.7f)", lon, lat);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将 E6 标准的经纬度转换成 DMS 标准
|
||||
* @param lonOrLat 经纬度
|
||||
*/
|
||||
private static float E6ToDMS(int lonOrLat) {
|
||||
return lonOrLat / 1e6f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeFloat(lat);
|
||||
dest.writeFloat(lon);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.autonavi.nge.search;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class SPPoiItem implements Parcelable,Serializable {
|
||||
public int poiId;
|
||||
public int kind;
|
||||
public SPLatLonPoint location; // 经纬度
|
||||
public String title; // 名字
|
||||
public String snippet; // 地址
|
||||
public String tel; // 电话
|
||||
public String postcode; // 邮编
|
||||
|
||||
public SPPoiItem() {
|
||||
}
|
||||
|
||||
protected SPPoiItem(Parcel in) {
|
||||
poiId = in.readInt();
|
||||
kind = in.readInt();
|
||||
title = in.readString();
|
||||
snippet = in.readString();
|
||||
tel = in.readString();
|
||||
postcode = in.readString();
|
||||
}
|
||||
|
||||
public static final Creator<SPPoiItem> CREATOR = new Creator<SPPoiItem>() {
|
||||
@Override
|
||||
public SPPoiItem createFromParcel(Parcel in) {
|
||||
return new SPPoiItem(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SPPoiItem[] newArray(int size) {
|
||||
return new SPPoiItem[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeInt(poiId);
|
||||
dest.writeInt(kind);
|
||||
dest.writeString(title);
|
||||
dest.writeString(snippet);
|
||||
dest.writeString(tel);
|
||||
dest.writeString(postcode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SPPoiItem{" +
|
||||
"poiId=" + poiId +
|
||||
", kind=" + kind +
|
||||
", location=" + location +
|
||||
", title='" + title + '\'' +
|
||||
", snippet='" + snippet + '\'' +
|
||||
", tel='" + tel + '\'' +
|
||||
", postcode='" + postcode + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.autonavi.nge.search;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class SPQuery implements Parcelable, Serializable {
|
||||
// 每页最多有多少个数据
|
||||
private static int PAGE_SIZE_LIMIT = 50;
|
||||
|
||||
// 检索关键字
|
||||
public String keyword = null;
|
||||
// 检索范围。通过指定范围即可获取某个点附近的poi
|
||||
public SPSearchBound bound = null;
|
||||
// 检索的类型
|
||||
public int searchType = SPConstants.SEARCH_TYPE_POI;
|
||||
// 分页大小
|
||||
public int pageSize = 10;
|
||||
// 0 表示从头开始。其他值,表示上一次查询结果里面 poiId 的最大值
|
||||
public int pageStart = 0;
|
||||
// 语种。(NOTE: 该参数目前为保留参数。修改也无实际效果)
|
||||
public int languageCode = SPConstants.LANGUAGE_CODE_ZH_CN;
|
||||
// 分类。0 表示不限制
|
||||
public int categoryId = 0;
|
||||
// 限制搜索的区域 null 表示全国,"北京市" 这样的表示指定城市,"昌平区,北京市" 这样的表示更具体的区级别指定
|
||||
// 在指定了 bound 的情况下,将忽略 region 参数
|
||||
public String region = null;
|
||||
|
||||
public SPQuery() {
|
||||
}
|
||||
|
||||
protected SPQuery(Parcel in) {
|
||||
keyword = in.readString();
|
||||
searchType = in.readInt();
|
||||
pageSize = in.readInt();
|
||||
pageStart = in.readInt();
|
||||
languageCode = in.readInt();
|
||||
categoryId = in.readInt();
|
||||
region = in.readString();
|
||||
}
|
||||
|
||||
public static final Creator<SPQuery> CREATOR = new Creator<SPQuery>() {
|
||||
@Override
|
||||
public SPQuery createFromParcel(Parcel in) {
|
||||
return new SPQuery(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SPQuery[] newArray(int size) {
|
||||
return new SPQuery[size];
|
||||
}
|
||||
};
|
||||
|
||||
public boolean isValid() {
|
||||
if (bound != null && !bound.isValid()) return false;
|
||||
return (pageSize > 0 && pageSize <= PAGE_SIZE_LIMIT && pageStart >= 0 && !TextUtils.isEmpty(keyword));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeString(keyword);
|
||||
dest.writeInt(searchType);
|
||||
dest.writeInt(pageSize);
|
||||
dest.writeInt(pageStart);
|
||||
dest.writeInt(languageCode);
|
||||
dest.writeInt(categoryId);
|
||||
dest.writeString(region);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SPQuery{" +
|
||||
"keyword='" + keyword + '\'' +
|
||||
", bound=" + bound +
|
||||
", searchType=" + searchType +
|
||||
", pageSize=" + pageSize +
|
||||
", pageStart=" + pageStart +
|
||||
", languageCode=" + languageCode +
|
||||
", categoryId=" + categoryId +
|
||||
", region='" + region + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
package com.autonavi.nge.search;
|
||||
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class SPSearchBound implements Parcelable, Serializable {
|
||||
protected SPSearchBound(Parcel in) {
|
||||
this.shape = NONE;
|
||||
points = null;
|
||||
}
|
||||
|
||||
public SPSearchBound() {
|
||||
this.shape = NONE;
|
||||
points = null;
|
||||
}
|
||||
|
||||
public static final Creator<SPSearchBound> CREATOR = new Creator<SPSearchBound>() {
|
||||
@Override
|
||||
public SPSearchBound createFromParcel(Parcel in) {
|
||||
return new SPSearchBound(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SPSearchBound[] newArray(int size) {
|
||||
return new SPSearchBound[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
}
|
||||
|
||||
public static final int CIRCLE = 0;
|
||||
public static final int RECT = 1;
|
||||
public static final int POLYGON = 2;
|
||||
public static final int NONE = 3;
|
||||
|
||||
public final int shape;
|
||||
public final SPLatLonPoint[] points;
|
||||
|
||||
// 可以用来配置最大允许的检索范围上限
|
||||
// 目前建议不要超过 3000m 否则会对速度有影响
|
||||
public float maxDistance = 3000;
|
||||
|
||||
/**
|
||||
* 圆形检索。或者用于检索距离一个目标点附近的点并按距离排序
|
||||
* @param center
|
||||
* @param m 需要大于 0
|
||||
* @param isSortByDistance
|
||||
*/
|
||||
public SPSearchBound(@NonNull final SPLatLonPoint center, float m, boolean isSortByDistance) {
|
||||
this.shape = SPSearchBound.CIRCLE;
|
||||
points = new SPLatLonPoint[2];
|
||||
points[0] = center;
|
||||
points[1] = new SPLatLonPoint(m, isSortByDistance ? 1f : 0f);
|
||||
}
|
||||
|
||||
public SPSearchBound(@NonNull final SPLatLonPoint leftBottom, @NonNull final SPLatLonPoint rightTop) {
|
||||
this.shape = SPSearchBound.RECT;
|
||||
points = new SPLatLonPoint[2];
|
||||
points[0] = leftBottom;
|
||||
points[1] = rightTop;
|
||||
}
|
||||
|
||||
/**
|
||||
* 需要是凸多边形
|
||||
* @param points
|
||||
*/
|
||||
public SPSearchBound(@NonNull final List<SPLatLonPoint> points) {
|
||||
this.shape = SPSearchBound.POLYGON;
|
||||
this.points = new SPLatLonPoint[points.size()];
|
||||
for (int i = 0; i < points.size(); ++i) {
|
||||
this.points[i] = points.get(i);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判定参数是否有效。包含了最大点距离检测,是否为凸多边形
|
||||
* @return
|
||||
*/
|
||||
public boolean isValid() {
|
||||
switch (this.shape) {
|
||||
case SPSearchBound.CIRCLE:
|
||||
return isValidCircle();
|
||||
case SPSearchBound.RECT:
|
||||
return isValidRect();
|
||||
case SPSearchBound.POLYGON:
|
||||
return isValidPolygon();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过经纬度的差值求距离
|
||||
* @param deltaDegree
|
||||
* @return 距离单位为
|
||||
*/
|
||||
static public float getDistance(float deltaDegree) {
|
||||
return (40075e3f * deltaDegree) / 360;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断一组点是否能组成凸多边形
|
||||
* @param points
|
||||
* @return
|
||||
*/
|
||||
static public boolean isConvexPolygon(@NonNull final SPLatLonPoint[] points) {
|
||||
int n = points.length;
|
||||
if (n < 3) return false;
|
||||
|
||||
// 先根据获取到的一个非0 向量叉积来定义点是顺是真还是逆时针的
|
||||
int dir = 0;
|
||||
for (int i = 0; i < n; ++i) {
|
||||
SPLatLonPoint a = points[i];
|
||||
SPLatLonPoint b = points[(i + 1) % n];
|
||||
SPLatLonPoint c = points[(i + 2) % n];
|
||||
|
||||
// 求叉积
|
||||
double t = (double)(a.lon - c.lon) * (double)(b.lat - c.lat) - (double)(b.lon - c.lon) * (double)(a.lat - c.lat);
|
||||
// 浮点数计算是有误差的。如果t的绝对值小于一个预订值,我们就认为他是0
|
||||
if (Math.abs(t) < 0.0000001) continue;
|
||||
// 定下来点排列的方向
|
||||
if (dir == 0) {
|
||||
// 三个点称顺时针排列
|
||||
if (t < 0) {
|
||||
dir = -1;
|
||||
} else {
|
||||
dir = 1;
|
||||
}
|
||||
}
|
||||
// 和第一组有顺逆时针方向的点趋势不一致的时候就可以断定非凸多边形
|
||||
if ((t * dir) < 0) return false;
|
||||
}
|
||||
return dir != 0;
|
||||
}
|
||||
|
||||
private boolean isValidCircle() {
|
||||
// 检测半径是否超了
|
||||
float r = points[1].lat;
|
||||
return r > 0 && r <= maxDistance;
|
||||
}
|
||||
|
||||
private boolean isValidRect() {
|
||||
// 判断点的位置是否正确
|
||||
SPLatLonPoint lb = points[0];
|
||||
SPLatLonPoint rt = points[1];
|
||||
if (lb.lat >= rt.lat || lb.lon >= rt.lon) return false;
|
||||
|
||||
// 判定距离是否合法
|
||||
float d2 = maxDistance + maxDistance;
|
||||
return getDistance(rt.lat - lb.lat) <= d2 && getDistance(rt.lon - lb.lon) <= d2;
|
||||
}
|
||||
|
||||
private boolean isValidPolygon() {
|
||||
// 先检测是否是凸多边形
|
||||
if (!isConvexPolygon(points)) return false;
|
||||
// 检测点和点之间的距离。作为最大允许的圆形范围的内接多边形检测距离
|
||||
double d22 = Math.pow(maxDistance + maxDistance, 2);
|
||||
for (int i = 0; i < points.length - 1; ++i) {
|
||||
SPLatLonPoint a = points[i];
|
||||
for (int j = i + 1; j < points.length; ++j) {
|
||||
SPLatLonPoint b = points[j];
|
||||
if (Math.pow((a.lat - b.lat), 2) + Math.pow((a.lon - b.lon), 2) > d22) return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SPSearchBound{" +
|
||||
"shape=" + shape +
|
||||
", points=" + Arrays.toString(points) +
|
||||
", maxDistance=" + maxDistance +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.autonavi.nge.search;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public final class SPSearchResult implements Parcelable, Serializable {
|
||||
// poi 信息
|
||||
public SPPoiItem poi;
|
||||
// 排序用 ID
|
||||
public int orderId;
|
||||
|
||||
public SPSearchResult(SPPoiItem item, int orderId) {
|
||||
this.orderId = orderId;
|
||||
this.poi = item;
|
||||
}
|
||||
|
||||
protected SPSearchResult(Parcel in) {
|
||||
poi = in.readParcelable(SPPoiItem.class.getClassLoader());
|
||||
orderId = in.readInt();
|
||||
}
|
||||
|
||||
public static final Creator<SPSearchResult> CREATOR = new Creator<SPSearchResult>() {
|
||||
@Override
|
||||
public SPSearchResult createFromParcel(Parcel in) {
|
||||
return new SPSearchResult(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SPSearchResult[] newArray(int size) {
|
||||
return new SPSearchResult[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
parcel.writeParcelable(poi, i);
|
||||
parcel.writeInt(orderId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SPSearchResult{" +
|
||||
"poi=" + poi +
|
||||
", orderId=" + orderId +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
//package com.autonavi.nge.search
|
||||
//
|
||||
//import com.autonavi.nge.dm.NavigationCore
|
||||
//import com.autonavi.nge.dm.SharedMemoryService
|
||||
//import com.zhidaoauto.map.sdk.inner.controller.CommonController
|
||||
//
|
||||
//object SearchAutoApi {
|
||||
//
|
||||
// fun init(){
|
||||
// if(CommonController.instance.iNavigationCore == null){
|
||||
// CommonController.instance.iNavigationCore = NavigationCore(SharedMemoryService.getInstance())
|
||||
// }s
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,173 @@
|
||||
package com.autonavi.nge.search;
|
||||
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.zhidaoauto.map.sdk.inner.CompileConfig;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SearchProvider {
|
||||
|
||||
private static final String TAG = "SearchProvider";
|
||||
|
||||
{
|
||||
System.loadLibrary("datamgr");
|
||||
System.loadLibrary("search");
|
||||
}
|
||||
|
||||
public SearchProvider() {
|
||||
|
||||
if(CompileConfig.INSTANCE.getDEBUG()){
|
||||
Log.i(TAG, "searchop--SearchProvider load start");
|
||||
}
|
||||
load();
|
||||
if(CompileConfig.INSTANCE.getDEBUG()){
|
||||
Log.i(TAG, "searchop--SearchProvider load over");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化。使用所有接口前应先调用该接口
|
||||
*/
|
||||
public static void load() {
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
* 释放数据
|
||||
*/
|
||||
public static void unload() {
|
||||
release();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有分类列表。应在初始化的时候调用一次
|
||||
* @param languageCode SPConstants.LANGUAGE_CODE_xxx
|
||||
* @return 返回 categoryId, categoryName 组成的列表
|
||||
*/
|
||||
public synchronized static @Nullable
|
||||
List<Pair<Integer, String>> getAllPoiCategories(int languageCode) {
|
||||
byte[] data = queryAllPoiCategories(languageCode);
|
||||
return parseIntStrPairList(bytes2ByteBuffer(data));
|
||||
}
|
||||
|
||||
public synchronized static @Nullable List<SPSearchResult> getPoiItemList(@NonNull final SPQuery query) {
|
||||
// 参数检测
|
||||
if (!query.isValid()) {
|
||||
return null;
|
||||
}
|
||||
if (CompileConfig.INSTANCE.getDEBUG()) {
|
||||
Log.i(TAG, "searchop--getPoiItemList--start--"+query);
|
||||
}
|
||||
|
||||
byte[] data = queryPoiItemList(query);
|
||||
if (CompileConfig.INSTANCE.getDEBUG()) {
|
||||
Log.i(TAG, "searchop--getPoiItemList--end--"+Thread.currentThread().getId());
|
||||
}
|
||||
return parseSPSearchResultList(bytes2ByteBuffer(data));
|
||||
}
|
||||
|
||||
public synchronized static @Nullable SPPoiItem getPoiItemByPoiId(int poiId) {
|
||||
byte[] data = queryPoiItemByPoiId(poiId);
|
||||
return parseSPPoiItem(bytes2ByteBuffer(data));
|
||||
}
|
||||
|
||||
/// private methods
|
||||
private static String buf2Str(final ByteBuffer buf) {
|
||||
int l = buf.getShort();
|
||||
String ret = null;
|
||||
if (l > 0) {
|
||||
byte[] tmp = new byte[l];
|
||||
for (int idx = 0; idx < l; idx++) {
|
||||
tmp[idx] = (byte) buf.get();
|
||||
}
|
||||
try {
|
||||
ret = new String(tmp, "UTF8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
private static ByteBuffer bytes2ByteBuffer(final byte[] data) {
|
||||
// 对数据进行格式化
|
||||
if (data == null || data.length < 1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ByteBuffer buf = ByteBuffer.wrap(data);
|
||||
buf.order(ByteOrder.LITTLE_ENDIAN);
|
||||
return buf;
|
||||
}
|
||||
|
||||
private static SPPoiItem parseSPPoiItem(final ByteBuffer buf) {
|
||||
if (buf == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
SPPoiItem item = new SPPoiItem();
|
||||
item.poiId = buf.getInt();
|
||||
item.kind = buf.getInt();
|
||||
item.location = new SPLatLonPoint(buf.getInt(), buf.getInt());
|
||||
item.title = buf2Str(buf);
|
||||
item.snippet = buf2Str(buf);
|
||||
item.tel = buf2Str(buf);
|
||||
item.postcode = buf2Str(buf);
|
||||
return item;
|
||||
}
|
||||
|
||||
private static SPSearchResult parseSPSearchResult(final ByteBuffer buf) {
|
||||
SPPoiItem item = parseSPPoiItem(buf);
|
||||
if (item == null) return null;
|
||||
return new SPSearchResult(item, buf.getInt());
|
||||
}
|
||||
|
||||
private static List<SPSearchResult> parseSPSearchResultList(final ByteBuffer buf) {
|
||||
if (buf == null) {
|
||||
return null;
|
||||
}
|
||||
int itemCount = buf.getInt();
|
||||
|
||||
List<SPSearchResult> ret = new ArrayList<SPSearchResult>(itemCount);
|
||||
while (itemCount --> 0) {
|
||||
ret.add(parseSPSearchResult(buf));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
private static Pair<Integer, String> parseIntStrPair(final ByteBuffer buf) {
|
||||
if (buf == null) {
|
||||
return null;
|
||||
}
|
||||
return new Pair<Integer, String>(new Integer(buf.getInt()), buf2Str(buf));
|
||||
}
|
||||
|
||||
private static List<Pair<Integer, String>> parseIntStrPairList(final ByteBuffer buf) {
|
||||
if (buf == null) {
|
||||
return null;
|
||||
}
|
||||
int cnt = buf.getInt();
|
||||
|
||||
List<Pair<Integer, String>> ret = new ArrayList<Pair<Integer, String>>(cnt);
|
||||
while (cnt --> 0) {
|
||||
ret.add(parseIntStrPair(buf));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// native methods
|
||||
private static native boolean init();
|
||||
private static native void release();
|
||||
private static native byte[] queryPoiItemList(SPQuery query);
|
||||
private static native byte[] queryPoiItemByPoiId(int poiId);
|
||||
private static native byte[] queryAllPoiCategories(int languageCode);
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.autonavi.nge.trafficInfo;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
public class TMCID implements Parcelable{
|
||||
|
||||
public static final Creator<TMCID> CREATOR = new Creator<TMCID>() {
|
||||
public TMCID createFromParcel(Parcel in) {
|
||||
TMCID id = new TMCID();
|
||||
id.setId(in.readInt());
|
||||
id.setDir(in.readByte());
|
||||
return id;
|
||||
}
|
||||
|
||||
public TMCID[] newArray(int size) {
|
||||
return new TMCID[size];
|
||||
}
|
||||
};
|
||||
|
||||
private int id;
|
||||
private byte dir;
|
||||
|
||||
public TMCID(int id, byte dir) {
|
||||
this.id = id;
|
||||
this.dir = dir;
|
||||
}
|
||||
|
||||
public TMCID() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel arg0, int arg1) {
|
||||
arg0.writeInt(id);
|
||||
arg0.writeByte(dir);
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public byte getDir() {
|
||||
return dir;
|
||||
}
|
||||
|
||||
public void setDir(byte dir) {
|
||||
this.dir = dir;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user