地图模块代码更新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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.zhidaoauto.map.sdk.inner
|
||||
|
||||
import com.zhidaoauto.map.sdk.inner.common.MapHelper
|
||||
|
||||
object CompileConfig {
|
||||
var DEBUG = MapHelper.debug
|
||||
|
||||
fun setDebug(debug: Boolean){
|
||||
DEBUG = debug
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.zhidaoauto.map.sdk.inner.abs
|
||||
|
||||
interface CancelableCallback {
|
||||
fun onFinish()
|
||||
fun onCancel()
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.zhidaoauto.map.sdk.inner.abs
|
||||
|
||||
import android.graphics.Bitmap
|
||||
import android.view.MotionEvent
|
||||
import com.autonavi.nge.map.OnMapScreenShotListener
|
||||
import com.zhidaoauto.map.sdk.open.abs.MapStatusListener
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnCameraChangeListener
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnHdDataDownByCityListener
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnMapChangeListener
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnMapClickListener
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnMapLoadedListener
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnMapStyleListener
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnMapTouchListener
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnMapViewVisualAngleChangeListener
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnRenderListener
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnRoadInfoListener
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnRoamStatusListener
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnScrollListener
|
||||
import com.zhidaoauto.map.sdk.open.abs.log.ILog
|
||||
import com.zhidaoauto.map.sdk.open.camera.CameraPosition
|
||||
import com.zhidaoauto.map.sdk.open.location.MogoLocation
|
||||
import com.zhidaoauto.map.sdk.open.marker.Marker
|
||||
import com.zhidaoauto.map.sdk.open.marker.OnMarkClickListener
|
||||
import com.zhidaoauto.map.sdk.open.query.LonLatPoint
|
||||
import com.zhidaoauto.map.sdk.open.road.RoadCross
|
||||
import com.zhidaoauto.map.sdk.open.road.StopLine
|
||||
|
||||
interface IEventController {
|
||||
|
||||
fun exit()
|
||||
fun addHdDataDownListener(id: Int, onHdDataDownByCityListener: OnHdDataDownByCityListener)
|
||||
fun removeHdDataDownListener(id: Int)
|
||||
fun dispatchHdDataDownListener(id: Int, progress: Double)
|
||||
fun dispatchHdDataDownStateListener(id: Int, state: Int)
|
||||
fun addCameraChangeListener(cameraChangeListener: OnCameraChangeListener)
|
||||
fun removeCameraChangeListener(cameraChangeListener: OnCameraChangeListener)
|
||||
fun dispatchCameraChangeListener(type: Int, value: Int)
|
||||
fun dispatchCameraChangeFinishListener(position: CameraPosition?)
|
||||
fun addMapTouchListener(mapTouchListener: OnMapTouchListener)
|
||||
fun removeMapTouchListener(mapTouchListener: OnMapTouchListener)
|
||||
fun dispatchMapTouchListener(event: MotionEvent?): Boolean
|
||||
fun isMapTouchListenerListEmpty(): Boolean
|
||||
fun addMapClickListener(mapClickListener: OnMapClickListener)
|
||||
fun removeMapClickListener(mapClickListener: OnMapClickListener)
|
||||
fun dispatchMapClickListener(lonLatPoint: LonLatPoint)
|
||||
fun addMapLoadedListener(mapLoadedListener: OnMapLoadedListener)
|
||||
fun removeMapLoadedListener(mapLoadedListener: OnMapLoadedListener)
|
||||
fun dispatchMapLoadedInitListener()
|
||||
fun dispatchMapLoadedListener()
|
||||
fun dispatchRoadLoadedListener(roadInfo: String?)
|
||||
fun addMapViewVisualAngleChangeListener(mapViewVisualAngleChangeListener: OnMapViewVisualAngleChangeListener)
|
||||
fun removeMapViewVisualAngleChangeListener(mapViewVisualAngleChangeListener: OnMapViewVisualAngleChangeListener)
|
||||
fun dispatchMapViewVisualAngleChangeListener(type: Int)
|
||||
fun addScrollListener(scrollListener: OnScrollListener)
|
||||
fun removeScrollListener(scrollListener: OnScrollListener)
|
||||
fun dispatchScrollListener(x: Double, y: Double)
|
||||
fun addMapStyleListener(mapStyleListener: OnMapStyleListener)
|
||||
fun removeMapStyleListener(mapStyleListener: OnMapStyleListener)
|
||||
fun dispatchMapStyleListener(type: Int)
|
||||
fun addScreenShotListener(screenShotListener: OnMapScreenShotListener)
|
||||
fun removeScreenShotListener(screenShotListener: OnMapScreenShotListener)
|
||||
fun dispatchScreenShotListener(bitmap: Bitmap?)
|
||||
fun addMapChangeListener(mapChangeListener: OnMapChangeListener)
|
||||
fun removeMapChangeListener(mapChangeListener: OnMapChangeListener)
|
||||
fun dispatchMapChangeListener(mogoLocation: MogoLocation)
|
||||
fun addMarkClickListener(markClickListener: OnMarkClickListener)
|
||||
fun removeMarkClickListener(markClickListener: OnMarkClickListener)
|
||||
fun dispatchMarkClickListener(marker: Marker)
|
||||
fun isMarkClickListenerListEmpty():Boolean
|
||||
fun addMapStatusListener(mapStatusListener: MapStatusListener, type: Int)
|
||||
fun removeMapStatusListener(mapStatusListener: MapStatusListener, type: Int)
|
||||
fun dispatchMapStatusListener(type:Int, value: Int)
|
||||
fun addRenderListener(renderListener : OnRenderListener)
|
||||
fun removeRenderListener(renderListener : OnRenderListener)
|
||||
fun dispatchRenderListener(duration:Int)
|
||||
fun addRoadInfoListener(roadInfoListener: OnRoadInfoListener)
|
||||
fun removeRoadInfoListener(roadInfoListener : OnRoadInfoListener)
|
||||
fun dispatchStopLineInfo(stopLine: StopLine?)
|
||||
fun dispatchRoadIdInfo(roadId: String?, laneId: String?)
|
||||
fun dispatchRoadCrossInfo(roadCross: RoadCross?)
|
||||
fun addLogListener(listener: ILog)
|
||||
fun removeLogListener(listener : ILog)
|
||||
fun dispatchLog(path: String)
|
||||
|
||||
fun addRoamStatusListener(onRoamStatusListener: OnRoamStatusListener)
|
||||
|
||||
fun removeRoamStatusListener(onRoamStatusListener: OnRoamStatusListener)
|
||||
|
||||
fun dispatchRoamStatusListener(status: Int, msg: String)
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.zhidaoauto.map.sdk.inner.abs
|
||||
|
||||
import com.zhidaoauto.map.sdk.open.location.MyLocationStyle
|
||||
|
||||
interface ILocationView {
|
||||
|
||||
|
||||
fun setMyLocationEnabled(myLocationEnabled: Boolean)
|
||||
fun getMyLocationEnabled(): Boolean
|
||||
fun setMyLocationStyle(myLocationStyle: MyLocationStyle)
|
||||
fun getMyLocationStyle(): MyLocationStyle?
|
||||
fun switch(style: Int)
|
||||
fun exit()
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.zhidaoauto.map.sdk.inner.abs
|
||||
|
||||
import com.zhidaoauto.map.sdk.open.query.LonLatPoint
|
||||
|
||||
interface ILockLocation {
|
||||
fun setLockCar(lock: Boolean)
|
||||
fun getLockCar(): Boolean
|
||||
fun getCurrentLonLatPoint(): LonLatPoint
|
||||
fun getLastUpdateTime(): Long
|
||||
fun getAgainLastUpdateTime(): Long
|
||||
fun switchStyle(style : Int)
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.zhidaoauto.map.sdk.inner.abs
|
||||
|
||||
import com.autonavi.nge.map.LonLat
|
||||
import com.zhidaoauto.map.sdk.open.query.LonLatPoint
|
||||
|
||||
interface ILonLatProxy {
|
||||
open fun switchLonLat(lonLat: LonLat):LonLatPoint
|
||||
open fun switchLonLat(lonLatPoint: LonLatPoint):LonLat
|
||||
}
|
||||
@@ -0,0 +1,466 @@
|
||||
package com.zhidaoauto.map.sdk.inner.abs
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Bitmap
|
||||
import android.view.View
|
||||
import com.autonavi.nge.map.LonLat
|
||||
import com.autonavi.nge.map.OnMapScreenShotListener
|
||||
import com.autonavi.nge.map.Pixels
|
||||
import com.zhidaoauto.map.sdk.inner.element.MapCoordinate
|
||||
import com.zhidaoauto.map.sdk.inner.use.Clerk
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnHdDataDownByCityListener
|
||||
import com.zhidaoauto.map.sdk.open.abs.view.IMapStyleParams
|
||||
import com.zhidaoauto.map.sdk.open.circle.CircleController
|
||||
import com.zhidaoauto.map.sdk.open.circle.CircleOptions
|
||||
import com.zhidaoauto.map.sdk.open.deadzone.DeadZone
|
||||
import com.zhidaoauto.map.sdk.open.deadzone.DeadZoneOptions
|
||||
import com.zhidaoauto.map.sdk.open.poyline.Polyline
|
||||
import com.zhidaoauto.map.sdk.open.poyline.PolylineOptions
|
||||
import com.zhidaoauto.map.sdk.open.query.LonLatPoint
|
||||
import com.zhidaoauto.map.sdk.open.weather.WeatherResult
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
|
||||
interface IMapController {
|
||||
|
||||
//init相关
|
||||
fun getContext():Context?
|
||||
fun setMarkerCall(markerCall:IMarkerCall)
|
||||
fun setLocalView(localView: ILocationView?)
|
||||
fun getMarkerCall():IMarkerCall?
|
||||
fun getMapStyleParams(): IMapStyleParams
|
||||
fun getClerk():Clerk?
|
||||
|
||||
fun setMarkerController(markerController:IMarkerController?)
|
||||
fun getMarkerController():IMarkerController?
|
||||
|
||||
//The controller of event
|
||||
fun getEventController():IEventController?
|
||||
|
||||
fun isSurfaceCreated():Boolean
|
||||
|
||||
//search相关
|
||||
fun clearSearchResult()
|
||||
|
||||
// MapView相关
|
||||
fun lookUpDown()
|
||||
fun setDAngle(r: Float)
|
||||
fun getCarPosition(pos: MapCoordinate?): Int
|
||||
fun rotate(rotateAngle: Float)
|
||||
fun updateCar(lon: Long, lat: Long, z: Int, r: Int, carResId: Int)
|
||||
fun updateCar(lon: Long, lat: Long, z: Int, r: Int, bitmap: Bitmap)
|
||||
fun updateCar(lon: Long, lat: Long, z: Short, angle: Short)
|
||||
fun getFollowCarMode(): Boolean
|
||||
fun setCenter(lon: Double, lat: Double)
|
||||
fun animateTo(lon: Double, lat: Double, alt: Float, rotateAngle: Float, mDuration: Int)
|
||||
fun dispatchFocusChanged()
|
||||
fun dispatchZoomChanged()
|
||||
fun dispatchRotationAngleChanged(rotateAngle: Float)
|
||||
fun dispatchDAngleChanged()
|
||||
fun getMapScreenShot(var1: OnMapScreenShotListener)
|
||||
|
||||
//NaviController相关
|
||||
fun isMapNorth(): Boolean
|
||||
|
||||
fun setMapViewRotation(rotation: Float)
|
||||
fun setMapStyle(stylemode: Int)
|
||||
fun getMapStyle(): Int
|
||||
fun setFollowCarMode(followCarMode: Boolean)
|
||||
fun setMapNorth(mapNorth: Boolean)
|
||||
fun clearRoute()
|
||||
fun setNaviModeZoom()
|
||||
fun setMapViewPerspective(mapPerspective: Int)
|
||||
fun setShowAllRouteLine(isShowAllRouteLine: Boolean)
|
||||
|
||||
// RouteBookAdapter
|
||||
fun drawNavArrow()
|
||||
|
||||
// POISearchThread
|
||||
fun getCenter(): MapCoordinate?
|
||||
|
||||
|
||||
fun getDAngle(): Float
|
||||
|
||||
fun getMapViewRotation(): Float
|
||||
|
||||
fun getMapViewPerspective(): Float
|
||||
|
||||
fun zoomIn()
|
||||
|
||||
fun zoomOut()
|
||||
|
||||
fun setZoom(zoom: Int)
|
||||
|
||||
fun getZoom(): Int
|
||||
|
||||
fun getRulerInfo(): Float
|
||||
|
||||
|
||||
fun removePel(names: String)
|
||||
fun drawLine(polylineOptions: PolylineOptions): Polyline?
|
||||
fun drawThickLine(polylineOptions: PolylineOptions): Polyline?
|
||||
fun drawDeadZone(deadZoneOptions: DeadZoneOptions): DeadZone?
|
||||
fun drawCircle(circleOptions: CircleOptions?): CircleController
|
||||
fun drawEllipse(polylineOptions: PolylineOptions): Polyline?
|
||||
fun drawRect(polylineOptions: PolylineOptions): Polyline?
|
||||
fun drawPolygon(polylineOptions: PolylineOptions): Polyline?
|
||||
fun clearPel(): Boolean
|
||||
|
||||
//设置同步
|
||||
fun setRenderFrequency(enableSync: Boolean, renderTimePer: Int)
|
||||
fun setMapViewVisualAngle(type: Int)
|
||||
fun resetChangeAngleTime()
|
||||
fun setNearViewAnglePosition(lonLat: LonLat)
|
||||
fun setRoamStyle(isUseTrace: Int, dis: Float, speed: Float)
|
||||
fun setRoamTrajectory(travel: String)
|
||||
fun getIsRoam(): Boolean
|
||||
|
||||
fun testMapViewAngle(type: Int)
|
||||
|
||||
fun interpolation(eyeHeight: Float, angle: Float, zoomVal: Float, mode: Int, duration: Int)
|
||||
fun setStartFrame(zoomVal: Float, lookAngle: Float, eyeHeight: Float)
|
||||
|
||||
fun setScreenToOriginDis(screenToOriginDis: Float)
|
||||
fun setEyeToOriginDis(eyeToOriginDis: Float)
|
||||
fun getCenter(point: DoubleArray)
|
||||
fun setOffset(lon: Int, lat: Int)
|
||||
fun setRotateAngle(angle: Float)
|
||||
fun set3DBuildingVisible(isVisibel: Boolean)
|
||||
fun getResulation(): Float
|
||||
fun getSuitableZoom(minLon: Double, minLat: Double, maxLon: Double, maxLat: Double): Int
|
||||
fun drawTraffic(trafficJson: String)
|
||||
fun addImage(imageKey: String, imageData: ByteArray, width: Int, height: Int): Int
|
||||
fun clearAllTmcLines()
|
||||
fun isTrafficOn(): Boolean
|
||||
fun setTraffic(stat: Int)
|
||||
fun setZoomValue(zoomValue: Float)
|
||||
fun getEyeHeight(): Float
|
||||
fun setEyeHeight(eyeHeight: Float)
|
||||
fun setVerticalViewFieldAngle(angle: Float)
|
||||
fun getVerticalViewFieldAngle(): Float
|
||||
fun getRotateAngle(): Float
|
||||
fun updatePointCloudData(
|
||||
dataStr: String,
|
||||
isTrasformer: Boolean,
|
||||
isResidual: Boolean,
|
||||
isReset: Boolean
|
||||
): Boolean
|
||||
|
||||
fun updatePointCloudDataByPb(
|
||||
dataArray: ByteArray,
|
||||
isTrasformer: Boolean,
|
||||
isResidual: Boolean,
|
||||
isReset: Boolean
|
||||
): Boolean
|
||||
|
||||
fun setIsDrawPointCloud(isDrawPointCloud: Boolean)
|
||||
fun setPointCloudDisplayFllowAnim(isDisplayFllowAnim: Boolean, totalAnimTime: Int)
|
||||
fun setPointCloudSize(pointCloudSize: Float)
|
||||
fun setPointCloudColor(color: String)
|
||||
fun shakeSceneManual()
|
||||
fun shakeMapManual()
|
||||
fun setRouteProp(prop: Int, lon: Int, lat: Int)
|
||||
fun drawRoute()
|
||||
fun removeImage(imageKey: String)
|
||||
fun lonlatToPixels(lon: Double, lat: Double): Pixels?
|
||||
fun pixelsToLonlat(x: Float, y: Float): LonLat?
|
||||
fun setTmcData(tmcData: ByteArray?)
|
||||
fun draw3DPolygon(
|
||||
id: String,
|
||||
lonlatArr: DoubleArray,
|
||||
height: Float,
|
||||
width: Float,
|
||||
count: Int,
|
||||
color: FloatArray
|
||||
)
|
||||
|
||||
fun setGeodesic(id: String, bGeodesic: Boolean)
|
||||
fun setDottedLineType(id: String, type: Int)
|
||||
fun setVisiable(id: String, bVisiable: Boolean)
|
||||
fun setWidth(id: String, width: Float)
|
||||
fun setTransparency(id: String, transparency: Float)
|
||||
fun setColor(id: String, color: Int)
|
||||
fun setZIndex(id: String, zIndex: Float)
|
||||
fun useGradient(id: String, bUseGradient: Boolean)
|
||||
fun setOption(id: String, strJsonOption: String)
|
||||
fun clearAllPrimitives(): Boolean
|
||||
fun drawDeadZone(strJsonOption: String)
|
||||
fun setDeadZoneVisible(b: Boolean)
|
||||
fun cacheHDDataByCity(id: Int, listener: OnHdDataDownByCityListener)
|
||||
fun cacheHDDataByCityLonLat(lon: Double, lat: Double, listener: OnHdDataDownByCityListener)
|
||||
fun cancelCacheHDData()
|
||||
|
||||
/**
|
||||
* 锚点 更新锚点属性
|
||||
*/
|
||||
fun updateAnchorByJson(
|
||||
anchorId: String,
|
||||
json: String,
|
||||
infobitmap: ByteArray?,
|
||||
infoWidth: Int,
|
||||
infoHeight: Int
|
||||
): Boolean
|
||||
|
||||
/**
|
||||
* 锚点 设置层级
|
||||
*/
|
||||
fun setSomeAnchorZIndex(anchorId: String, zIndex: Int)
|
||||
|
||||
fun drawAnchor(nameId: String, lon: Double, lat: Double, imagePath: String)
|
||||
|
||||
/**
|
||||
* 清除指定marker
|
||||
*
|
||||
*/
|
||||
fun removeAnchor(anchorId: String)
|
||||
|
||||
|
||||
fun getRecycleId():String
|
||||
/**
|
||||
* 点击事件
|
||||
*
|
||||
* @param x x坐标
|
||||
* @param y y坐标
|
||||
* @return 底层返回的信息
|
||||
*/
|
||||
fun findAnchorAtScreen(x: Int, y: Int): String
|
||||
|
||||
/**
|
||||
* 锚点开始动画
|
||||
*/
|
||||
fun startAnimation(anchorId: String)
|
||||
|
||||
/**
|
||||
* 锚点结束动画
|
||||
*/
|
||||
fun endAnimation(anchorId: String)
|
||||
|
||||
//动态平移
|
||||
fun addDynamicAnchorPostion(
|
||||
anchorId: String,
|
||||
points: DoubleArray,
|
||||
angle: Float,
|
||||
current: Long,
|
||||
duration: Int
|
||||
)
|
||||
|
||||
//平移
|
||||
fun addTranslateAnimationToAnchor(anchorId: String, points: DoubleArray, duration: Int)
|
||||
|
||||
//缩放
|
||||
fun addScaleAnimationToAnchor(anchorId: String, min: Float, max: Float, duration: Int)
|
||||
|
||||
fun addFlashAnimationToAnchor(anchorId: String, imageJson: String, duration: Int)
|
||||
|
||||
//旋转
|
||||
fun addRotateAnimationToAnchor(
|
||||
anchorId: String,
|
||||
startAngle: Float,
|
||||
endAngle: Float,
|
||||
duration: Int
|
||||
)
|
||||
|
||||
//锚点 设置是否可点击
|
||||
fun setSomeAnchorCanClickable(anchorId: String, canClickable: Boolean)
|
||||
|
||||
/**
|
||||
* 锚点 设置锚点不置顶
|
||||
*/
|
||||
fun setSomeAnchorUnTop(anchorId: String)
|
||||
|
||||
/**
|
||||
* 锚点 设置锚点置顶
|
||||
*/
|
||||
fun setSomeAnchorTop(anchorId: String)
|
||||
|
||||
/**
|
||||
* 锚点 infowindow的偏移量
|
||||
*/
|
||||
fun setSomeAnchorInfowindowOffset(anchorId: String, disx: Int, disy: Int)
|
||||
|
||||
// 设置是否是平贴
|
||||
fun setSomeAnchorFlat(anchorId: String, isFlat: Boolean)
|
||||
|
||||
// 设置拖拽
|
||||
fun setSomeAnchorDrawModel(anchorId: String, dragModel: Boolean)
|
||||
|
||||
// 设置拖拽位置
|
||||
fun setSomeDrawModelPointScreenPosition(screenx: Int, screeny: Int): Boolean
|
||||
|
||||
fun addManyAnchors(json: String, count: Int)
|
||||
|
||||
// 添加海量点
|
||||
fun addManyAnchorByJson(json: String, count: Int)
|
||||
|
||||
// 删除海量点
|
||||
fun removeClusterByClusterid(clusterId: String)
|
||||
|
||||
fun removeManyAnchor(allAnchorJson: String, count: Int)
|
||||
|
||||
fun clearAllCluster()
|
||||
|
||||
/**
|
||||
* 锚点 创建自车锚点
|
||||
*/
|
||||
fun createConstAnchor(
|
||||
attribute: String,
|
||||
infoBitmap: ByteArray?,
|
||||
infoWidth: Int,
|
||||
infoHeight: Int
|
||||
): Boolean
|
||||
|
||||
fun addAnchorAsync(json: String)
|
||||
|
||||
fun executeAnchorAdd()
|
||||
|
||||
//锚点更新位置标记
|
||||
fun setConstAnchorPositionFlag(isUpdate: Boolean)
|
||||
|
||||
fun addAnchor(json: String, infoBitmap: ByteArray?, infoWidth: Int, infoHeight: Int): Boolean
|
||||
|
||||
/**
|
||||
* 返回anchor的对象属性值
|
||||
*
|
||||
* @param id anchor的id
|
||||
* @param propertyName 属性名字
|
||||
* @return 属性值
|
||||
*/
|
||||
fun getAnchorProperty(id: String, propertyName: String): String
|
||||
|
||||
/**
|
||||
* 更新anchor的属性
|
||||
*
|
||||
* @param id anchor的id
|
||||
* @param propertyName 要更新的anchor的属性名
|
||||
* @param propertyValue 要更新的属性值
|
||||
* @return
|
||||
*/
|
||||
fun updateAnchorProperty(id: String, propertyName: String, propertyValue: String): Boolean
|
||||
|
||||
/**
|
||||
* 更新infowindow内容
|
||||
*
|
||||
* @param id infowindow的id
|
||||
* @param imageData 更新的图片byte数组数据
|
||||
* @param width 图片宽度
|
||||
* @param height 图片高度
|
||||
* @return true 更新成功 false 更新失败
|
||||
*/
|
||||
fun updateInfoWindowWithBitMap(
|
||||
id: String,
|
||||
imageData: ByteArray,
|
||||
width: Int,
|
||||
height: Int
|
||||
): Boolean
|
||||
|
||||
/**
|
||||
* 更新anchor
|
||||
*
|
||||
* @param id anchor的id
|
||||
* @return true 更新成功 false 更新失败
|
||||
*/
|
||||
fun updateAnchorWithBitmap(id: String, imageKey: String): Boolean
|
||||
|
||||
/**
|
||||
* 清除所有anchor
|
||||
*
|
||||
* @return true 删除成功 false 删除失败
|
||||
*/
|
||||
fun clearAllAnchors(): Boolean
|
||||
|
||||
/**
|
||||
* 显示infowindow
|
||||
*
|
||||
* @param id Anchor的id
|
||||
*/
|
||||
fun showInfoWindow(id: String)
|
||||
|
||||
/**
|
||||
* 隐藏infoWindow
|
||||
*
|
||||
* @param id Anchor的id
|
||||
*/
|
||||
fun hideInfoWindow(id: String)
|
||||
|
||||
//设置锚点缩放比例
|
||||
fun setAnchorRate(rate: Float)
|
||||
|
||||
//For Test 四个顶点设置锚点变形 左宽 右宽 上高 下高
|
||||
fun setAnchorScale(wideLeft: Float, wideRight: Float, highUp: Float, hightDown: Float)
|
||||
|
||||
//nMode 1:按Tile存储 2:按文件存储 nRecordCnt 单个文件存储的记录个数
|
||||
fun setNameMode(mode: Int, recordCnt: Int)
|
||||
|
||||
/**
|
||||
* 设置地图中心点的旋转方式
|
||||
* 3 正北向上 4 车头向上
|
||||
*
|
||||
* @param mode
|
||||
*/
|
||||
fun setSelfLocaionControl(mode: Int)
|
||||
|
||||
/**
|
||||
* 设置是否锁车
|
||||
*/
|
||||
fun setLockSelfCar(enable: Boolean)
|
||||
|
||||
//锚点是否在动态移动中
|
||||
fun isAnchorDynamicMoving(anchorID: String): Boolean
|
||||
|
||||
//批量更新
|
||||
fun updateBatchAnchorPositon(dataStr: String): Boolean
|
||||
|
||||
fun setAnchorFlash(id: String, colorType: Int, color: String, time: Float, angle: Float)
|
||||
|
||||
fun setAnchorGradientColor(
|
||||
startColor: String,
|
||||
endColor: String,
|
||||
startDistance: Float,
|
||||
endDistance: Float
|
||||
)
|
||||
|
||||
fun setTailLightsType(type: Int, time: Int)
|
||||
fun exit()
|
||||
fun isCollision(data: String): String
|
||||
fun switchData(x: Double, y: Double, isWgs84: Boolean): DoubleArray?
|
||||
|
||||
|
||||
//mapView中迁移出来的部分方法
|
||||
fun setTouchPoiEnable(enable: Boolean)
|
||||
fun getTouchPoiEnable(): Boolean
|
||||
fun isTouching(): Boolean
|
||||
fun setCanZoom(boolean: Boolean)
|
||||
fun isCanZoom(): Boolean
|
||||
fun setOnTouchListener(listener: View.OnTouchListener)
|
||||
fun setScroll(boolean: Boolean)
|
||||
fun setFling(boolean: Boolean)
|
||||
fun setRotate(boolean: Boolean)
|
||||
fun isScroll(): Boolean
|
||||
fun isFling(): Boolean
|
||||
fun isRotate(): Boolean
|
||||
fun toScreen()
|
||||
fun tilt(tilt: Float)
|
||||
fun getTilt(): Float
|
||||
fun renderP()
|
||||
//设置刷新帧率
|
||||
fun setRenderFps(fps: Int)
|
||||
//设置刷新帧率
|
||||
fun getRenderFps(): Int
|
||||
fun setVrMode(isVr: Boolean)
|
||||
fun setWaitTime(time: Long)
|
||||
fun setIsAutoLockCar(isLockCar: Boolean)
|
||||
|
||||
//协程
|
||||
fun getScope(): CoroutineScope?
|
||||
//耗时协程
|
||||
fun getDemaningScope():CoroutineScope?
|
||||
|
||||
fun setWeatherType(type: String)
|
||||
fun getWeatherInfo(lon: Double, lat: Double, call: WeatherResult)
|
||||
fun setSkyBoxMode()
|
||||
|
||||
fun getLastKnownMogoLocation(): LonLatPoint
|
||||
|
||||
fun setFogMode(isEnable: Boolean)
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package com.zhidaoauto.map.sdk.inner.abs
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import com.autonavi.nge.map.MapEngine
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
|
||||
interface IMapView {
|
||||
|
||||
//init
|
||||
fun getmContext(): Context?
|
||||
fun getMapEngine(): MapEngine
|
||||
fun setMarkerCall(markerCall: IMarkerCall)
|
||||
//The controller of event
|
||||
fun setEventController(eventController: IEventController?)
|
||||
|
||||
|
||||
fun isSurfaceCreated(): Boolean
|
||||
fun isLoaded(): Boolean
|
||||
fun isTouching(): Boolean
|
||||
fun getWidth(): Int
|
||||
fun getHeight(): Int
|
||||
|
||||
fun getTilt(): Float
|
||||
|
||||
fun loadP(dir: String): Boolean
|
||||
|
||||
fun unloadP()
|
||||
|
||||
fun resizeP(w: Int, h: Int)
|
||||
|
||||
fun renderP()
|
||||
|
||||
// fun renderLocationP(lon: Float, lat: Float, providerType: Int): Int
|
||||
|
||||
fun scrollByP(dx: Float, dy: Float)
|
||||
|
||||
fun addAntCoorP(sessionId: Int, lon: Int, lat: Int, time: Int)
|
||||
|
||||
fun rotateByP(r: Float)
|
||||
|
||||
fun setCanZoom(boolean: Boolean)
|
||||
fun setScroll(boolean: Boolean)
|
||||
fun setFling(boolean: Boolean)
|
||||
fun setRotate(boolean: Boolean)
|
||||
fun isCanZoom(): Boolean
|
||||
fun isScroll(): Boolean
|
||||
fun isFling(): Boolean
|
||||
fun isRotate(): Boolean
|
||||
fun setOnTouchListener(listener: View.OnTouchListener)
|
||||
fun setDoubles(doubleArray: DoubleArray)
|
||||
fun destory()
|
||||
|
||||
//设置刷新帧率
|
||||
fun setRenderFps(fps: Int)
|
||||
|
||||
//设置刷新帧率
|
||||
fun getRenderFps(): Int
|
||||
|
||||
fun setTouchPoiEnable(enable: Boolean)
|
||||
fun getTouchPoiEnable(): Boolean
|
||||
|
||||
//自定义样式路径
|
||||
fun setCustomStyleDir(path: String)
|
||||
|
||||
//设置同频渲染相关参数
|
||||
fun setSyncRenderFrequency(enable: Boolean, renderTimePer: Int)
|
||||
|
||||
fun toScreen()
|
||||
|
||||
fun setVrMode(isVr: Boolean)
|
||||
|
||||
fun tilt(tilt: Float)
|
||||
|
||||
fun removeTouch()
|
||||
|
||||
fun setWaitTime(time: Long)
|
||||
|
||||
fun setIsAutoLockCar(isLockCar: Boolean)
|
||||
|
||||
//协程
|
||||
fun getScope(): CoroutineScope?
|
||||
//耗时协程
|
||||
fun getDemaningScope():CoroutineScope?
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// fun setIsFarViewAngel(isFar: Boolean)
|
||||
//
|
||||
// fun setUpdateCount(updateCount: Int)
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.zhidaoauto.map.sdk.inner.abs
|
||||
|
||||
import android.graphics.Rect
|
||||
import com.zhidaoauto.map.sdk.inner.marker.IInfoViewClick
|
||||
import com.zhidaoauto.map.sdk.open.abs.marker.OnMarkerDragListener
|
||||
import com.zhidaoauto.map.sdk.open.marker.OnAnimationListener
|
||||
import com.zhidaoauto.map.sdk.open.marker.OnInfoWindowClickListener
|
||||
import com.zhidaoauto.map.sdk.open.marker.OnMarkClickListener
|
||||
|
||||
interface IMarkerCall {
|
||||
|
||||
fun exit()
|
||||
/**
|
||||
* 更新marker资源
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
fun updateMarkerResource(dataStr:String?)
|
||||
|
||||
fun getMarkDragListener(markerID: String): OnMarkerDragListener?
|
||||
|
||||
fun getAnimationListener(markerID: String): OnAnimationListener?
|
||||
|
||||
fun addAnimationListener(markerID: String, onAnimationListener: OnAnimationListener?)
|
||||
|
||||
fun getMarkClickListener(markerID: String): OnMarkClickListener?
|
||||
|
||||
fun getInfoWindowClickListener(markerID: String): OnInfoWindowClickListener?
|
||||
|
||||
fun addInfoWindowClickListener(markerID: String, onInfoWindowClickListener: OnInfoWindowClickListener?)
|
||||
|
||||
fun addMarkDragListener(markerID: String, onMarkerDragListener: OnMarkerDragListener?)
|
||||
|
||||
fun addMarkClickListener(markerID: String, onMarkClickListener: OnMarkClickListener?)
|
||||
|
||||
fun containMarkerIcon(icon:String?):Boolean
|
||||
|
||||
fun removeMarkerIcon(icon:String?):Boolean
|
||||
|
||||
fun addMarkerIcon(icon:String):Boolean
|
||||
|
||||
fun containMarkerIconCache(id:Int):Boolean
|
||||
|
||||
fun removeMarkerIconCache(id:Int)
|
||||
|
||||
fun addMarkerIconCache(id:Int,icon:String)
|
||||
|
||||
fun getMarkerIconCache(id:Int):String?
|
||||
|
||||
fun addInfoViewClick(markerId: String, rect: Rect, iInfoViewClick: IInfoViewClick)
|
||||
|
||||
fun getInfoViewClick(markerId: String): HashMap<Rect, IInfoViewClick>?
|
||||
|
||||
fun removeInfoViewClick(markerId: String)
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.zhidaoauto.map.sdk.inner.abs
|
||||
|
||||
import com.zhidaoauto.map.sdk.open.abs.marker.InfoWindowAdapter
|
||||
import com.zhidaoauto.map.sdk.open.marker.BatchMarkerOptions
|
||||
import com.zhidaoauto.map.sdk.open.marker.CarInfo
|
||||
import com.zhidaoauto.map.sdk.open.marker.Marker
|
||||
import com.zhidaoauto.map.sdk.open.marker.MarkerOptions
|
||||
import com.zhidaoauto.map.sdk.open.marker.MultiPointController
|
||||
import com.zhidaoauto.map.sdk.open.marker.MultiPointOverlayOptions
|
||||
|
||||
interface IMarkerController {
|
||||
|
||||
//设置infowindow适配器
|
||||
fun setInfoWindow(infoWindowAdapter: InfoWindowAdapter)
|
||||
//获取infowindow适配器
|
||||
fun getInfoWindow(): InfoWindowAdapter?
|
||||
//添加锚点
|
||||
fun addMarker(markerOptions: MarkerOptions): Marker?
|
||||
//添加自车锚点
|
||||
fun addSelfCar(markerOptions: MarkerOptions): Marker?
|
||||
//添加多个锚点
|
||||
fun addMarkers(multiPointOverlayOptions: MultiPointOverlayOptions): MultiPointController
|
||||
//回收
|
||||
fun destory()
|
||||
//删除锚点
|
||||
fun removeMarker(id:String)
|
||||
/**
|
||||
* 批量更新他车
|
||||
*/
|
||||
fun updateBatchMarkerPositon(batchMarkerOptions: BatchMarkerOptions)
|
||||
//根据车辆类型预添加车辆模型
|
||||
fun addPreVehicleModel(type:Int,modelRes:Int):String?
|
||||
//添加普通模型
|
||||
fun addPreModel(modelRes:Int):String?
|
||||
/**
|
||||
* 更新车辆的大小
|
||||
* @param type 车辆类型
|
||||
* @param width 车辆宽度
|
||||
* @param length 车辆长度
|
||||
*/
|
||||
fun updateCarSize(type:Int,width:Double,length:Double)
|
||||
/**
|
||||
* 检查车辆是否叠加
|
||||
* @param list 他车数据列表
|
||||
* @return 返回车辆叠加数据
|
||||
*/
|
||||
fun checkCollision(list:ArrayList<CarInfo>):Map<Long,ArrayList<CarInfo>>
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.zhidaoauto.map.sdk.inner.abs
|
||||
|
||||
import com.zhidaoauto.map.sdk.open.nav.NavPoi
|
||||
import com.zhidaoauto.map.sdk.open.nav.abs.NaviListener
|
||||
import com.zhidaoauto.map.sdk.open.nav.model.NaviPath
|
||||
import com.zhidaoauto.map.sdk.open.nav.model.NaviSetting
|
||||
|
||||
interface INaviController {
|
||||
|
||||
//设置导航策略
|
||||
fun setNaviStrategy(strategy: Int)
|
||||
|
||||
//设置导航语音是否播报
|
||||
fun setSpeakStatus(status:Boolean)
|
||||
//播报输入文案
|
||||
fun playTTS(tts: String, forcePlay: Boolean): Boolean
|
||||
//获取导航类型
|
||||
fun getNaviType(): Int
|
||||
//导航状态
|
||||
fun getNaviStat(): Boolean
|
||||
//重置状态
|
||||
fun reset()
|
||||
//设置出发地点
|
||||
fun setStart(start: NavPoi)
|
||||
// 设置终点
|
||||
fun setDest(dest: NavPoi)
|
||||
//显示详情信息 -- 只设置了终点情况下
|
||||
fun startNaviDetail()
|
||||
// 开始导航(是否模拟)
|
||||
fun startNavi(isSimulator: Boolean):Boolean
|
||||
//停止导航
|
||||
fun stopNavi()
|
||||
//刷新位置
|
||||
fun updatePosition(
|
||||
lon: Double,
|
||||
lat: Double,
|
||||
provider: String?,
|
||||
speed: Float,
|
||||
heading: Float
|
||||
)
|
||||
// 重置导航
|
||||
fun reSetRoute():Boolean
|
||||
//添加沿途点
|
||||
fun addWayPoint(
|
||||
poi: NavPoi,
|
||||
heading: Int,
|
||||
sessionid: Int
|
||||
)
|
||||
|
||||
//添加沿途点
|
||||
fun addWayPoints(
|
||||
wayPoints: ArrayList<NavPoi>
|
||||
)
|
||||
//清除沿途点
|
||||
fun clearWayPoints(sessionid: Int)
|
||||
//重置路线
|
||||
fun resetRouteSetPanel()
|
||||
//是否模拟导航
|
||||
fun setSimNavi(simNavi: Boolean)
|
||||
//是否模拟导航
|
||||
fun isSimNavi(): Boolean
|
||||
//获取起点
|
||||
fun getStartPoi(): NavPoi?
|
||||
//获取终点
|
||||
fun getEndPoi(): NavPoi?
|
||||
//获取沿途点
|
||||
fun getWayPoi(): NavPoi?
|
||||
//设置模拟导航速度
|
||||
fun setSimNaviSpeed(speed: Int)
|
||||
//是否暂停模拟导航
|
||||
fun isSimNaviPaused(): Boolean
|
||||
//设置暂停模拟导航
|
||||
fun setSimNaviPaused(isPaused: Boolean)
|
||||
//是否已设置起点
|
||||
fun isStartSet(): Boolean
|
||||
//是否已设置终点
|
||||
fun isDestSet(): Boolean
|
||||
//是否设置沿途点
|
||||
fun isTuSet(): Boolean
|
||||
|
||||
fun destory()
|
||||
|
||||
//复读
|
||||
fun readCurrentTts():Boolean
|
||||
|
||||
fun setNaviListener(naviListener: NaviListener)
|
||||
|
||||
fun removeNaviListener()
|
||||
|
||||
fun getNavPath(): NaviPath
|
||||
|
||||
fun getNaviSetting(): NaviSetting
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.zhidaoauto.map.sdk.inner.abs
|
||||
|
||||
interface IRoadData {
|
||||
|
||||
fun result(code:Int,result:String?)
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.zhidaoauto.map.sdk.inner.abs
|
||||
|
||||
interface ITraffic {
|
||||
fun onRoadLoaded(tileId: Int, leftTopLon: Double, leftTopLat: Double, leftBottomLon: Double, leftBottomLat: Double,
|
||||
rightTopLon: Double, rightTopLat: Double, rightBottomLon: Double, rightBottomLat: Double,roadInfo:String?)
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.zhidaoauto.map.sdk.inner.aspect
|
||||
|
||||
object KotlinExtern {
|
||||
fun Double.toTenDecimalsStr():String{
|
||||
return String.format("%.10f", this)
|
||||
}
|
||||
|
||||
fun Float.toTenDecimalsStr():String{
|
||||
return String.format("%.10f", this)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.zhidaoauto.map.sdk.inner.aspect;
|
||||
|
||||
|
||||
//@Aspect
|
||||
public class LonLatAspect {
|
||||
// @Pointcut("execution(* com.lqr.androidaopdemo.MainActivity.test(..))")
|
||||
// public void pointcut() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Before("pointcut()")
|
||||
// public void before(JoinPoint point) {
|
||||
// System.out.println("@Before");
|
||||
// }
|
||||
//
|
||||
// @Around("pointcut()")
|
||||
// public void around(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
// System.out.println("@Around");
|
||||
// }
|
||||
//
|
||||
// @After("pointcut()")
|
||||
// public void after(JoinPoint point) {
|
||||
// System.out.println("@After");
|
||||
// }
|
||||
//
|
||||
// @AfterReturning("pointcut()")
|
||||
// public void afterReturning(JoinPoint point, Object returnValue) {
|
||||
// System.out.println("@AfterReturning");
|
||||
// }
|
||||
//
|
||||
// @AfterThrowing(value = "pointcut()", throwing = "ex")
|
||||
// public void afterThrowing(Throwable ex) {
|
||||
// System.out.println("@afterThrowing");
|
||||
// System.out.println("ex = " + ex.getMessage());
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.zhidaoauto.map.sdk.inner.byteh;
|
||||
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.FIELD})
|
||||
public @interface CodecProprety {
|
||||
/**
|
||||
* 属性顺序
|
||||
* @return
|
||||
*/
|
||||
int order();
|
||||
|
||||
/**
|
||||
* 数据长度。解码时用,除了简单数据类型之外才起作用(如:String)。
|
||||
* @return
|
||||
*/
|
||||
int length() default 0;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.zhidaoauto.map.sdk.inner.byteh;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class Codecable {
|
||||
|
||||
public static List<FieldWrapper> resolveFileldWrapperList(Class clazz){
|
||||
Field[] fields = clazz.getDeclaredFields();
|
||||
List<FieldWrapper> fieldWrapperList = new ArrayList<>();
|
||||
for (Field field : fields) {
|
||||
CodecProprety codecProprety = field.getAnnotation(CodecProprety.class);
|
||||
if (codecProprety == null) {
|
||||
continue;
|
||||
}
|
||||
FieldWrapper fw = new FieldWrapper(field, codecProprety);
|
||||
fieldWrapperList.add(fw);
|
||||
}
|
||||
|
||||
Collections.sort(fieldWrapperList, new Comparator<FieldWrapper>() {
|
||||
@Override
|
||||
public int compare(FieldWrapper o1, FieldWrapper o2) {
|
||||
return o1.getCodecProprety().order() - o2.getCodecProprety().order();
|
||||
}
|
||||
});
|
||||
|
||||
return fieldWrapperList;
|
||||
}
|
||||
|
||||
|
||||
public abstract List<FieldWrapper> getFieldWrapperList();
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.zhidaoauto.map.sdk.inner.byteh;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class FieldWrapper {
|
||||
/**
|
||||
* 上下行数据属性
|
||||
*/
|
||||
private Field field;
|
||||
/**
|
||||
* 上下行数据属性上的注解
|
||||
*/
|
||||
private CodecProprety codecProprety;
|
||||
|
||||
public FieldWrapper(Field field, CodecProprety codecProprety) {
|
||||
this.field = field;
|
||||
this.codecProprety = codecProprety;
|
||||
}
|
||||
|
||||
public Field getField() {
|
||||
return field;
|
||||
}
|
||||
|
||||
public void setField(Field field) {
|
||||
this.field = field;
|
||||
}
|
||||
|
||||
public CodecProprety getCodecProprety() {
|
||||
return codecProprety;
|
||||
}
|
||||
|
||||
public void setCodecProprety(CodecProprety codecProprety) {
|
||||
this.codecProprety = codecProprety;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.zhidaoauto.map.sdk.inner.byteh;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.List;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
public class PayloadDecoder {
|
||||
|
||||
public static <T extends Codecable> T resolve(byte[] src, Class<T> clazz) {
|
||||
T instance = null;
|
||||
try {
|
||||
instance = clazz.newInstance();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("实例化类失败", e);
|
||||
}
|
||||
|
||||
List<FieldWrapper> fieldWrapperList = instance.getFieldWrapperList();
|
||||
ByteBuf buffer = Unpooled.buffer().writeBytes(src);
|
||||
for (FieldWrapper fieldWrapper : fieldWrapperList) {
|
||||
fillData(fieldWrapper, instance, buffer);
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
private static void fillData(FieldWrapper fieldWrapper, Object instance, ByteBuf buffer) {
|
||||
Field field = fieldWrapper.getField();
|
||||
field.setAccessible(true);
|
||||
String typeName = field.getType().getName();
|
||||
try {
|
||||
switch (typeName) {
|
||||
case "java.lang.Boolean":
|
||||
case "boolean":
|
||||
boolean b = buffer.readBoolean();
|
||||
field.set(instance, b);
|
||||
break;
|
||||
|
||||
case "java.lang.Character":
|
||||
case "char":
|
||||
CharSequence charSequence = buffer.readCharSequence(fieldWrapper.getCodecProprety().length(), Charset.forName("UTF-8"));
|
||||
field.set(instance, charSequence);
|
||||
break;
|
||||
case "java.lang.Byte":
|
||||
case "byte":
|
||||
byte b1 = buffer.readByte();
|
||||
field.set(instance, b1);
|
||||
break;
|
||||
case "java.lang.Short":
|
||||
case "short":
|
||||
short readShort = buffer.readShort();
|
||||
field.set(instance, readShort);
|
||||
break;
|
||||
case "java.lang.Integer":
|
||||
case "int":
|
||||
int readInt = buffer.readInt();
|
||||
field.set(instance, readInt);
|
||||
break;
|
||||
case "java.lang.Long":
|
||||
case "long":
|
||||
long l = buffer.readLong();
|
||||
field.set(instance, l);
|
||||
break;
|
||||
case "java.lang.Float":
|
||||
case "float":
|
||||
float readFloat = buffer.readFloat();
|
||||
field.set(instance, readFloat);
|
||||
break;
|
||||
case "java.lang.Double":
|
||||
case "double":
|
||||
double readDouble = buffer.readDouble();
|
||||
field.set(instance, readDouble);
|
||||
break;
|
||||
case "java.lang.String":
|
||||
String readString = buffer.readCharSequence(fieldWrapper.getCodecProprety().length(), Charset.forName("UTF-8")).toString();
|
||||
field.set(instance, readString);
|
||||
break;
|
||||
default:
|
||||
throw new RuntimeException(typeName + "不支持,bug");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(typeName + "读取失败,field:" + field.getName(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.zhidaoauto.map.sdk.inner.byteh;
|
||||
|
||||
import com.autonavi.nge.map.LonLat;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.List;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
public class PayloadEncoder {
|
||||
public static <T extends Codecable> byte[] getPayload(T command) {
|
||||
List<FieldWrapper> fieldWrapperList = command.getFieldWrapperList();
|
||||
ByteBuf buffer = Unpooled.buffer();
|
||||
for(FieldWrapper fieldWrapper :fieldWrapperList){
|
||||
write2ByteBuf(fieldWrapper, command, buffer);
|
||||
}
|
||||
return buffer.array();
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据写入到ByteBuf
|
||||
*
|
||||
* @param fieldWrapper
|
||||
* @param instance
|
||||
* @param buffer
|
||||
*/
|
||||
private static void write2ByteBuf(FieldWrapper fieldWrapper, Object instance, ByteBuf buffer) {
|
||||
Field field = fieldWrapper.getField();
|
||||
String typeName = field.getType().getName();
|
||||
field.setAccessible(true);
|
||||
Object value = null;
|
||||
try {
|
||||
value = field.get(instance);
|
||||
} catch (IllegalAccessException e) {
|
||||
new RuntimeException("反射获取值失败,filed:" + field.getName(), e);
|
||||
}
|
||||
switch (typeName) {
|
||||
case "com.autonavi.nge.map.LonLat":
|
||||
LonLat lonLat = (LonLat) value;
|
||||
buffer.writeDouble(lonLat.getLon());
|
||||
buffer.writeDouble(lonLat.getLat());
|
||||
break;
|
||||
case "java.lang.Boolean":
|
||||
case "kotlin.Boolean":
|
||||
case "boolean":
|
||||
buffer.writeBoolean((Boolean) value);
|
||||
break;
|
||||
case "java.lang.Character":
|
||||
case "kotlin.Character":
|
||||
case "char":
|
||||
buffer.writeCharSequence((CharSequence) value, Charset.forName("UTF-8"));
|
||||
break;
|
||||
case "java.lang.Byte":
|
||||
case "kotlin.Byte":
|
||||
case "byte":
|
||||
buffer.writeByte((byte) value);
|
||||
break;
|
||||
case "java.lang.Short":
|
||||
case "kotlin.Short":
|
||||
case "short":
|
||||
buffer.writeShort((short) value);
|
||||
break;
|
||||
case "java.lang.Integer":
|
||||
case "kotlin.Int":
|
||||
case "int":
|
||||
buffer.writeInt((int) value);
|
||||
break;
|
||||
case "java.lang.Long":
|
||||
case "kotlin.Long":
|
||||
case "long":
|
||||
buffer.writeLong((long) value);
|
||||
break;
|
||||
case "java.lang.Float":
|
||||
case "kotlin.Float":
|
||||
case "float":
|
||||
buffer.writeFloat((float) value);
|
||||
break;
|
||||
case "java.lang.Double":
|
||||
case "kotlin.Double":
|
||||
case "double":
|
||||
buffer.writeDouble((double) value);
|
||||
break;
|
||||
case "java.lang.String":
|
||||
case "kotlin.String":
|
||||
buffer.writeCharSequence((CharSequence) value, Charset.forName("UTF-8"));
|
||||
break;
|
||||
default:
|
||||
throw new RuntimeException(typeName + "不支持,bug");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.zhidaoauto.map.sdk.inner.common
|
||||
|
||||
import com.autonavi.nge.Common
|
||||
|
||||
class CommonHelper {
|
||||
private var common: Common
|
||||
|
||||
private constructor() {
|
||||
common = Common()
|
||||
|
||||
}
|
||||
|
||||
|
||||
companion object{
|
||||
var sInstance: CommonHelper? = null
|
||||
|
||||
@Synchronized
|
||||
fun getInstance(): CommonHelper? {
|
||||
if (sInstance == null) {
|
||||
sInstance = CommonHelper()
|
||||
}
|
||||
return sInstance
|
||||
}
|
||||
}
|
||||
|
||||
fun setCfgKeyVal(key: String, value: String){
|
||||
common.setCfgKeyVal(key, value)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,298 @@
|
||||
package com.zhidaoauto.map.sdk.inner.common
|
||||
|
||||
import android.os.Environment
|
||||
import java.io.File
|
||||
|
||||
object ConstantExt {
|
||||
|
||||
|
||||
//近视角模式
|
||||
const val MAP_STYLE_VR_ANGLE_NEAR = 0
|
||||
//默认视角模式
|
||||
const val MAP_STYLE_VR_ANGLE_MIDDLE = 1
|
||||
//远视角模式
|
||||
const val MAP_STYLE_VR_ANGLE_FAR = 2
|
||||
//300米视角模式
|
||||
const val MAP_STYLE_VR_ANGLE_300 = 3
|
||||
//顶视角模式
|
||||
const val MAP_STYLE_VR_ANGLE_TOP = 4
|
||||
//十字路口视角
|
||||
const val MAP_STYLE_VR_ANGLE_CROSS = 5
|
||||
//小巴默认视角
|
||||
const val MAP_STYLE_VR_ANGLE_MIDDLE_XIAOBA = 6
|
||||
//漫游模式
|
||||
const val MAP_STYLE_VR_ROAM = 7
|
||||
//过渡模式
|
||||
const val MAP_STYLE_VR_TRANS = 8
|
||||
//洱海B2车辆模式
|
||||
const val MAP_STYLE_VR_ERHAI_B2 = 9
|
||||
//天空盒模式
|
||||
const val MAP_STYLE_VR_SKY_BOX = 10
|
||||
|
||||
//漫游距离1公里
|
||||
const val ROAM_DIS_1KM = 1000f
|
||||
//漫游距离3公里
|
||||
const val ROAM_DIS_3KM = 3000f
|
||||
//漫游距离5公里
|
||||
const val ROAM_DIS_5KM = 5000f
|
||||
//漫游距离8公里
|
||||
const val ROAM_DIS_8KM = 8000f
|
||||
|
||||
//漫游速度30m/s
|
||||
const val ROAM_SPEED_30 = 30f
|
||||
//漫游速度40m/s
|
||||
const val ROAM_SPEED_40 = 40f
|
||||
//漫游速度60m/s
|
||||
const val ROAM_SPEED_60 = 60f
|
||||
//漫游速度80m/s
|
||||
const val ROAM_SPEED_80 = 80f
|
||||
|
||||
|
||||
//VR模式下的缩放
|
||||
const val MAP_STYLE_VR_ZOOM: Int = 20
|
||||
|
||||
//VR模式下的远视角 角度
|
||||
const val MAP_STYLE_VR_OVER_LOOK_ANGLE_FAR = 11.5f
|
||||
//VR模式下的远视角 缩放值
|
||||
const val MAP_STYLE_VR_ZOOM_VAL_FAR = 1f
|
||||
//VR模式下的远视角 高度
|
||||
const val MAP_STYLE_VR_EYE_HEIGHT_FAR = 40f
|
||||
|
||||
|
||||
//VR模式下的近视角 角度
|
||||
const val MAP_STYLE_VR_OVER_LOOK_ANGLE_NEAR =13.5f
|
||||
//VR模式下的近视角 缩放值
|
||||
const val MAP_STYLE_VR_ZOOM_VAL_NEAR = 0.35f
|
||||
//VR模式下的近视角 高度
|
||||
const val MAP_STYLE_VR_EYE_HEIGHT_NEAR = 22f
|
||||
|
||||
//VR模式下的中视角默认视角 小车位置
|
||||
const val MAP_STYLE_VR_POSITION_MIDDLE = 2.6f
|
||||
//VR模式下的中视角默认视角 角度
|
||||
const val MAP_STYLE_VR_OVER_LOOK_ANGLE_MIDDLE = 12.5f
|
||||
//VR模式下的中视角 缩放值
|
||||
const val MAP_STYLE_VR_ZOOM_VAL_MIDDLE = 0.8f
|
||||
//VR模式下的中视角 高度
|
||||
const val MAP_STYLE_VR_EYE_HEIGHT_MIDDLE = 15f
|
||||
|
||||
//VR模式下的小巴车默认视角 角度
|
||||
const val MAP_STYLE_VR_OVER_LOOK_ANGLE_MIDDLE_XIAOBA = 15.3f
|
||||
//VR模式下的小巴车默认视角 缩放值
|
||||
const val MAP_STYLE_VR_ZOOM_VAL_MIDDLE_XIAOBA = 0.8f
|
||||
//VR模式下的小巴车默认视角 高度
|
||||
const val MAP_STYLE_VR_EYE_HEIGHT_MIDDLE_XIAOBA = 19f
|
||||
|
||||
|
||||
//VR模式下的洱海默认视角 角度
|
||||
const val MAP_STYLE_VR_OVER_LOOK_ANGLE_ERHAI = 13f
|
||||
//VR模式下的洱海默认视角 缩放值
|
||||
const val MAP_STYLE_VR_ZOOM_VAL_ERHAI = 1f
|
||||
//VR模式下的洱海默认视角 高度
|
||||
const val MAP_STYLE_VR_EYE_HEIGHT_ERHAI = 15f
|
||||
|
||||
|
||||
//后方来车300米视角 高度
|
||||
const val MAP_STYLE_VR_EYE_HEIGHT_300 = 27f
|
||||
//后方来车300米视角 角度
|
||||
const val MAP_STYLE_VR_OVER_LOOK_ANGLE_300 = 16.5f
|
||||
//后方来车300米视角 缩放值
|
||||
const val MAP_STYLE_VR_ZOOM_VAL_300 = 1.24f
|
||||
|
||||
|
||||
//顶视角 高度
|
||||
const val MAP_STYLE_VR_EYE_HEIGHT_TOP = 70f
|
||||
//顶视角 角度
|
||||
const val MAP_STYLE_VR_OVER_LOOK_ANGLE_TOP = 45f
|
||||
//顶视角 缩放值
|
||||
const val MAP_STYLE_VR_ZOOM_VAL_TOP = 1f
|
||||
|
||||
|
||||
//十字路口视角 高度
|
||||
const val MAP_STYLE_VR_EYE_HEIGHT_CROSS = 14f
|
||||
//十字路口视角 角度
|
||||
const val MAP_STYLE_VR_OVER_LOOK_ANGLE_CROSS = 20.7f
|
||||
//十字路口视角 缩放值
|
||||
const val MAP_STYLE_VR_ZOOM_VAL_CROSS = 1f
|
||||
|
||||
|
||||
//漫游模式 角度
|
||||
const val MAP_STYLE_VR_OVER_LOOK_ANGLE_ROAM = 12.5f
|
||||
//漫游模式 缩放值
|
||||
const val MAP_STYLE_VR_ZOOM_VAL_ROAM = 0.8f
|
||||
//漫游模式 高度
|
||||
const val MAP_STYLE_VR_EYE_HEIGHT_ROAM = 23f
|
||||
|
||||
//过渡模式 角度
|
||||
const val MAP_STYLE_VR_OVER_LOOK_ANGLE_TRANS = 12.5f
|
||||
//过渡模式 缩放值
|
||||
const val MAP_STYLE_VR_ZOOM_VAL_TRANS = 0.8f
|
||||
//过渡模式 高度
|
||||
const val MAP_STYLE_VR_EYE_HEIGHT_TRANS = 30f
|
||||
|
||||
//天空盒模式
|
||||
const val MAP_STYLE_VR_OVER_LOOK_ANGLE_SKYBOX = 28f//视角
|
||||
const val MAP_STYLE_VR_ZOOM_VAL_SKYBOX = 0.8f//缩放
|
||||
const val MAP_STYLE_VR_EYE_HEIGHT_SKYBOX = 12f//高度
|
||||
|
||||
//默认尾灯不亮
|
||||
const val SELF_CAR_DEFAULT = 0
|
||||
//尾灯左黄
|
||||
const val SELF_CAR_TURN_LEFT_YELLOW = 1
|
||||
//尾灯右黄
|
||||
const val SELF_CAR_TURN_RIGHT_YELLOW = 2
|
||||
//尾灯双黄
|
||||
const val SELF_CAR_STOP_LIGHT_YELLOW = 3
|
||||
//尾灯双红
|
||||
const val SELF_CAR_STOP_LIGHT_RED = 4
|
||||
|
||||
|
||||
//VR模式下的近视角视域
|
||||
const val MAP_STYLE_VR_VIEW_FIELD_ANGLE_NEAR = 18f
|
||||
//VR模式下的远视角视域
|
||||
const val MAP_STYLE_VR_VIEW_FIELD_ANGLE_FAR = 20f
|
||||
//VR模式下的中视角视域
|
||||
const val MAP_STYLE_VR_VIEW_FIELD_ANGLE_MIDDLE = 20f
|
||||
|
||||
|
||||
//设置天气
|
||||
const val WEATHER = "wheatherType"
|
||||
//没有天气效果
|
||||
const val WEATHER_DEFULT = "0"
|
||||
//雨天
|
||||
const val WEATHER_RAIN = "1"
|
||||
//雪天
|
||||
const val WEATHER_SNOW = "2"
|
||||
|
||||
//设置天空盒
|
||||
const val FOG = "fog"
|
||||
const val SKYBOX = "skybox"
|
||||
|
||||
//地图视角测试
|
||||
//地图测试视角角度
|
||||
const val MAP_TEST_ANGLE = 18.5f
|
||||
//地图测试100米视角 高度
|
||||
const val MAP_100_EYE_HEIGHT = 16f
|
||||
//地图测试80米视角 高度
|
||||
const val MAP_80_EYE_HEIGHT = 12.5f
|
||||
|
||||
const val CAR_CENTER_100 = 1
|
||||
|
||||
const val CAR_QUARTER_100 = 2
|
||||
|
||||
const val CAR_TWO_FIFTHS_100 = 3
|
||||
|
||||
const val CAR_TWO_FIFTHS_80= 4
|
||||
|
||||
const val CAR_AFTER_30_FRONT_80 = 5
|
||||
|
||||
const val CAR_AFTER_30_FRONT_100 = 6
|
||||
|
||||
const val CAR_AFTER_30_FRONT_120 = 7
|
||||
|
||||
const val CAR_AFTER_40_FRONT_80= 8
|
||||
|
||||
const val CAR_AFTER_40_FRONT_100 = 9
|
||||
|
||||
const val CAR_AFTER_40_FRONT_120 = 10
|
||||
|
||||
const val CAR_AFTER_30_FRONT_80_ANGLE = 16.1f
|
||||
const val CAR_AFTER_30_FRONT_80_EYEHEIGHT = 11.2f
|
||||
const val CAR_AFTER_30_FRONT_80_POSITION = -1.8f
|
||||
|
||||
const val CAR_AFTER_30_FRONT_100_ANGLE = 15.2f
|
||||
const val CAR_AFTER_30_FRONT_100_EYEHEIGHT = 11f
|
||||
const val CAR_AFTER_30_FRONT_100_POSITION = -1.4f
|
||||
|
||||
|
||||
const val CAR_AFTER_30_FRONT_120_ANGLE = 14.3f
|
||||
const val CAR_AFTER_30_FRONT_120_EYEHEIGHT = 10.2f
|
||||
const val CAR_AFTER_30_FRONT_120_POSITION = -1.4f
|
||||
|
||||
const val CAR_AFTER_40_FRONT_80_ANGLE = 13.8f
|
||||
const val CAR_AFTER_40_FRONT_80_EYEHEIGHT = 7f
|
||||
const val CAR_AFTER_40_FRONT_80_POSITION = -4.2f
|
||||
|
||||
const val CAR_AFTER_40_FRONT_100_ANGLE = 13.2f
|
||||
const val CAR_AFTER_40_FRONT_100_EYEHEIGHT = 6.7f
|
||||
const val CAR_AFTER_40_FRONT_100_POSITION = -4f
|
||||
|
||||
const val CAR_AFTER_40_FRONT_120_ANGLE = 12.8f
|
||||
const val CAR_AFTER_40_FRONT_120_EYEHEIGHT = 6.6f
|
||||
const val CAR_AFTER_40_FRONT_120_POSITION = -3.8f
|
||||
|
||||
|
||||
// 2D模式下的俯视角
|
||||
const val MAP_STYLE_2D_OVER_LOOK_ANGLE: Float = 90f
|
||||
//2D模式下的缩放
|
||||
const val MAP_STYLE_2D_ZOOM: Int = 16
|
||||
//2D模式下的高度
|
||||
const val MAP_STYLE_2D_EYE_HEIGHT: Float = 149f
|
||||
|
||||
// nav模式下的俯视角
|
||||
const val MAP_STYLE_NAV_OVER_LOOK_ANGLE: Float = 30f
|
||||
// nav模式下的缩放
|
||||
const val MAP_STYLE_NAV_ZOOM: Int = 18
|
||||
|
||||
//动画时长
|
||||
const val MAP_ANIM_DEFAULT_DURATION: Int = 350
|
||||
|
||||
|
||||
const val RULE_ZERO_SIX_INT: Float = 1000000.0f
|
||||
|
||||
// 经纬度转int标注
|
||||
const val RULE_FLOAT_TO_INT: Float = 3.6f
|
||||
|
||||
// 经纬度转int标注
|
||||
const val RULE_INT: Float = 3.6f * RULE_ZERO_SIX_INT
|
||||
|
||||
const val SHARED_KEY_LOCATION: String = "SHARED_KEY_LOCATION"
|
||||
|
||||
const val SHARED_KEY_LONLAT: String = "SHARED_KEY_LONLAT"
|
||||
|
||||
//样式版本
|
||||
const val SHARED_KEY_STYLE_VERSION: String = "SHARED_KEY_STYLE_VERSION"
|
||||
//数据版本
|
||||
const val SHARED_KEY_DATA_VERSION: String = "SHARED_KEY_DATA_VERSION"
|
||||
//高精数据版本
|
||||
const val SHARED_KEY_HDDATA_VERSION: String = "SHARED_KEY_HDDATA_VERSION"
|
||||
|
||||
/**
|
||||
* authority
|
||||
*/
|
||||
val AUTHORITY = ".data"
|
||||
|
||||
//查询
|
||||
val STR_QUERY = "str_query"
|
||||
|
||||
val KEY = "key"
|
||||
val VALUE = "value"
|
||||
|
||||
//查询
|
||||
val CODE_QUERY = 1001
|
||||
|
||||
fun getNDSDataPath(): String {
|
||||
var mNDSDataPath: String = ""
|
||||
val NDSFileName = "/shmdata/"
|
||||
val paths = arrayOf(
|
||||
"/storage/extSdCard$NDSFileName",
|
||||
"/storage/sdcard0$NDSFileName",
|
||||
"/storage/sdcard1$NDSFileName",
|
||||
"/sdcard/sd$NDSFileName",
|
||||
"/sdcard/external_sd$NDSFileName",
|
||||
"/sdcard-ext$NDSFileName",
|
||||
"/sdcard$NDSFileName",
|
||||
"/sdcard/ext_sd$NDSFileName",
|
||||
"/mnt/extsd$NDSFileName"
|
||||
)
|
||||
for (i in paths.indices) {
|
||||
if (File(paths[i]).exists()) {
|
||||
mNDSDataPath = paths[i]
|
||||
break
|
||||
} else {
|
||||
mNDSDataPath =
|
||||
Environment.getExternalStorageDirectory().absolutePath + NDSFileName
|
||||
}
|
||||
}
|
||||
return mNDSDataPath
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.zhidaoauto.map.sdk.inner.common
|
||||
|
||||
import android.util.Log
|
||||
import com.zhidaoauto.map.sdk.inner.CompileConfig
|
||||
import com.zhidaoauto.map.sdk.inner.proxy.CommonProxy
|
||||
import com.zhidaoauto.map.sdk.inner.proxy.LonLatProxy
|
||||
import com.zhidaoauto.map.sdk.inner.utils.Recorder
|
||||
import com.zhidaoauto.map.sdk.open.MapParams
|
||||
|
||||
object MapHelper {
|
||||
private val TAG = javaClass.simpleName
|
||||
var debug = true
|
||||
var mMapParams:MapParams = MapParams.init()
|
||||
|
||||
fun init(mapParams: MapParams){
|
||||
if(debug){
|
||||
Log.i(TAG,"initop MapParams")
|
||||
}
|
||||
mMapParams = mapParams
|
||||
debug = mapParams.getDebugMode()
|
||||
setDebugMode(debug)
|
||||
//TODO MATT
|
||||
// Clerk.isWork = mapParams.getRecordLogs()
|
||||
Recorder.isWork = mapParams.getRecordLogs()
|
||||
if(debug){
|
||||
Log.i(TAG,"initop setLonLatProxy")
|
||||
}
|
||||
CommonProxy.getInstance().setLonLatProxy(LonLatProxy())
|
||||
}
|
||||
|
||||
fun setDebugMode(debug: Boolean) {
|
||||
CompileConfig.setDebug(debug)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.zhidaoauto.map.sdk.inner.common
|
||||
|
||||
import com.zhidaoauto.map.sdk.open.NavParams
|
||||
|
||||
object NavHelper {
|
||||
|
||||
var mNavParams:NavParams = NavParams.init()
|
||||
|
||||
fun init(navParams: NavParams){
|
||||
mNavParams = navParams
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.zhidaoauto.map.sdk.inner.controller
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Process
|
||||
import android.util.Log
|
||||
import com.zhidaoauto.map.sdk.inner.CompileConfig
|
||||
import com.zhidaoauto.map.sdk.inner.utils.Constant.getWorkingDirectory
|
||||
import com.zhidaoauto.map.sdk.inner.utils.Constant.killProcesses
|
||||
import com.zhidaoauto.map.sdk.inner.utils.Recorder
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.MainScope
|
||||
import kotlinx.coroutines.cancel
|
||||
|
||||
/**
|
||||
* @author Matt
|
||||
*/
|
||||
class CommonController private constructor() {
|
||||
|
||||
|
||||
private val TAG = javaClass.simpleName
|
||||
|
||||
private var mContext:Context? = null
|
||||
var scope: CoroutineScope? = null
|
||||
|
||||
|
||||
//获取工作空间
|
||||
var workingDirectory: String? = null
|
||||
private set
|
||||
|
||||
|
||||
|
||||
//初始化
|
||||
fun init(context: Context?) {
|
||||
if(this.mContext == null){
|
||||
this.mContext = context
|
||||
}
|
||||
if (this.scope == null) {
|
||||
this.scope = MainScope()
|
||||
}
|
||||
|
||||
initInner()
|
||||
// MarkerCacheController.instance.init()
|
||||
}
|
||||
|
||||
fun initInner() {
|
||||
if (workingDirectory == null) {
|
||||
workingDirectory = getWorkingDirectory(mContext!!)
|
||||
}
|
||||
Recorder.mWorkingDirectory = workingDirectory
|
||||
}
|
||||
|
||||
//退出
|
||||
fun exit() {
|
||||
// 回收scope
|
||||
scope?.cancel()
|
||||
scope = null
|
||||
|
||||
mContext = null
|
||||
}
|
||||
|
||||
//杀死进程
|
||||
private fun finilize() {
|
||||
Process.killProcess(0)
|
||||
mContext?.let {
|
||||
if (CompileConfig.DEBUG) {
|
||||
Log.i(TAG, "mapop-finilize-killProcesses")
|
||||
}
|
||||
killProcesses(it, it.packageName)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
//单例
|
||||
@JvmStatic val instance: CommonController by lazy((LazyThreadSafetyMode.SYNCHRONIZED)) {
|
||||
CommonController()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,577 @@
|
||||
package com.zhidaoauto.map.sdk.inner.controller
|
||||
|
||||
import android.graphics.Bitmap
|
||||
import android.view.MotionEvent
|
||||
import com.autonavi.nge.map.OnMapScreenShotListener
|
||||
import com.zhidaoauto.map.sdk.inner.abs.IEventController
|
||||
import com.zhidaoauto.map.sdk.open.MapAutoApi
|
||||
import com.zhidaoauto.map.sdk.open.abs.MapStatusListener
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnCameraChangeListener
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnHdDataDownByCityListener
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnMapChangeListener
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnMapClickListener
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnMapLoadedListener
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnMapStyleListener
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnMapTouchListener
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnMapViewVisualAngleChangeListener
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnRenderListener
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnRoadInfoListener
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnRoamStatusListener
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnScrollListener
|
||||
import com.zhidaoauto.map.sdk.open.abs.log.ILog
|
||||
import com.zhidaoauto.map.sdk.open.camera.CameraPosition
|
||||
import com.zhidaoauto.map.sdk.open.location.MogoLocation
|
||||
import com.zhidaoauto.map.sdk.open.marker.Marker
|
||||
import com.zhidaoauto.map.sdk.open.marker.OnMarkClickListener
|
||||
import com.zhidaoauto.map.sdk.open.query.LonLatPoint
|
||||
import com.zhidaoauto.map.sdk.open.road.RoadCross
|
||||
import com.zhidaoauto.map.sdk.open.road.StopLine
|
||||
|
||||
class MapEventController(): IEventController {
|
||||
|
||||
private var mCameraChangeListenerList: ArrayList<OnCameraChangeListener>? = null
|
||||
private var mMapTouchListenerList: ArrayList<OnMapTouchListener>? = null
|
||||
private var mMapClickListenerList: ArrayList<OnMapClickListener>? = null
|
||||
private var mMapLoadedListenerList: ArrayList<OnMapLoadedListener>? = null
|
||||
private var mMarkClickListenerList: ArrayList<OnMarkClickListener>? = null
|
||||
private var mScrollListenerList: ArrayList<OnScrollListener>? = null
|
||||
private var mMapStyleListenerList: ArrayList<OnMapStyleListener>? = null
|
||||
private var mScreenListenerList: ArrayList<OnMapScreenShotListener>? = null
|
||||
private var mMapChangeListenerList: ArrayList<OnMapChangeListener>? = null
|
||||
private var mMapViewVisualAngleChangeListenerList: ArrayList<OnMapViewVisualAngleChangeListener>? =null
|
||||
private var mFocusListenerList: ArrayList<MapStatusListener>? = null
|
||||
private var mRotateListenerList: ArrayList<MapStatusListener>? = null
|
||||
private var mZoomListenerList: ArrayList<MapStatusListener>? = null
|
||||
private var mDAngleListenerList: ArrayList<MapStatusListener>? = null
|
||||
private var renderListenerList : ArrayList<OnRenderListener>? = null
|
||||
private var mRoadInfoListenerList : ArrayList<OnRoadInfoListener>? = null
|
||||
private var mLogListenerList : ArrayList<ILog>? = null
|
||||
private var mHdDataDownloadListener: HashMap<Int, OnHdDataDownByCityListener>? = null
|
||||
private var mRoamStatusListenerList: ArrayList<OnRoamStatusListener>? = null
|
||||
|
||||
|
||||
override fun exit(){
|
||||
mCameraChangeListenerList?.clear()
|
||||
mCameraChangeListenerList = null
|
||||
mMapTouchListenerList?.clear()
|
||||
mMapTouchListenerList = null
|
||||
mMapClickListenerList?.clear()
|
||||
mMapClickListenerList = null
|
||||
mMapLoadedListenerList?.clear()
|
||||
mMapLoadedListenerList = null
|
||||
mMarkClickListenerList?.clear()
|
||||
mMarkClickListenerList = null
|
||||
mScrollListenerList?.clear()
|
||||
mScrollListenerList = null
|
||||
mMapStyleListenerList?.clear()
|
||||
mMapStyleListenerList = null
|
||||
mScreenListenerList?.clear()
|
||||
mScreenListenerList = null
|
||||
mMapChangeListenerList?.clear()
|
||||
mMapChangeListenerList = null
|
||||
mMapViewVisualAngleChangeListenerList?.clear()
|
||||
mMapViewVisualAngleChangeListenerList = null
|
||||
mFocusListenerList?.clear()
|
||||
mFocusListenerList = null
|
||||
mRotateListenerList?.clear()
|
||||
mRotateListenerList = null
|
||||
mZoomListenerList?.clear()
|
||||
mZoomListenerList = null
|
||||
mDAngleListenerList?.clear()
|
||||
mDAngleListenerList = null
|
||||
mRoadInfoListenerList?.clear()
|
||||
mRoadInfoListenerList = null
|
||||
renderListenerList?.clear()
|
||||
renderListenerList = null
|
||||
mLogListenerList?.clear()
|
||||
mLogListenerList = null
|
||||
mHdDataDownloadListener?.clear()
|
||||
mHdDataDownloadListener = null
|
||||
mRoamStatusListenerList?.clear()
|
||||
mRoamStatusListenerList = null
|
||||
}
|
||||
|
||||
override fun addHdDataDownListener(id: Int, onHdDataDownByCityListener: OnHdDataDownByCityListener){
|
||||
if(mHdDataDownloadListener == null){
|
||||
mHdDataDownloadListener = HashMap()
|
||||
}
|
||||
if(!mHdDataDownloadListener!!.keys.contains(id)) {
|
||||
mHdDataDownloadListener?.put(id, onHdDataDownByCityListener)
|
||||
}
|
||||
}
|
||||
|
||||
override fun removeHdDataDownListener(id: Int){
|
||||
mHdDataDownloadListener?.let {
|
||||
if(it.keys.contains(id)) {
|
||||
it.remove(id)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun dispatchHdDataDownListener(id: Int, progress: Double){
|
||||
mHdDataDownloadListener?.let {
|
||||
for(listener in it.values){
|
||||
listener.onMapHDDataCacheProgressByCity(id,progress)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun dispatchHdDataDownStateListener(id: Int, state: Int){
|
||||
mHdDataDownloadListener?.let {
|
||||
for(listener in it.values){
|
||||
listener.onMapHDDataCacheStateByCity(id,state)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun addCameraChangeListener(cameraChangeListener: OnCameraChangeListener){
|
||||
if(mCameraChangeListenerList == null){
|
||||
mCameraChangeListenerList = ArrayList()
|
||||
}
|
||||
if(!mCameraChangeListenerList!!.contains(cameraChangeListener)) {
|
||||
mCameraChangeListenerList?.add(cameraChangeListener)
|
||||
}
|
||||
}
|
||||
|
||||
override fun removeCameraChangeListener(cameraChangeListener: OnCameraChangeListener){
|
||||
mCameraChangeListenerList?.remove(cameraChangeListener)
|
||||
}
|
||||
|
||||
override fun dispatchCameraChangeListener(type: Int, value: Int){
|
||||
mCameraChangeListenerList?.let {
|
||||
for(listener in it){
|
||||
listener.onCameraChange(type, value)
|
||||
}
|
||||
}
|
||||
}
|
||||
override fun dispatchCameraChangeFinishListener(position: CameraPosition?){
|
||||
mCameraChangeListenerList?.let {
|
||||
for(listener in it){
|
||||
listener.onCameraChangeFinish(position)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun addMapTouchListener(mapTouchListener: OnMapTouchListener){
|
||||
if(mMapTouchListenerList == null){
|
||||
mMapTouchListenerList = ArrayList()
|
||||
}
|
||||
if(!mMapTouchListenerList!!.contains(mapTouchListener)) {
|
||||
mMapTouchListenerList?.add(mapTouchListener)
|
||||
}
|
||||
}
|
||||
|
||||
override fun removeMapTouchListener(mapTouchListener: OnMapTouchListener){
|
||||
mMapTouchListenerList?.remove(mapTouchListener)
|
||||
}
|
||||
|
||||
|
||||
override fun dispatchMapTouchListener(event: MotionEvent?): Boolean{
|
||||
mMapTouchListenerList?.let {
|
||||
for(listener in it){
|
||||
return listener.onTouch(event)
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
override fun isMapTouchListenerListEmpty(): Boolean{
|
||||
return mMapTouchListenerList?.isEmpty()?:true
|
||||
}
|
||||
|
||||
|
||||
|
||||
override fun addMapClickListener(mapClickListener: OnMapClickListener){
|
||||
if(mMapClickListenerList == null){
|
||||
mMapClickListenerList = ArrayList()
|
||||
}
|
||||
if(!mMapClickListenerList!!.contains(mapClickListener)) {
|
||||
mMapClickListenerList?.add(mapClickListener)
|
||||
}
|
||||
}
|
||||
|
||||
override fun removeMapClickListener(mapClickListener: OnMapClickListener){
|
||||
mMapClickListenerList?.remove(mapClickListener)
|
||||
}
|
||||
|
||||
override fun dispatchMapClickListener(lonLatPoint: LonLatPoint){
|
||||
mMapClickListenerList?.let {
|
||||
for(listener in it){
|
||||
listener.onMapClick(lonLatPoint)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun addMapLoadedListener(mapLoadedListener: OnMapLoadedListener){
|
||||
if(mMapLoadedListenerList == null){
|
||||
mMapLoadedListenerList = ArrayList()
|
||||
}
|
||||
if(!mMapLoadedListenerList!!.contains(mapLoadedListener)) {
|
||||
mMapLoadedListenerList?.add(mapLoadedListener)
|
||||
}
|
||||
}
|
||||
|
||||
override fun removeMapLoadedListener(mapLoadedListener: OnMapLoadedListener){
|
||||
mMapLoadedListenerList?.remove(mapLoadedListener)
|
||||
}
|
||||
|
||||
override fun dispatchMapLoadedInitListener(){
|
||||
mMapLoadedListenerList?.let {
|
||||
for(listener in it){
|
||||
listener.onMapInit()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun dispatchMapLoadedListener(){
|
||||
mMapLoadedListenerList?.let {
|
||||
for(listener in it){
|
||||
listener.onMapLoaded()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun dispatchRoadLoadedListener(roadInfo: String?){
|
||||
mMapLoadedListenerList?.let {
|
||||
for(listener in it){
|
||||
listener.onRoadLoaded(roadInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
override fun addMapViewVisualAngleChangeListener(mapViewVisualAngleChangeListener: OnMapViewVisualAngleChangeListener){
|
||||
if(mMapViewVisualAngleChangeListenerList == null){
|
||||
mMapViewVisualAngleChangeListenerList = ArrayList()
|
||||
}
|
||||
if(!mMapViewVisualAngleChangeListenerList!!.contains(mapViewVisualAngleChangeListener)) {
|
||||
mMapViewVisualAngleChangeListenerList?.add(mapViewVisualAngleChangeListener)
|
||||
}
|
||||
}
|
||||
|
||||
override fun removeMapViewVisualAngleChangeListener(mapViewVisualAngleChangeListener: OnMapViewVisualAngleChangeListener){
|
||||
mMapViewVisualAngleChangeListenerList?.remove(mapViewVisualAngleChangeListener)
|
||||
}
|
||||
|
||||
override fun dispatchMapViewVisualAngleChangeListener(type: Int){
|
||||
mMapViewVisualAngleChangeListenerList?.let {
|
||||
for(listener in it){
|
||||
listener.onMapViewVisualAngleChange(type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun addScrollListener(scrollListener: OnScrollListener){
|
||||
if(mScrollListenerList == null){
|
||||
mScrollListenerList = ArrayList()
|
||||
}
|
||||
if(!mScrollListenerList!!.contains(scrollListener)) {
|
||||
mScrollListenerList?.add(scrollListener)
|
||||
}
|
||||
}
|
||||
|
||||
override fun removeScrollListener(scrollListener: OnScrollListener){
|
||||
mScrollListenerList?.remove(scrollListener)
|
||||
}
|
||||
|
||||
override fun dispatchScrollListener(x: Double, y: Double){
|
||||
mScrollListenerList?.let {
|
||||
for(listener in it){
|
||||
listener.scrollBy(x,y)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun addMapStyleListener(mapStyleListener: OnMapStyleListener){
|
||||
if(mMapStyleListenerList == null){
|
||||
mMapStyleListenerList = ArrayList()
|
||||
}
|
||||
if(!mMapStyleListenerList!!.contains(mapStyleListener)) {
|
||||
mMapStyleListenerList?.add(mapStyleListener)
|
||||
}
|
||||
}
|
||||
|
||||
override fun removeMapStyleListener(mapStyleListener: OnMapStyleListener){
|
||||
mMapStyleListenerList?.remove(mapStyleListener)
|
||||
}
|
||||
|
||||
override fun dispatchMapStyleListener(type: Int){
|
||||
mMapStyleListenerList?.let {
|
||||
for(listener in it){
|
||||
listener.onChangeMapStyle(type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun addScreenShotListener(screenShotListener: OnMapScreenShotListener){
|
||||
if(mScreenListenerList == null){
|
||||
mScreenListenerList = ArrayList()
|
||||
}
|
||||
if(!mScreenListenerList!!.contains(screenShotListener)) {
|
||||
mScreenListenerList?.add(screenShotListener)
|
||||
}
|
||||
}
|
||||
|
||||
override fun removeScreenShotListener(screenShotListener: OnMapScreenShotListener){
|
||||
mScreenListenerList?.remove(screenShotListener)
|
||||
}
|
||||
|
||||
override fun dispatchScreenShotListener(bitmap: Bitmap?){
|
||||
mScreenListenerList?.let {
|
||||
for(listener in it){
|
||||
listener.onMapScreenShot(bitmap)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun addMapChangeListener(mapChangeListener: OnMapChangeListener){
|
||||
if(mMapChangeListenerList == null){
|
||||
mMapChangeListenerList = ArrayList()
|
||||
}
|
||||
if(!mMapChangeListenerList!!.contains(mapChangeListener)) {
|
||||
mMapChangeListenerList?.add(mapChangeListener)
|
||||
}
|
||||
}
|
||||
|
||||
override fun removeMapChangeListener(mapChangeListener: OnMapChangeListener){
|
||||
mMapChangeListenerList?.remove(mapChangeListener)
|
||||
}
|
||||
|
||||
override fun dispatchMapChangeListener(mogoLocation: MogoLocation){
|
||||
mMapChangeListenerList?.let {
|
||||
for(listener in it){
|
||||
listener.onMapChange(mogoLocation)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun addMarkClickListener(markClickListener: OnMarkClickListener){
|
||||
if(mMarkClickListenerList == null){
|
||||
mMarkClickListenerList = ArrayList()
|
||||
}
|
||||
if(!mMarkClickListenerList!!.contains(markClickListener)) {
|
||||
mMarkClickListenerList?.add(markClickListener)
|
||||
}
|
||||
}
|
||||
|
||||
override fun removeMarkClickListener(markClickListener: OnMarkClickListener){
|
||||
mMarkClickListenerList?.remove(markClickListener)
|
||||
}
|
||||
|
||||
override fun dispatchMarkClickListener(marker: Marker){
|
||||
mMarkClickListenerList?.let {
|
||||
for(listener in it){
|
||||
listener.onMarkClick(marker)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun isMarkClickListenerListEmpty():Boolean{
|
||||
return mMarkClickListenerList?.isEmpty()?:true
|
||||
}
|
||||
|
||||
|
||||
override fun addMapStatusListener(mapStatusListener: MapStatusListener, type: Int){
|
||||
when(type){
|
||||
MapAutoApi.LISTENER_TYPE_FOCUS->{
|
||||
if(mFocusListenerList == null){
|
||||
mFocusListenerList = ArrayList()
|
||||
}
|
||||
if(!mFocusListenerList!!.contains(mapStatusListener)) {
|
||||
mFocusListenerList?.add(mapStatusListener)
|
||||
}
|
||||
|
||||
}
|
||||
MapAutoApi.LISTENER_TYPE_ROTATE->{
|
||||
if(mRotateListenerList == null){
|
||||
mRotateListenerList = ArrayList()
|
||||
}
|
||||
if(!mRotateListenerList!!.contains(mapStatusListener)) {
|
||||
mRotateListenerList?.add(mapStatusListener)
|
||||
}
|
||||
}
|
||||
MapAutoApi.LISTENER_TYPE_ZOOM->{
|
||||
if(mZoomListenerList == null){
|
||||
mZoomListenerList = ArrayList()
|
||||
}
|
||||
if(!mZoomListenerList!!.contains(mapStatusListener)) {
|
||||
mZoomListenerList?.add(mapStatusListener)
|
||||
}
|
||||
|
||||
}
|
||||
MapAutoApi.LISTENER_TYPE_3D ->{
|
||||
if(mDAngleListenerList == null){
|
||||
mDAngleListenerList = ArrayList()
|
||||
}
|
||||
if(!mDAngleListenerList!!.contains(mapStatusListener)) {
|
||||
mDAngleListenerList?.add(mapStatusListener)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun removeMapStatusListener(mapStatusListener: MapStatusListener, type: Int){
|
||||
when(type){
|
||||
MapAutoApi.LISTENER_TYPE_FOCUS->{
|
||||
mFocusListenerList?.remove(mapStatusListener)
|
||||
|
||||
}
|
||||
MapAutoApi.LISTENER_TYPE_ROTATE->{
|
||||
mRotateListenerList?.remove(mapStatusListener)
|
||||
}
|
||||
MapAutoApi.LISTENER_TYPE_ZOOM->{
|
||||
mZoomListenerList?.remove(mapStatusListener)
|
||||
}
|
||||
MapAutoApi.LISTENER_TYPE_3D->{
|
||||
mDAngleListenerList?.remove(mapStatusListener)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun dispatchMapStatusListener(type:Int, value: Int){
|
||||
when(type){
|
||||
MapAutoApi.LISTENER_TYPE_FOCUS->{
|
||||
mFocusListenerList?.let {
|
||||
for(listener in it){
|
||||
listener.onMapStatusChanged(type, value)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
MapAutoApi.LISTENER_TYPE_ROTATE->{
|
||||
mRotateListenerList?.let{
|
||||
for(listener in it){
|
||||
listener.onMapStatusChanged(type, value)
|
||||
}
|
||||
}
|
||||
}
|
||||
MapAutoApi.LISTENER_TYPE_ZOOM->{
|
||||
mZoomListenerList?.let {
|
||||
for(listener in it){
|
||||
listener.onMapStatusChanged(type, value)
|
||||
}
|
||||
}
|
||||
}
|
||||
MapAutoApi.LISTENER_TYPE_3D->{
|
||||
mDAngleListenerList?.let{
|
||||
for(listener in it){
|
||||
listener.onMapStatusChanged(type, value)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
override fun addRenderListener(renderListener : OnRenderListener){
|
||||
if(renderListenerList == null){
|
||||
renderListenerList = ArrayList()
|
||||
}
|
||||
if(!renderListenerList!!.contains(renderListener)) {
|
||||
renderListenerList?.add(renderListener)
|
||||
}
|
||||
}
|
||||
|
||||
override fun removeRenderListener(renderListener : OnRenderListener){
|
||||
renderListenerList?.remove(renderListener)
|
||||
}
|
||||
|
||||
override fun dispatchRenderListener(duration:Int){
|
||||
renderListenerList?.let {
|
||||
for(listener in it){
|
||||
listener.renderTime(duration)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun addRoadInfoListener(roadInfoListener: OnRoadInfoListener){
|
||||
if(mRoadInfoListenerList == null){
|
||||
mRoadInfoListenerList = ArrayList()
|
||||
}
|
||||
if(!mRoadInfoListenerList!!.contains(roadInfoListener)) {
|
||||
mRoadInfoListenerList?.add(roadInfoListener)
|
||||
}
|
||||
}
|
||||
|
||||
override fun removeRoadInfoListener(roadInfoListener : OnRoadInfoListener){
|
||||
mRoadInfoListenerList?.remove(roadInfoListener)
|
||||
}
|
||||
|
||||
override fun dispatchStopLineInfo(stopLine: StopLine?){
|
||||
mRoadInfoListenerList?.let {
|
||||
for(listener in it){
|
||||
listener.onStopLineInfo(stopLine)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun dispatchRoadIdInfo(roadId: String?, laneId: String?){
|
||||
mRoadInfoListenerList?.let {
|
||||
for(listener in it){
|
||||
listener.onRoadIdInfo(roadId, laneId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun dispatchRoadCrossInfo(roadCross: RoadCross?){
|
||||
mRoadInfoListenerList?.let {
|
||||
for(listener in it){
|
||||
listener.onRoadCrossInfo(roadCross)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun addLogListener(listener: ILog){
|
||||
if(mLogListenerList == null){
|
||||
mLogListenerList = ArrayList()
|
||||
}
|
||||
if(!mLogListenerList!!.contains(listener)) {
|
||||
mLogListenerList?.add(listener)
|
||||
}
|
||||
}
|
||||
|
||||
override fun removeLogListener(listener : ILog){
|
||||
mLogListenerList?.remove(listener)
|
||||
}
|
||||
|
||||
override fun dispatchLog(path: String){
|
||||
mLogListenerList?.let {
|
||||
for(listener in it){
|
||||
listener.result(path)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun addRoamStatusListener(onRoamStatusListener: OnRoamStatusListener){
|
||||
if(mRoamStatusListenerList == null){
|
||||
mRoamStatusListenerList = ArrayList()
|
||||
}
|
||||
if(!mRoamStatusListenerList!!.contains(onRoamStatusListener)) {
|
||||
mRoamStatusListenerList?.add(onRoamStatusListener)
|
||||
}
|
||||
}
|
||||
|
||||
override fun removeRoamStatusListener(onRoamStatusListener: OnRoamStatusListener){
|
||||
mRoamStatusListenerList?.let {
|
||||
it.remove(onRoamStatusListener)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun dispatchRoamStatusListener(status: Int, msg: String){
|
||||
mRoamStatusListenerList?.let {
|
||||
for(listener in it){
|
||||
listener.onRoamStatus(status, msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
package com.zhidaoauto.map.sdk.inner.db;
|
||||
|
||||
import android.location.Location;
|
||||
|
||||
import com.autonavi.nge.obj.DestObj;
|
||||
import com.autonavi.nge.obj.PoiBase;
|
||||
import com.zhidaoauto.map.sdk.open.nav.NavPoi;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* 存储所有的数据信息
|
||||
* @author
|
||||
*
|
||||
*/
|
||||
public class DataStorageManager {
|
||||
|
||||
private static DataStorageManager mDataStorageManager;
|
||||
|
||||
// private TrafficDatabase mTrafficDatabase;
|
||||
//不同组件之间的poi对象传输
|
||||
private NavPoi mNavPoi;
|
||||
//当前位置
|
||||
private Location mCurLocation;
|
||||
//搜索结果列表
|
||||
private Vector<PoiBase> mResultList;
|
||||
//工作目录
|
||||
private String mWorkingDirectory;
|
||||
|
||||
private List<NavPoi> searchList;
|
||||
private String searchkey;
|
||||
private int poibub;
|
||||
|
||||
private DestObj mCurEditDest;//当前正在编辑的目的地
|
||||
|
||||
|
||||
|
||||
private DataStorageManager(){
|
||||
}
|
||||
|
||||
public static DataStorageManager getInstance(){
|
||||
if(mDataStorageManager == null) {
|
||||
mDataStorageManager = new DataStorageManager();
|
||||
}
|
||||
return mDataStorageManager;
|
||||
}
|
||||
|
||||
// public void init(Context context){
|
||||
// SettingService service = new SettingService(context);
|
||||
// Setting settings = service.getSettings();
|
||||
// MainInfo.GetInstance().setBGMusicStat(settings.isBg_music());
|
||||
// MainInfo.GetInstance().SetBusInfo(settings.getAddrDescribe() == 0?true:false);
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* 搜索列表
|
||||
*/
|
||||
public void setPoiList(List<NavPoi> searchList)
|
||||
{
|
||||
this.searchList = searchList;
|
||||
}
|
||||
|
||||
public List<NavPoi> getPoiList()
|
||||
{
|
||||
return searchList;
|
||||
|
||||
}
|
||||
/**
|
||||
* 搜索关键字
|
||||
*/
|
||||
|
||||
public void setPoiKey(String searchkey)
|
||||
{
|
||||
this.searchkey = searchkey;
|
||||
}
|
||||
|
||||
public String getPoiKey()
|
||||
{
|
||||
return searchkey;
|
||||
|
||||
}
|
||||
|
||||
public void setNavPoi(NavPoi navpoi) {
|
||||
this.mNavPoi = navpoi;
|
||||
}
|
||||
|
||||
public NavPoi getNavPoi() {
|
||||
return mNavPoi;
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前是第几个气泡
|
||||
*/
|
||||
|
||||
public void setPoiBub(int poibub)
|
||||
{
|
||||
this.poibub = poibub;
|
||||
}
|
||||
|
||||
public int getPoiBub()
|
||||
{
|
||||
return poibub;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置正在编辑的目的地
|
||||
* @param mChannel
|
||||
*/
|
||||
public void setCurEditDest(DestObj mChannel) {
|
||||
this.mCurEditDest = mChannel;
|
||||
}
|
||||
|
||||
public DestObj getCurEditDest() {
|
||||
return mCurEditDest;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.zhidaoauto.map.sdk.inner.db;
|
||||
|
||||
public class Setting {
|
||||
public boolean isBg_music() {
|
||||
return bg_music;
|
||||
}
|
||||
public void setBg_music(boolean bg_music) {
|
||||
this.bg_music = bg_music;
|
||||
}
|
||||
public boolean isDisclaimer() {
|
||||
return disclaimer;
|
||||
}
|
||||
public void setDisclaimer(boolean disclaimer) {
|
||||
this.disclaimer = disclaimer;
|
||||
}
|
||||
public boolean isAuto_play() {
|
||||
return auto_play;
|
||||
}
|
||||
public void setAuto_play(boolean auto_play) {
|
||||
this.auto_play = auto_play;
|
||||
}
|
||||
public boolean isAlways() {
|
||||
return always;
|
||||
}
|
||||
public void setAlways(boolean always) {
|
||||
this.always = always;
|
||||
}
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
public String geteMail() {
|
||||
return eMail;
|
||||
}
|
||||
public void seteMail(String eMail) {
|
||||
this.eMail = eMail;
|
||||
}
|
||||
|
||||
public int getAddrDescribe() {
|
||||
return AddrDescribe;
|
||||
}
|
||||
public void setAddrDescribe(int addrDescribe) {
|
||||
AddrDescribe = addrDescribe;
|
||||
}
|
||||
|
||||
public void setRegisted(boolean isRegisted) {
|
||||
this.isRegisted = isRegisted;
|
||||
}
|
||||
|
||||
public boolean isRegisted() {
|
||||
return isRegisted;
|
||||
}
|
||||
|
||||
private boolean bg_music; //背景音乐设置
|
||||
private boolean disclaimer; //启动时显示免责声明
|
||||
private boolean auto_play; //启动时开启路况播报
|
||||
private boolean always; //使用中保持屏幕常亮
|
||||
private int AddrDescribe ; //拥堵地点描述方式 :0- 优先使用地名描述 1-优先使用交叉口描述
|
||||
private String userName; //用户名
|
||||
private String eMail; //用户邮箱
|
||||
private boolean isRegisted = false;//是否注册
|
||||
|
||||
}
|
||||
@@ -0,0 +1,345 @@
|
||||
package com.zhidaoauto.map.sdk.inner.db;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import com.autonavi.nge.routing.RoutingProvider;
|
||||
|
||||
public class SettingService {
|
||||
private SharedPreferences mSharedPreferences;
|
||||
|
||||
private static final String PREFERENCES_ADDR_DESTRIBE = "list_preference";
|
||||
private static final String PREFERENCES_ALWAYS = "always";
|
||||
private static final String PREFERENCES_MAP_MODE = "map_mode";
|
||||
private static final String PREFERENCES_USER_ROUTE = "user_route";
|
||||
private static final String PREFERENCES_AUTO_PLAY = "auto_play";
|
||||
private static final String PREFERENCES_AUTO_GO = "auto_go";
|
||||
private static final String PREFERENCES_PLAY_ROAD = "play_road";
|
||||
private static final String PREFERENCES_BG_MUSIC = "bg_music";
|
||||
private static final String PREFERENCES_SHOW_DISCLAIMER = "disclaimer";
|
||||
private static final String PREFERENCES_EMAIL = "eMail";
|
||||
private static final String PREFERENCES_USER_NAME = "userName";
|
||||
private static final String PREFERENCES_IMSI = "imsi";
|
||||
private static final String PREFERENCES_IS_REGISTED = "isRegisted";
|
||||
private static final String PREFERENCES_IS_DOWNLOAD_MAP_SHOW = "downloadMap";
|
||||
private static final String PREFERENCES_LOCATION_LON = "MapCenterX";
|
||||
private static final String PREFERENCES_LOCATION_LAT = "MapCenterY";
|
||||
private static final String PREFERENCES_MEDIA_BOTTOM = "mediaBottom";
|
||||
private static final String PREFERENCES_MEDIA_AUTO_PLAY = "mediaAutoPlay";
|
||||
private static final String PREFERENCES_BT_ADS = "bluetoothAddress";
|
||||
private static final String PREFERENCES_ROUTING_MODEL = "routingModel";
|
||||
private static final String PREFERENCES_ROUTING_AVOID_HWAY = "routingAvoidHWay";
|
||||
private static final String PREFERENCES_ROUTING_AVOID_TOLL = "routingAvoidToll";
|
||||
private static final String PREFERENCES_SEARCH_UPDATEREGION = "searchUpdateRegion";
|
||||
private static final String PREFERENCES_SEARCH_UPDATEREGION_NAME = "searchUpdateRegionName";
|
||||
private static final String PREFERENCES_ROUTE_SELECT_SHOW = "RouteSelectShow";
|
||||
private static final String PREFERENCES_TRACK = "track";
|
||||
private static final String PREFERENCES_SPEED_HIGHWAY = "highway_speed";
|
||||
private static final String PREFERENCES_SPEED_FAST = "fast_speed";
|
||||
private static final String PREFERENCES_SPEED_GENERAL = "general_speed";
|
||||
private static final String PREFERENCES_SPEED_HIGHWAY_TIP = "highway_speed_tip";
|
||||
private static final String PREFERENCES_SPEED_FAST_TIP = "fast_speed_tip";
|
||||
private static final String PREFERENCES_SPEED_GENERAL_TIP = "general_speed_tip";
|
||||
private static final String PREFERENCES_MAP_STYLE = "map_style";
|
||||
|
||||
public SettingService(Context context){
|
||||
mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext());
|
||||
}
|
||||
|
||||
public Setting getSettings(){
|
||||
Setting mSetting = new Setting();
|
||||
String addrDescrbe = mSharedPreferences.getString(PREFERENCES_ADDR_DESTRIBE, "0");
|
||||
int id = 0;
|
||||
try {
|
||||
id = Integer.parseInt(addrDescrbe);
|
||||
} catch (NumberFormatException e) {
|
||||
id = 0;
|
||||
}
|
||||
mSetting.setAddrDescribe(id);
|
||||
mSetting.setAlways(mSharedPreferences.getBoolean(PREFERENCES_ALWAYS, true));
|
||||
mSetting.setAuto_play(mSharedPreferences.getBoolean(PREFERENCES_AUTO_PLAY, true));
|
||||
mSetting.setBg_music(mSharedPreferences.getBoolean(PREFERENCES_BG_MUSIC, true));
|
||||
mSetting.setDisclaimer(mSharedPreferences.getBoolean(PREFERENCES_SHOW_DISCLAIMER, true));
|
||||
mSetting.seteMail(mSharedPreferences.getString(PREFERENCES_EMAIL, ""));
|
||||
mSetting.setUserName(mSharedPreferences.getString(PREFERENCES_USER_NAME,""));
|
||||
mSetting.setUserName(mSharedPreferences.getString(PREFERENCES_IMSI,""));
|
||||
mSetting.setRegisted(mSharedPreferences.getBoolean(PREFERENCES_IS_REGISTED, false));
|
||||
return mSetting;
|
||||
}
|
||||
|
||||
public boolean isShowBGMusic(){
|
||||
return mSharedPreferences.getBoolean(PREFERENCES_BG_MUSIC, true);
|
||||
}
|
||||
|
||||
public boolean updateShowBGMusic(boolean show){
|
||||
return mSharedPreferences.edit().putBoolean(PREFERENCES_BG_MUSIC, show).commit();
|
||||
}
|
||||
|
||||
public boolean isShowDisclaimer(){
|
||||
return mSharedPreferences.getBoolean(PREFERENCES_SHOW_DISCLAIMER, true);
|
||||
}
|
||||
|
||||
public boolean updateShowDisclaimer(boolean show){
|
||||
return mSharedPreferences.edit().putBoolean(PREFERENCES_SHOW_DISCLAIMER, show).commit();
|
||||
}
|
||||
|
||||
public boolean isShowAutoPlay(){
|
||||
return mSharedPreferences.getBoolean(PREFERENCES_AUTO_PLAY, true);
|
||||
}
|
||||
|
||||
public boolean updateAutoPlay(boolean show){
|
||||
return mSharedPreferences.edit().putBoolean(PREFERENCES_AUTO_PLAY, show).commit();
|
||||
}
|
||||
|
||||
public boolean isShowAllwaysScreenOn(){
|
||||
return mSharedPreferences.getBoolean(PREFERENCES_ALWAYS, true);
|
||||
}
|
||||
|
||||
public boolean updateShowAllwaysScreenOn(boolean show){
|
||||
return mSharedPreferences.edit().putBoolean(PREFERENCES_ALWAYS, show).commit();
|
||||
}
|
||||
|
||||
public String getUserName(){
|
||||
return mSharedPreferences.getString(PREFERENCES_USER_NAME, "");
|
||||
}
|
||||
|
||||
public boolean setUserName(String userName){
|
||||
return mSharedPreferences.edit().putString(PREFERENCES_USER_NAME, userName).commit();
|
||||
}
|
||||
|
||||
public String getEmail(){
|
||||
return mSharedPreferences.getString(PREFERENCES_EMAIL, "");
|
||||
}
|
||||
|
||||
public boolean setEmail(String eMail){
|
||||
return mSharedPreferences.edit().putString(PREFERENCES_EMAIL, eMail).commit();
|
||||
}
|
||||
|
||||
public String getIMSI()
|
||||
{
|
||||
return mSharedPreferences.getString(PREFERENCES_IMSI, "");
|
||||
}
|
||||
|
||||
public boolean setIMSI(String imsi)
|
||||
{
|
||||
return mSharedPreferences.edit().putString(PREFERENCES_IMSI, imsi).commit();
|
||||
}
|
||||
|
||||
|
||||
public int getAddrDescribe(){
|
||||
String addrDescrbe = mSharedPreferences.getString(PREFERENCES_ADDR_DESTRIBE, "0");
|
||||
int id = 0;
|
||||
try {
|
||||
id = Integer.parseInt(addrDescrbe);
|
||||
} catch (NumberFormatException e) {
|
||||
id = 0;
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
public boolean setAddrDescribe(int describe){
|
||||
return mSharedPreferences.edit().putString(PREFERENCES_ADDR_DESTRIBE, String.valueOf(describe)).commit();
|
||||
}
|
||||
|
||||
public boolean setRegisted(boolean isRegisted){
|
||||
return mSharedPreferences.edit().putBoolean(PREFERENCES_IS_REGISTED, isRegisted).commit();
|
||||
}
|
||||
|
||||
public boolean isRegisted(){
|
||||
return mSharedPreferences.getBoolean(PREFERENCES_IS_REGISTED, false);
|
||||
}
|
||||
|
||||
public boolean isDownloadMapShow(){
|
||||
return mSharedPreferences.getBoolean(PREFERENCES_IS_DOWNLOAD_MAP_SHOW, true);
|
||||
}
|
||||
|
||||
public boolean setDownloadMapShow(boolean DownloadMapShow){
|
||||
return mSharedPreferences.edit().putBoolean(PREFERENCES_IS_DOWNLOAD_MAP_SHOW, DownloadMapShow).commit();
|
||||
}
|
||||
|
||||
public int getLocationLon(){
|
||||
return mSharedPreferences.getInt(PREFERENCES_LOCATION_LON, 419031495);
|
||||
}
|
||||
|
||||
public boolean setLocationLon(int LocLon){
|
||||
return mSharedPreferences.edit().putInt(PREFERENCES_LOCATION_LON, LocLon).commit();
|
||||
}
|
||||
|
||||
public int getLocationLat(){
|
||||
return mSharedPreferences.getInt(PREFERENCES_LOCATION_LAT, 143664145);
|
||||
}
|
||||
|
||||
public boolean setLocationLat(int LocLat){
|
||||
return mSharedPreferences.edit().putInt(PREFERENCES_LOCATION_LAT, LocLat).commit();
|
||||
}
|
||||
|
||||
public boolean isAutoGo() {
|
||||
return mSharedPreferences.getBoolean(PREFERENCES_AUTO_GO, true);
|
||||
}
|
||||
|
||||
public boolean updateAutoGo(boolean b) {
|
||||
return mSharedPreferences.edit().putBoolean(PREFERENCES_AUTO_GO, b).commit();
|
||||
}
|
||||
|
||||
public boolean isDriverMap() {
|
||||
return mSharedPreferences.getBoolean(PREFERENCES_MAP_MODE, false);
|
||||
}
|
||||
|
||||
public boolean updateDriverMap(boolean b) {
|
||||
return mSharedPreferences.edit().putBoolean(PREFERENCES_MAP_MODE, b).commit();
|
||||
}
|
||||
|
||||
public boolean isLastUserRoute() {
|
||||
return mSharedPreferences.getBoolean(PREFERENCES_USER_ROUTE, true);
|
||||
}
|
||||
|
||||
public boolean updateUserRoute(boolean b) {
|
||||
return mSharedPreferences.edit().putBoolean(PREFERENCES_USER_ROUTE, b).commit();
|
||||
}
|
||||
|
||||
public boolean isPlayRoad() {
|
||||
return mSharedPreferences.getBoolean(PREFERENCES_PLAY_ROAD, true);
|
||||
}
|
||||
|
||||
public boolean updatePlayRoad(boolean b) {
|
||||
return mSharedPreferences.edit().putBoolean(PREFERENCES_PLAY_ROAD, b).commit();
|
||||
}
|
||||
|
||||
public int getMediaBottom(){
|
||||
return mSharedPreferences.getInt(PREFERENCES_MEDIA_BOTTOM, 0);
|
||||
}
|
||||
|
||||
public boolean updateMediaBottom(int bottom){
|
||||
return mSharedPreferences.edit().putInt(PREFERENCES_MEDIA_BOTTOM, bottom).commit();
|
||||
}
|
||||
|
||||
public boolean isMediaAutoPlay() {
|
||||
return mSharedPreferences.getBoolean(PREFERENCES_MEDIA_AUTO_PLAY, true);
|
||||
}
|
||||
|
||||
public boolean updateMediaAutoPlay(boolean b) {
|
||||
return mSharedPreferences.edit().putBoolean(PREFERENCES_MEDIA_AUTO_PLAY, b).commit();
|
||||
}
|
||||
|
||||
public String getBtAddr(){
|
||||
return mSharedPreferences.getString(PREFERENCES_BT_ADS, "");
|
||||
}
|
||||
|
||||
public boolean updateBtAddr(String btAddr){
|
||||
return mSharedPreferences.edit().putString(PREFERENCES_BT_ADS, btAddr).commit();
|
||||
}
|
||||
|
||||
public int getRoutingModel(){
|
||||
return mSharedPreferences.getInt(PREFERENCES_ROUTING_MODEL, RoutingProvider.COSTMODEL_FASTEST);
|
||||
}
|
||||
|
||||
public boolean setRoutingModel(int model){
|
||||
return mSharedPreferences.edit().putInt(PREFERENCES_ROUTING_MODEL, model).commit();
|
||||
}
|
||||
|
||||
public boolean isRoutingAvoidHighway(){
|
||||
return mSharedPreferences.getBoolean(PREFERENCES_ROUTING_AVOID_HWAY, false);
|
||||
}
|
||||
|
||||
public boolean setRoutingAvoidHighway(boolean isRoutingAvoidHighway){
|
||||
return mSharedPreferences.edit().putBoolean(PREFERENCES_ROUTING_AVOID_HWAY, isRoutingAvoidHighway).commit();
|
||||
}
|
||||
|
||||
public boolean isRoutingAvoidToll(){
|
||||
return mSharedPreferences.getBoolean(PREFERENCES_ROUTING_AVOID_TOLL, false);
|
||||
}
|
||||
|
||||
public boolean setRoutingAvoidToll(boolean isRoutingAvoidToll){
|
||||
return mSharedPreferences.edit().putBoolean(PREFERENCES_ROUTING_AVOID_TOLL, isRoutingAvoidToll).commit();
|
||||
}
|
||||
|
||||
public int getUpdateRegion(){
|
||||
return mSharedPreferences.getInt(PREFERENCES_SEARCH_UPDATEREGION, 1);
|
||||
}
|
||||
|
||||
public boolean setUpdateRegion(int urId){
|
||||
return mSharedPreferences.edit().putInt(PREFERENCES_SEARCH_UPDATEREGION, urId).commit();
|
||||
}
|
||||
|
||||
public String getUpdataRegionName(){
|
||||
return mSharedPreferences.getString(PREFERENCES_SEARCH_UPDATEREGION_NAME, "北京市");
|
||||
}
|
||||
|
||||
public boolean setUpdataRegionName(String name){
|
||||
return mSharedPreferences.edit().putString(PREFERENCES_SEARCH_UPDATEREGION_NAME, name).commit();
|
||||
}
|
||||
|
||||
public boolean isRouteSelectShow() {
|
||||
return mSharedPreferences.getBoolean(PREFERENCES_ROUTE_SELECT_SHOW, true);
|
||||
}
|
||||
|
||||
public boolean setRouteSelectShow(boolean isRouteSelectShow){
|
||||
return mSharedPreferences.edit().putBoolean(PREFERENCES_ROUTE_SELECT_SHOW, isRouteSelectShow).commit();
|
||||
}
|
||||
|
||||
public boolean isTrack(){
|
||||
return mSharedPreferences.getBoolean(PREFERENCES_TRACK, false);
|
||||
}
|
||||
|
||||
public boolean setTrack(boolean isTrack){
|
||||
return mSharedPreferences.edit().putBoolean(PREFERENCES_TRACK, isTrack).commit();
|
||||
}
|
||||
|
||||
public boolean setSpeedHighWay(int speed){
|
||||
return mSharedPreferences.edit().putInt(PREFERENCES_SPEED_HIGHWAY, speed).commit();
|
||||
}
|
||||
|
||||
public int getSpeedHighWay(){
|
||||
return mSharedPreferences.getInt(PREFERENCES_SPEED_HIGHWAY, 120);
|
||||
}
|
||||
|
||||
public boolean setSpeedFast(int speed){
|
||||
return mSharedPreferences.edit().putInt(PREFERENCES_SPEED_FAST, speed).commit();
|
||||
}
|
||||
|
||||
public int getSpeedFast(){
|
||||
return mSharedPreferences.getInt(PREFERENCES_SPEED_FAST, 90);
|
||||
}
|
||||
|
||||
public boolean setSpeedGeneral(int speed){
|
||||
return mSharedPreferences.edit().putInt(PREFERENCES_SPEED_GENERAL, speed).commit();
|
||||
}
|
||||
|
||||
public int getSpeedGeneral(){
|
||||
return mSharedPreferences.getInt(PREFERENCES_SPEED_GENERAL, 60);
|
||||
}
|
||||
|
||||
public boolean getSpeedHighWayTip(){
|
||||
return mSharedPreferences.getBoolean(PREFERENCES_SPEED_HIGHWAY_TIP, true);
|
||||
}
|
||||
|
||||
public boolean setSpeedHighWayTip(boolean tipOn){
|
||||
return mSharedPreferences.edit().putBoolean(PREFERENCES_SPEED_HIGHWAY_TIP, tipOn).commit();
|
||||
}
|
||||
|
||||
public boolean setSpeedFastTip(boolean tipOn){
|
||||
return mSharedPreferences.edit().putBoolean(PREFERENCES_SPEED_FAST_TIP, tipOn).commit();
|
||||
}
|
||||
|
||||
public boolean getSpeedFastTip(){
|
||||
return mSharedPreferences.getBoolean(PREFERENCES_SPEED_FAST_TIP, true);
|
||||
}
|
||||
|
||||
public boolean setSpeedGeneralTip(boolean tipOn){
|
||||
return mSharedPreferences.edit().putBoolean(PREFERENCES_SPEED_GENERAL_TIP, tipOn).commit();
|
||||
}
|
||||
|
||||
public boolean getSpeedGeneralTip(){
|
||||
return mSharedPreferences.getBoolean(PREFERENCES_SPEED_GENERAL_TIP, true);
|
||||
}
|
||||
|
||||
public boolean setMapStyle(String style){
|
||||
return mSharedPreferences.edit().putString(PREFERENCES_MAP_STYLE, style).commit();
|
||||
}
|
||||
|
||||
public String getMapStyle(){
|
||||
return mSharedPreferences.getString(PREFERENCES_MAP_STYLE, "0");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.zhidaoauto.map.sdk.inner.element;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class M3DCar {
|
||||
private Context context;
|
||||
private int resid;
|
||||
public byte[] totBuffer = null;
|
||||
public int totSize = 0;
|
||||
|
||||
public M3DCar(Context context, int resid) {
|
||||
this.resid = resid;
|
||||
this.context = context;
|
||||
loadData();
|
||||
}
|
||||
|
||||
private void loadData() {
|
||||
if (null != totBuffer)
|
||||
return;
|
||||
DataInputStream dis = new DataInputStream(context.getResources().openRawResource(resid));
|
||||
int curTotSize = 64 * 1024;
|
||||
totBuffer = new byte[curTotSize];
|
||||
byte[] buffer = new byte[1024];
|
||||
int size = 0;
|
||||
try {
|
||||
while ((size = dis.read(buffer)) >= 0) {
|
||||
if (totSize + size > curTotSize) {
|
||||
curTotSize = (totSize + size) * 3 / 2;
|
||||
byte[] newTotBuffer = new byte[curTotSize];
|
||||
System.arraycopy(totBuffer, 0, newTotBuffer, 0, totSize);
|
||||
totBuffer = newTotBuffer;
|
||||
}
|
||||
System.arraycopy(buffer, 0, totBuffer, totSize, size);
|
||||
totSize += size;
|
||||
}
|
||||
dis.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zhidaoauto.map.sdk.inner.element;
|
||||
|
||||
public class MapCoordinate {
|
||||
public int x;
|
||||
public int y;
|
||||
|
||||
public MapCoordinate(){}
|
||||
public MapCoordinate(int x, int y){
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
@Override
|
||||
public String toString(){
|
||||
return "x=" + x + " y=" + y;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.zhidaoauto.map.sdk.inner.location
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.BitmapFactory
|
||||
import android.util.Log
|
||||
import com.zhidaoauto.map.sdk.R
|
||||
import com.zhidaoauto.map.sdk.inner.CompileConfig
|
||||
import com.zhidaoauto.map.sdk.inner.abs.ILocationView
|
||||
import com.zhidaoauto.map.sdk.inner.abs.IMapController
|
||||
import com.zhidaoauto.map.sdk.inner.abs.IMarkerController
|
||||
import com.zhidaoauto.map.sdk.open.MapAutoApi
|
||||
import com.zhidaoauto.map.sdk.open.location.MyLocationStyle
|
||||
import io.netty.util.internal.StringUtil
|
||||
|
||||
class LocationHelper(private var mContext: Context?, private var mMarkerController: IMarkerController?, private var mMapController: IMapController?):ILocationView {
|
||||
private val TAG = "LocationHelper"
|
||||
|
||||
private var myLocationEnabled: Boolean = false
|
||||
private lateinit var myLocationStyle: MyLocationStyle
|
||||
|
||||
init {
|
||||
if (CompileConfig.DEBUG) {
|
||||
Log.i(TAG, "selfop---markerop-LocationHelper constructor")
|
||||
}
|
||||
myLocationStyle = MyLocationStyle(mContext, mMarkerController, mMapController)
|
||||
val mMapStyle = mMapController?.getMapStyleParams()?.getStyleMode()?:MapAutoApi.MAP_STYLE_NIGHT
|
||||
switch(mMapStyle)
|
||||
|
||||
}
|
||||
|
||||
override fun exit() {
|
||||
myLocationStyle?.exit()
|
||||
}
|
||||
|
||||
override fun switch(style: Int) {
|
||||
if (CompileConfig.DEBUG) {
|
||||
Log.i(TAG, "selfop---markerop-carCursorRes switch:${style}")
|
||||
}
|
||||
|
||||
if (style >= MapAutoApi.MAP_STYLE_NIGHT_VR) {
|
||||
myLocationStyle?.let {
|
||||
if (style == MapAutoApi.MAP_STYLE_NIGHT_VR) {
|
||||
it.setAnimMarkerRes(
|
||||
R.raw.guangquan,
|
||||
MyLocationStyle.ANIM_WAIT_FRAME_NIGHT,
|
||||
MyLocationStyle.ANIM_PERIOD_NIGHT
|
||||
)
|
||||
} else {
|
||||
it.setAnimMarkerRes(
|
||||
R.raw.guangquan_day,
|
||||
MyLocationStyle.ANIM_WAIT_FRAME_DAY,
|
||||
MyLocationStyle.ANIM_PERIOD_DAY
|
||||
)
|
||||
}
|
||||
it.myLocationIcon(it.car3DResId, true)
|
||||
}
|
||||
|
||||
} else {
|
||||
myLocationStyle?.let {
|
||||
var bitmap = it.myLocationIcon
|
||||
if (bitmap == null) {
|
||||
it.myLocationIcon(it.carResId)
|
||||
} else {
|
||||
if (!StringUtil.isNullOrEmpty(it.locationPath)) {
|
||||
bitmap = BitmapFactory.decodeFile(it.locationPath)
|
||||
}
|
||||
if (bitmap != null) {
|
||||
if (bitmap.isRecycled) {
|
||||
it.myLocationIcon(it.carResId)
|
||||
return@let
|
||||
}
|
||||
it.myLocationIcon(bitmap)
|
||||
} else {
|
||||
it.myLocationIcon(it.carResId)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun setMyLocationEnabled(myLocationEnabled: Boolean) {
|
||||
this.myLocationEnabled = myLocationEnabled
|
||||
}
|
||||
|
||||
override fun getMyLocationEnabled(): Boolean {
|
||||
return this.myLocationEnabled
|
||||
}
|
||||
|
||||
override fun setMyLocationStyle(myLocationStyle: MyLocationStyle) {
|
||||
this.myLocationStyle = myLocationStyle
|
||||
}
|
||||
|
||||
override fun getMyLocationStyle(): MyLocationStyle? {
|
||||
return myLocationStyle
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
package com.zhidaoauto.map.sdk.inner.map
|
||||
|
||||
import android.util.Log
|
||||
import com.zhidaoauto.map.sdk.inner.CompileConfig
|
||||
import com.zhidaoauto.map.sdk.inner.abs.IMapController
|
||||
import com.zhidaoauto.map.sdk.inner.common.ConstantExt
|
||||
import com.zhidaoauto.map.sdk.open.MapAutoApi
|
||||
|
||||
class MapAnimate(private val mMapController: IMapController) {
|
||||
private var TAG = javaClass.simpleName
|
||||
private var startEyeHeight: Float
|
||||
private var startLookAngle: Float
|
||||
private var startZoomVal: Float
|
||||
|
||||
private var endEyeHeight:Float? = null
|
||||
private var endLookAngle:Float? = null
|
||||
private var endZoomVal:Float? = null
|
||||
private var duration = 1000
|
||||
private var startTime = 0L
|
||||
private var isRuning:Boolean = false
|
||||
|
||||
init {
|
||||
if(mMapController.getMapStyleParams().getStyleMode() == MapAutoApi.MAP_STYLE_NIGHT){
|
||||
startEyeHeight = ConstantExt.MAP_STYLE_2D_EYE_HEIGHT
|
||||
startLookAngle = ConstantExt.MAP_STYLE_2D_OVER_LOOK_ANGLE
|
||||
startZoomVal = ConstantExt.MAP_STYLE_2D_ZOOM.toFloat()
|
||||
}else{
|
||||
startEyeHeight = ConstantExt.MAP_STYLE_VR_EYE_HEIGHT_MIDDLE
|
||||
startLookAngle = ConstantExt.MAP_STYLE_VR_OVER_LOOK_ANGLE_MIDDLE
|
||||
startZoomVal = ConstantExt.MAP_STYLE_VR_ZOOM_VAL_MIDDLE
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun setStartFrame(zoomVal: Float, lookAngle: Float, eyeHeight: Float){
|
||||
if(zoomVal != -1f){
|
||||
startZoomVal = zoomVal
|
||||
}
|
||||
if(lookAngle != -1f){
|
||||
startLookAngle = lookAngle
|
||||
}
|
||||
if(eyeHeight != -1f){
|
||||
startEyeHeight = eyeHeight
|
||||
}
|
||||
}
|
||||
|
||||
fun executeAnim(zoomVal:Float, eyeHeight:Float, lookAngle:Float, duration: Int){
|
||||
if(zoomVal == -1f){
|
||||
endZoomVal = startZoomVal
|
||||
}else {
|
||||
endZoomVal = zoomVal
|
||||
}
|
||||
if(eyeHeight == -1f){
|
||||
endEyeHeight = startEyeHeight
|
||||
}else {
|
||||
endEyeHeight = eyeHeight
|
||||
}
|
||||
if(lookAngle == -1f){
|
||||
endLookAngle = startLookAngle
|
||||
}else {
|
||||
endLookAngle = lookAngle
|
||||
}
|
||||
if(duration != -1){
|
||||
this.duration = duration
|
||||
}else{
|
||||
this.duration = 1000
|
||||
}
|
||||
startTime= System.currentTimeMillis()
|
||||
isRuning = true
|
||||
}
|
||||
|
||||
fun isAnimationing():Boolean{
|
||||
if(startTime == 0L
|
||||
|| !isRuning
|
||||
|| (System.currentTimeMillis()-startTime)>duration){
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
fun endAnimation(){
|
||||
startTime = 0L
|
||||
isRuning = false
|
||||
endZoomVal?.let {
|
||||
startZoomVal = it
|
||||
}
|
||||
endLookAngle?.let {
|
||||
startLookAngle = it
|
||||
}
|
||||
endEyeHeight?.let {
|
||||
startEyeHeight = it
|
||||
}
|
||||
}
|
||||
|
||||
fun stepAnimation(): FloatArray{
|
||||
if(!isRuning){
|
||||
return floatArrayOf(startZoomVal,startLookAngle,startEyeHeight)
|
||||
}
|
||||
if(!isAnimationing()){
|
||||
endAnimation()
|
||||
return floatArrayOf(startZoomVal,startLookAngle,startEyeHeight)
|
||||
}
|
||||
|
||||
var eyeHeight = 0f
|
||||
var angle = 0f
|
||||
var zoomVal = 0f
|
||||
var factor = ((System.currentTimeMillis() - startTime) / duration.toFloat())
|
||||
|
||||
if( factor >=1){
|
||||
endAnimation()
|
||||
return floatArrayOf(startZoomVal, startLookAngle,startEyeHeight)
|
||||
}else{
|
||||
eyeHeight = startEyeHeight + factor * (endEyeHeight!! - startEyeHeight)
|
||||
angle = startLookAngle + factor * (endLookAngle!! - startLookAngle)
|
||||
zoomVal = startZoomVal + factor * (endZoomVal!! - startZoomVal)
|
||||
}
|
||||
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.d(TAG, "angle: ${angle}, height: ${eyeHeight}, zoomVal: ${zoomVal}")
|
||||
}
|
||||
return floatArrayOf(zoomVal,angle,eyeHeight)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
package com.zhidaoauto.map.sdk.inner.map
|
||||
|
||||
import android.graphics.Point
|
||||
import com.zhidaoauto.map.sdk.open.camera.CameraPosition
|
||||
import com.zhidaoauto.map.sdk.open.camera.LatLngBounds
|
||||
import com.zhidaoauto.map.sdk.open.camera.MapCameraMessage
|
||||
import com.zhidaoauto.map.sdk.open.query.LonLatPoint
|
||||
|
||||
class MapCameraMessageImpl private constructor() : MapCameraMessage() {
|
||||
/* private var a: Float = 0.toFloat()
|
||||
private var b: Float = 0.toFloat()
|
||||
private var c: ae? = null*/
|
||||
|
||||
companion object {
|
||||
|
||||
fun createNewInstance(): MapCameraMessageImpl {
|
||||
return MapCameraMessageImpl()
|
||||
}
|
||||
|
||||
fun createZoomInInstance(): MapCameraMessageImpl {
|
||||
val instance = createNewInstance()
|
||||
instance.nowType = Type.zoomIn
|
||||
return instance
|
||||
}
|
||||
|
||||
fun createZoomOutInstance(): MapCameraMessageImpl {
|
||||
val instance = createNewInstance()
|
||||
instance.nowType = Type.zoomOut
|
||||
return instance
|
||||
}
|
||||
|
||||
fun createNewInstance(xPixel: Float, yPixel: Float): MapCameraMessageImpl {
|
||||
val instance = createNewInstance()
|
||||
instance.nowType = Type.scrollBy
|
||||
instance.xPixel = xPixel
|
||||
instance.yPixel = yPixel
|
||||
return instance
|
||||
}
|
||||
|
||||
fun createNewInstance(zoom: Float): MapCameraMessageImpl {
|
||||
val instance = createNewInstance()
|
||||
instance.nowType = Type.zoomTo
|
||||
instance.zoom = zoom
|
||||
return instance
|
||||
}
|
||||
|
||||
fun createAmountInstance(amount: Float): MapCameraMessageImpl {
|
||||
return createNewInstance(amount, null as Point?)
|
||||
}
|
||||
|
||||
fun createNewInstance(amount: Float, point: Point?): MapCameraMessageImpl {
|
||||
val instance = createNewInstance()
|
||||
instance.nowType = Type.zoomBy
|
||||
instance.amount = amount
|
||||
instance.focus = point
|
||||
return instance
|
||||
}
|
||||
|
||||
fun createNewInstance(cameraPosition: CameraPosition?): MapCameraMessageImpl {
|
||||
val instance = createNewInstance()
|
||||
instance.nowType = Type.newCameraPosition
|
||||
instance.cameraPosition = cameraPosition
|
||||
return instance
|
||||
}
|
||||
|
||||
fun createNewInstance(latLng: LonLatPoint): MapCameraMessageImpl {
|
||||
val instance = createNewInstance()
|
||||
instance.nowType = Type.changeCenter
|
||||
instance.cameraPosition =
|
||||
CameraPosition(
|
||||
latLng,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f
|
||||
)
|
||||
return instance
|
||||
}
|
||||
|
||||
fun createInstance(latLng: LonLatPoint): MapCameraMessageImpl? {
|
||||
return createNewInstance(CameraPosition.builder().target(latLng).build())
|
||||
}
|
||||
|
||||
fun createNewInstance(latLng: LonLatPoint, zoomLevel: Float): MapCameraMessageImpl {
|
||||
return createNewInstance(CameraPosition.builder().target(latLng).zoom(zoomLevel).build())
|
||||
}
|
||||
|
||||
fun createNewInstance(
|
||||
latLng: LonLatPoint,
|
||||
zoomLevel: Float,
|
||||
bearing: Float,
|
||||
tilt: Float
|
||||
): MapCameraMessageImpl? {
|
||||
return createNewInstance(
|
||||
CameraPosition.builder().target(latLng).zoom(zoomLevel).bearing(
|
||||
bearing
|
||||
).tilt(tilt).build()
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
fun createNewInstance(latLngBounds: LatLngBounds, padding: Int): MapCameraMessageImpl {
|
||||
val instance = createNewInstance()
|
||||
instance.nowType = Type.newLatLngBounds
|
||||
instance.bounds = latLngBounds
|
||||
instance.paddingLeft = padding
|
||||
instance.paddingRight = padding
|
||||
instance.paddingTop = padding
|
||||
instance.paddingBottom = padding
|
||||
return instance
|
||||
}
|
||||
|
||||
fun createNewInstance(latLngBounds: LatLngBounds, width: Int, height: Int, padding: Int): MapCameraMessageImpl {
|
||||
val instance = createNewInstance()
|
||||
instance.nowType = Type.newLatLngBoundsWithSize
|
||||
instance.bounds = latLngBounds
|
||||
instance.paddingLeft = padding
|
||||
instance.paddingRight = padding
|
||||
instance.paddingTop = padding
|
||||
instance.paddingBottom = padding
|
||||
instance.width = width
|
||||
instance.height = height
|
||||
return instance
|
||||
}
|
||||
|
||||
fun createNewInstance(latLngBounds: LatLngBounds, paddingLeft: Int, paddingRight: Int, paddingTop: Int, paddingBottom: Int): MapCameraMessage {
|
||||
val instance = createNewInstance()
|
||||
instance.nowType = Type.newLatLngBounds
|
||||
instance.bounds = latLngBounds
|
||||
instance.paddingLeft = paddingLeft
|
||||
instance.paddingRight = paddingRight
|
||||
instance.paddingTop = paddingTop
|
||||
instance.paddingBottom = paddingBottom
|
||||
return instance
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,59 @@
|
||||
package com.zhidaoauto.map.sdk.inner.map
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.zhidaoauto.map.sdk.inner.CompileConfig
|
||||
import com.zhidaoauto.map.sdk.inner.common.ConstantExt
|
||||
import com.zhidaoauto.map.sdk.inner.controller.CommonController
|
||||
import com.zhidaoauto.map.sdk.inner.utils.FileUtils
|
||||
import com.zhidaoauto.map.sdk.inner.utils.SharedPrefsMgr
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.launch
|
||||
import java.io.File
|
||||
|
||||
object MapDataHelper {
|
||||
|
||||
|
||||
private val TAG = javaClass.simpleName
|
||||
|
||||
//更新数据时版本+1
|
||||
val currentDataVersion = 5
|
||||
|
||||
private var deleteJob:Job? = null
|
||||
|
||||
fun updateData(context: Context, dir: String) {
|
||||
val oldVersion = SharedPrefsMgr.getInstance(context).getInt(ConstantExt.SHARED_KEY_DATA_VERSION, 0)
|
||||
if (oldVersion < currentDataVersion) {
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG,"dataop--delete old verion ${oldVersion} for update version ${currentDataVersion}")
|
||||
}
|
||||
SharedPrefsMgr.getInstance(context).putInt(ConstantExt.SHARED_KEY_DATA_VERSION, currentDataVersion)
|
||||
deleteDataDir(dir)
|
||||
}
|
||||
}
|
||||
|
||||
private fun deleteDataDir(dir: String) {
|
||||
deleteJob?.cancel()
|
||||
deleteJob = CommonController.instance.scope?.launch(Dispatchers.IO) {
|
||||
val fileOld = File(dir)
|
||||
val fileNew = File("${dir}_temp")
|
||||
try {
|
||||
val result = fileOld.renameTo(fileNew)
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG,"dataop--rename ${fileOld.absolutePath} delete ${fileNew.absolutePath} ,result:${result}")
|
||||
}
|
||||
}catch (e:Exception){
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.e(TAG,"dataop--exception",e)
|
||||
}
|
||||
}
|
||||
FileUtils.deleteDirectory(fileNew.absolutePath)
|
||||
}
|
||||
}
|
||||
|
||||
fun exit(){
|
||||
deleteJob?.cancel()
|
||||
deleteJob = null
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.zhidaoauto.map.sdk.inner.map
|
||||
|
||||
import android.content.Context
|
||||
import android.content.res.AssetManager
|
||||
import android.util.Log
|
||||
import com.autonavi.nge.dm.SharedMemoryService
|
||||
import com.zhidaoauto.map.sdk.inner.CompileConfig
|
||||
import com.zhidaoauto.map.sdk.inner.common.ConstantExt
|
||||
import com.zhidaoauto.map.sdk.inner.controller.CommonController
|
||||
import com.zhidaoauto.map.sdk.inner.utils.FileUtils
|
||||
import com.zhidaoauto.map.sdk.inner.utils.SharedPrefsMgr
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.launch
|
||||
import java.io.File
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
|
||||
object MapHdDataHelper {
|
||||
|
||||
private val TAG = javaClass.simpleName
|
||||
|
||||
//更新样式时版本+1
|
||||
val currentDataVersion = 61
|
||||
|
||||
private var initJob:Job? = null
|
||||
private var copyJob:Job? = null
|
||||
private var context:Context? = null
|
||||
|
||||
var loadDataOver:AtomicBoolean = AtomicBoolean(false)
|
||||
|
||||
private fun updateData(context: Context, dir: String) {
|
||||
val oldVersion = SharedPrefsMgr.getInstance(context).getInt(ConstantExt.SHARED_KEY_HDDATA_VERSION, 0)
|
||||
if (oldVersion < currentDataVersion) {
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG,"hdmapop--delete old verion ${oldVersion} for update version ${currentDataVersion}")
|
||||
}
|
||||
FileUtils.deleteDirectory(dir)
|
||||
}
|
||||
}
|
||||
|
||||
fun copyAssetsToSdcard(context: Context, assetDir: String, dir: String) {
|
||||
val assetManager = context.resources.assets
|
||||
copyJob?.cancel()
|
||||
copyJob = CommonController.instance.scope?.launch(Dispatchers.IO) {
|
||||
updateData(context, dir)
|
||||
val file = File(dir)
|
||||
if (file.isDirectory && file.list() != null && file.list().size > 1) {
|
||||
if(FileUtils.isSameFiles(assetManager, assetDir, dir)) {
|
||||
loadDataOver.set(true)
|
||||
return@launch
|
||||
}else{
|
||||
FileUtils.deleteDirectory(dir)
|
||||
}
|
||||
|
||||
}
|
||||
dealAssetsToSdcard(context, assetManager, assetDir, dir)
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun dealAssetsToSdcard(context: Context, assetManager : AssetManager, assetDir: String, dir: String){
|
||||
SharedPrefsMgr.getInstance(context).putInt(ConstantExt.SHARED_KEY_HDDATA_VERSION, currentDataVersion)
|
||||
val start = System.currentTimeMillis()
|
||||
var result = FileUtils.copyDirect(assetManager, assetDir, dir)
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG,"hdmapop-assetop-copy to ${dir} cost:${System.currentTimeMillis()-start}ms")
|
||||
}
|
||||
if(!result){
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG,"hdmapop --assetop-copy fail")
|
||||
}
|
||||
FileUtils.deleteDirectory(dir)
|
||||
result = FileUtils.copyDirect(assetManager, assetDir, dir)
|
||||
loadDataOver.set(true)
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG,"hdmapop --assetop-second-copy result:${result}")
|
||||
}
|
||||
}else{
|
||||
loadDataOver.set(true)
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG,"hdmapop --assetop-copy success")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun initDataMgr(context: Context){
|
||||
initJob?.cancel()
|
||||
this.context = context
|
||||
initJob = CommonController.instance.scope?.launch(Dispatchers.IO) {
|
||||
SharedMemoryService.getInstance(context)
|
||||
loadDataOver.set(true)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun exit(){
|
||||
initJob?.cancel()
|
||||
initJob = null
|
||||
copyJob?.cancel()
|
||||
copyJob = null
|
||||
SharedMemoryService.getInstance(context).exit()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.zhidaoauto.map.sdk.inner.map
|
||||
|
||||
import android.content.Context
|
||||
import android.content.res.AssetManager
|
||||
import android.util.Log
|
||||
import com.zhidaoauto.map.sdk.inner.CompileConfig
|
||||
import com.zhidaoauto.map.sdk.inner.common.ConstantExt
|
||||
import com.zhidaoauto.map.sdk.inner.controller.CommonController
|
||||
import com.zhidaoauto.map.sdk.inner.utils.FileUtils
|
||||
import com.zhidaoauto.map.sdk.inner.utils.SharedPrefsMgr
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.launch
|
||||
import java.io.File
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
|
||||
object MapStyleHelper {
|
||||
|
||||
private val TAG = javaClass.simpleName
|
||||
|
||||
//更新样式时版本+1
|
||||
val currentStyleVersion = 65
|
||||
|
||||
private var copyJob:Job? = null
|
||||
|
||||
var loadStyleOver:AtomicBoolean = AtomicBoolean(false)
|
||||
|
||||
private fun updateStyle(context: Context, dir: String) {
|
||||
val oldVersion = SharedPrefsMgr.getInstance(context).getInt(ConstantExt.SHARED_KEY_STYLE_VERSION, 0)
|
||||
if (oldVersion < currentStyleVersion) {
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG,"styleop--delete old verion ${oldVersion} for update version ${currentStyleVersion}")
|
||||
}
|
||||
FileUtils.deleteDirectory(dir)
|
||||
}
|
||||
}
|
||||
|
||||
fun copyAssetsToSdcard(context: Context, assetDir: String, dir: String) {
|
||||
|
||||
val assetManager = context.resources.assets
|
||||
copyJob?.cancel()
|
||||
copyJob = CommonController.instance.scope?.launch(Dispatchers.IO) {
|
||||
updateStyle(context, dir)
|
||||
val file = File(dir)
|
||||
if (file.isDirectory && file.list() != null && file.list().size > 1) {
|
||||
if(FileUtils.isSameFiles(assetManager, assetDir, dir)) {
|
||||
loadStyleOver.set(true)
|
||||
return@launch
|
||||
}else{
|
||||
FileUtils.deleteDirectory(dir)
|
||||
}
|
||||
}
|
||||
dealAssetsToSdcard(context, assetManager, assetDir, dir)
|
||||
}
|
||||
}
|
||||
|
||||
private fun dealAssetsToSdcard(context: Context, assetManager :AssetManager,assetDir: String, dir: String){
|
||||
SharedPrefsMgr.getInstance(context).putInt(ConstantExt.SHARED_KEY_STYLE_VERSION, currentStyleVersion)
|
||||
val start = System.currentTimeMillis()
|
||||
var result = FileUtils.copyDirect(assetManager, assetDir, dir)
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG,"styleop-assetop-copy to ${dir} cost:${System.currentTimeMillis()-start}ms")
|
||||
}
|
||||
if(!result){
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG,"styleop --assetop-copy fail")
|
||||
}
|
||||
FileUtils.deleteDirectory(dir)
|
||||
result = FileUtils.copyDirect(assetManager, assetDir, dir)
|
||||
loadStyleOver.set(true)
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG,"styleop --assetop-second-copy result:${result}")
|
||||
}
|
||||
}else{
|
||||
loadStyleOver.set(true)
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG,"styleop --assetop-copy success")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun exit(){
|
||||
copyJob?.cancel()
|
||||
copyJob = null
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.zhidaoauto.map.sdk.inner.map;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
|
||||
import com.zhidaoauto.map.sdk.inner.abs.IMapController;
|
||||
import com.zhidaoauto.map.sdk.open.abs.MapStatusListener;
|
||||
|
||||
|
||||
public class MapZoomAdjuster implements MapStatusListener {
|
||||
|
||||
private static final int NAVMODE = 3;
|
||||
private static final int NAVZOOMLEVEL = 19;
|
||||
|
||||
private static final int MSG_ZOOM_CHANGED = 1;
|
||||
|
||||
private IMapController mMapCtrl = null;
|
||||
private int mMapMode = 0;
|
||||
private boolean mFollowCarMode = false;
|
||||
|
||||
public MapZoomAdjuster(Context context, IMapController controller) {
|
||||
mMapCtrl = controller;
|
||||
mMapCtrl.getEventController().addMapStatusListener(this, MapController.LISTENER_TYPE_ZOOM);
|
||||
}
|
||||
|
||||
void setMapStyle(int stylemode) {
|
||||
mMapMode = stylemode;
|
||||
if (mMapMode >= NAVMODE) {
|
||||
cancelAdjustZoomChange();
|
||||
}
|
||||
}
|
||||
|
||||
void setFollowCarMode(boolean followCarMode) {
|
||||
mFollowCarMode = followCarMode;
|
||||
if (true == followCarMode) {
|
||||
adjustZoomChange(mMapCtrl.getZoom(), 5);
|
||||
} else {
|
||||
cancelAdjustZoomChange();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapStatusChanged(int type, int value) {
|
||||
|
||||
if (MapController.LISTENER_TYPE_ZOOM == type) {
|
||||
adjustZoomChange(value, 10);
|
||||
}
|
||||
}
|
||||
|
||||
void adjustZoomChange(int value, int delaysecond) {
|
||||
if (mMapMode >= NAVMODE && true == mFollowCarMode && value != NAVZOOMLEVEL) {
|
||||
cancelAdjustZoomChange();
|
||||
mNaviControllerHandler.sendEmptyMessageDelayed(MSG_ZOOM_CHANGED, 1000*delaysecond); /* delay 10s */
|
||||
}
|
||||
}
|
||||
|
||||
void cancelAdjustZoomChange() {
|
||||
mNaviControllerHandler.removeMessages(MSG_ZOOM_CHANGED);
|
||||
}
|
||||
|
||||
|
||||
private Handler mNaviControllerHandler = new Handler() {
|
||||
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
|
||||
switch(msg.what) {
|
||||
case MSG_ZOOM_CHANGED:
|
||||
if (null != mMapCtrl) {
|
||||
mMapCtrl.setZoom(NAVZOOMLEVEL);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.zhidaoauto.map.sdk.inner.marker
|
||||
|
||||
interface IInfoViewClick {
|
||||
fun click()
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.zhidaoauto.map.sdk.inner.marker
|
||||
|
||||
import com.zhidaoauto.map.sdk.open.abs.marker.InfoWindowAdapter
|
||||
|
||||
class MarkerAdapterManager {
|
||||
|
||||
var mInfoWindowAdapter:InfoWindowAdapter? = null
|
||||
|
||||
private constructor(){
|
||||
|
||||
}
|
||||
|
||||
companion object {
|
||||
var mInstance: MarkerAdapterManager? = null
|
||||
fun getInstance(): MarkerAdapterManager {
|
||||
if (mInstance == null) {
|
||||
synchronized(MarkerAdapterManager::class.java) {
|
||||
if (mInstance == null) {
|
||||
mInstance = MarkerAdapterManager()
|
||||
}
|
||||
}
|
||||
}
|
||||
return mInstance!!
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.zhidaoauto.map.sdk.inner.marker
|
||||
|
||||
import android.graphics.Rect
|
||||
|
||||
class MarkerInfoViewClickController {
|
||||
private val TAG = javaClass.simpleName
|
||||
|
||||
private constructor() {
|
||||
|
||||
}
|
||||
|
||||
companion object {
|
||||
val instance by lazy { MarkerInfoViewClickController() }
|
||||
}
|
||||
|
||||
private val infoViewClickMap = HashMap<String, HashMap<Rect, IInfoViewClick>>()
|
||||
|
||||
fun add(markerId: String, rect: Rect, iInfoViewClick: IInfoViewClick) {
|
||||
var map: HashMap<Rect, IInfoViewClick>?
|
||||
if (infoViewClickMap.containsKey(markerId)) {
|
||||
map = infoViewClickMap.get(markerId)
|
||||
} else {
|
||||
map = HashMap<Rect, IInfoViewClick>()
|
||||
}
|
||||
map?.let {
|
||||
it.put(rect, iInfoViewClick)
|
||||
infoViewClickMap.put(markerId, it)
|
||||
}
|
||||
}
|
||||
|
||||
fun get(markerId: String): HashMap<Rect, IInfoViewClick>? {
|
||||
return infoViewClickMap.get(markerId)
|
||||
}
|
||||
|
||||
fun remove(markerId: String) {
|
||||
infoViewClickMap.remove(markerId)
|
||||
}
|
||||
|
||||
fun clear() {
|
||||
infoViewClickMap.clear()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,761 @@
|
||||
package com.zhidaoauto.map.sdk.inner.marker
|
||||
|
||||
import android.graphics.Rect
|
||||
import android.text.TextUtils
|
||||
import android.util.Log
|
||||
import com.alibaba.fastjson.JSON
|
||||
import com.autonavi.nge.map.LonLat
|
||||
import com.zhidaoauto.map.sdk.inner.CompileConfig
|
||||
import com.zhidaoauto.map.sdk.inner.CompileConfig.DEBUG
|
||||
import com.zhidaoauto.map.sdk.inner.abs.IMapController
|
||||
import com.zhidaoauto.map.sdk.inner.abs.IMarkerCall
|
||||
import com.zhidaoauto.map.sdk.open.abs.marker.OnMarkerDragListener
|
||||
import com.zhidaoauto.map.sdk.open.marker.*
|
||||
import com.zhidaoauto.map.sdk.open.query.LonLatPoint
|
||||
import com.zhidaoauto.map.sdk.open.tools.MD5Utils
|
||||
import com.zhidaoauto.map.sdk.open.tools.MapTools
|
||||
import io.netty.buffer.Unpooled
|
||||
import java.nio.charset.Charset
|
||||
import java.util.*
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
class MarkerNativeInterface(private val mMapController: IMapController): IMarkerCall {
|
||||
|
||||
private val TAG = "MarkerNativeInterface"
|
||||
|
||||
|
||||
private val markerIconList = ArrayList<String>()
|
||||
private val markClickListenerMap: MutableMap<String, OnMarkClickListener> = HashMap()
|
||||
private val infoWindowClickListenerMap: MutableMap<String, OnInfoWindowClickListener> = HashMap<String, OnInfoWindowClickListener>()
|
||||
private val animationListenerMap: MutableMap<String, OnAnimationListener> = HashMap<String, OnAnimationListener>()
|
||||
private val markDragListenerMap: MutableMap<String, OnMarkerDragListener> = HashMap()
|
||||
private val markerIconCacheMap = HashMap<Int,String>()
|
||||
private val markerInfoCacheMap = ConcurrentHashMap<String,String>()
|
||||
|
||||
//点击infoview区域
|
||||
private val infoViewClickMap = HashMap<String, HashMap<Rect, IInfoViewClick>>()
|
||||
|
||||
override fun exit(){
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG,"markerop--MarkerNativeInterface:exit")
|
||||
}
|
||||
markerIconList.clear()
|
||||
markClickListenerMap.clear()
|
||||
infoWindowClickListenerMap.clear()
|
||||
animationListenerMap.clear()
|
||||
markDragListenerMap.clear()
|
||||
markerIconCacheMap.clear()
|
||||
markerInfoCacheMap.clear()
|
||||
infoViewClickMap.clear()
|
||||
}
|
||||
|
||||
override fun addInfoViewClick(markerId: String, rect: Rect, iInfoViewClick: IInfoViewClick) {
|
||||
var map: HashMap<Rect, IInfoViewClick>?
|
||||
if (infoViewClickMap.containsKey(markerId)) {
|
||||
map = infoViewClickMap.get(markerId)
|
||||
} else {
|
||||
map = HashMap<Rect, IInfoViewClick>()
|
||||
}
|
||||
map?.let {
|
||||
it.put(rect, iInfoViewClick)
|
||||
infoViewClickMap.put(markerId, it)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getInfoViewClick(markerId: String): HashMap<Rect, IInfoViewClick>? {
|
||||
return infoViewClickMap.get(markerId)
|
||||
}
|
||||
|
||||
override fun removeInfoViewClick(markerId: String) {
|
||||
infoViewClickMap.remove(markerId)
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
override fun addMarkerIcon(icon:String):Boolean{
|
||||
return markerIconList.add(icon)
|
||||
}
|
||||
|
||||
override fun containMarkerIconCache(id: Int): Boolean {
|
||||
return markerIconCacheMap.containsKey(id)
|
||||
}
|
||||
|
||||
override fun removeMarkerIconCache(id: Int) {
|
||||
markerIconCacheMap.remove(id)
|
||||
}
|
||||
|
||||
override fun addMarkerIconCache(id: Int, icon: String) {
|
||||
markerIconCacheMap.put(id,icon)
|
||||
}
|
||||
|
||||
override fun getMarkerIconCache(id:Int):String?{
|
||||
return markerIconCacheMap.get(id)
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
override fun removeMarkerIcon(icon:String?):Boolean{
|
||||
return markerIconList.remove(icon)
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
override fun containMarkerIcon(icon:String?):Boolean{
|
||||
return markerIconList.contains(icon)
|
||||
}
|
||||
/**
|
||||
* 清除所有marker
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
fun clearAllMarkers(): Boolean? {
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG,"markerop--clearAllMarkers:")
|
||||
}
|
||||
// CommonController.instance.scope?.launch(Dispatchers.Main) {
|
||||
val isSuccess = mMapController.clearAllAnchors()
|
||||
refreshMap()
|
||||
// }
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置infowindow的title值
|
||||
*
|
||||
* @param id
|
||||
* @param title
|
||||
*/
|
||||
fun setTitle(id: String?, title: String?) {
|
||||
|
||||
updateMarkerProperty(id!!, "title", title!!)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取infowindow的标题
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
fun getTitle(id: String?): String {
|
||||
return getMarkerProperty(id!!, "title")?:""
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置infowindow的内容
|
||||
*
|
||||
* @param id
|
||||
* @param snippet
|
||||
*/
|
||||
fun setSnippet(id: String?, snippet: String?) {
|
||||
updateMarkerProperty(id!!, "snippet", snippet!!)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取infowindow属性snippet的值
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
fun getSnippet(id: String?): String {
|
||||
return getMarkerProperty(id!!, "snippet")?:""
|
||||
}
|
||||
|
||||
fun isAnchorDynamicMoving(id: String): Boolean {
|
||||
return mMapController.isAnchorDynamicMoving(id)?:false
|
||||
}
|
||||
|
||||
/**
|
||||
* 更换marker的图片
|
||||
*
|
||||
* @param id
|
||||
* @param bitmapDescriptor
|
||||
*/
|
||||
fun setIcon(id: String?, bitmapDescriptor: BitmapDescriptor) {
|
||||
val markerBytes = bitmapDescriptor.getBytes()
|
||||
if(markerBytes.size == 0){
|
||||
return
|
||||
}
|
||||
MD5Utils.getInstanse()
|
||||
val markerIconName = MD5Utils.getMD5String(markerBytes)
|
||||
//缓存图片
|
||||
if (!containMarkerIcon(markerIconName)) {
|
||||
if(DEBUG){
|
||||
Log.i(TAG,"markerop--setIcon--addImagetoImageManager:${markerIconName}")
|
||||
}
|
||||
|
||||
val result = mMapController.addImage(
|
||||
markerIconName,
|
||||
markerBytes,
|
||||
bitmapDescriptor.width,
|
||||
bitmapDescriptor.height
|
||||
) ?:-1
|
||||
if(result ==0 ){
|
||||
addMarkerIcon( markerIconName)
|
||||
}
|
||||
}
|
||||
// CommonController.instance.scope?.launch(Dispatchers.Main) {
|
||||
mMapController.updateAnchorWithBitmap(id!!, markerIconName)
|
||||
refreshMap()
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置marker的水平和垂直范围的比例
|
||||
*
|
||||
* @param id
|
||||
* @param anchorU
|
||||
* @param anchorV
|
||||
*/
|
||||
fun setAnchor(id: String?, anchorU: Float, anchorV: Float) {
|
||||
updateMarkerProperty(id!!, "anchorUV", "${anchorU},${anchorV}" )
|
||||
refreshMap()
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置marker的位置(经纬度)
|
||||
*
|
||||
* @param id
|
||||
* @param latitude
|
||||
* @param longitude
|
||||
* @return
|
||||
*/
|
||||
fun setPosition(id: String?, latitude: Double, longitude: Double): Boolean {
|
||||
if (DEBUG) {
|
||||
Log.i(TAG, "autoop-markerop--setPosition: ${id},$latitude,$longitude")
|
||||
}
|
||||
val isSuccess = updateMarkerProperty(id!!, "lonLatPoint", "$longitude,$latitude")
|
||||
refreshMap()
|
||||
return isSuccess?:false
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置marker的上诉缩放
|
||||
*
|
||||
* @param id
|
||||
* @param latitude
|
||||
* @param longitude
|
||||
* @return
|
||||
*/
|
||||
fun setScale(id: String?, scale: Float): Boolean {
|
||||
if (DEBUG) {
|
||||
Log.i(TAG, "autoop-markerop--setScale: ${id},$scale")
|
||||
}
|
||||
val isSuccess = updateMarkerProperty(id!!, "scale", "$scale")
|
||||
refreshMap()
|
||||
return isSuccess?:false
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取marker的经纬度
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
fun getPosition(id: String?): LonLat? {
|
||||
val lonlstStr = getMarkerProperty(id!!, "lonLatPoint")
|
||||
val lonlat = lonlstStr?.split(",")?.toTypedArray()
|
||||
lonlat?.let{
|
||||
return LonLat(lonlat[0].toDouble(), lonlat[1].toDouble())
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除marker
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
fun removeMarker(id: String?): Boolean {
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG,"markerop--removeMarker:${id}")
|
||||
}
|
||||
mMapController.removeAnchor(id!!)
|
||||
refreshMap()
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* infowindow是否显示
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
fun isInfoWindowShown(id: String?): Boolean {
|
||||
val isInfoWindowShown = getMarkerProperty(id!!, "isInfoWindowShown")
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG,"markerop--isInfoWindowShown:${isInfoWindowShown}")
|
||||
}
|
||||
return isInfoWindowShown?.toBoolean()?:false
|
||||
}
|
||||
|
||||
fun setInfoWindowShown(id: String?,flag:Boolean):Boolean{
|
||||
val isSuccess = updateMarkerProperty(id!!, "isInfoWindowShown", "$flag")
|
||||
refreshMap()
|
||||
return isSuccess?:false
|
||||
}
|
||||
|
||||
fun setInfoWindowEnabled(id: String?,flag:Boolean):Boolean{
|
||||
val isSuccess = updateMarkerProperty(id!!, "infoWindowEnabled", "$flag")
|
||||
refreshMap()
|
||||
return isSuccess?:false
|
||||
}
|
||||
|
||||
/**
|
||||
* infowindow是否可以显示
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
fun isInfoWindowEnabled(id: String?): Boolean {
|
||||
val infoWindowEnabled = getMarkerProperty(id!!, "infoWindowEnabled")
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG,"markerop--infoWindowEnabled:${infoWindowEnabled}")
|
||||
}
|
||||
return infoWindowEnabled?.toBoolean()?:false
|
||||
}
|
||||
|
||||
fun setVisible(id: String?, visible: Boolean) {
|
||||
updateMarkerProperty(id!!, "visible",visible.toString())
|
||||
refreshMap()
|
||||
}
|
||||
|
||||
fun isVisible(id: String?): Boolean {
|
||||
return getMarkerProperty(id!!, "visible")?.toBoolean()?:false
|
||||
}
|
||||
|
||||
fun setRotateAngle(id: String?, rotateAngle: Float) {
|
||||
updateMarkerProperty(id!!, "rotateAngle", rotateAngle.toString())
|
||||
refreshMap()
|
||||
}
|
||||
|
||||
fun getRoateAngle(id: String?): Float {
|
||||
val rotateAngle = getMarkerProperty(id!!, "rotateAngle")
|
||||
return java.lang.Float.valueOf(rotateAngle)
|
||||
}
|
||||
|
||||
fun getDraggable(id: String?): Boolean {
|
||||
val draggable = getMarkerProperty(id!!, "draggable")
|
||||
return draggable!!.toBoolean()
|
||||
}
|
||||
|
||||
fun setPeriod(id: String?, period: Int) {
|
||||
updateMarkerProperty(id!!, "period", period.toString())
|
||||
}
|
||||
|
||||
fun getPeriod(id: String?): Int {
|
||||
val period = getMarkerProperty(id!!, "period")
|
||||
return period!!.toInt()
|
||||
}
|
||||
|
||||
fun showInfoWindow(id: String?) {
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG,"markerop--showInfoWindow:${id}")
|
||||
}
|
||||
mMapController.showInfoWindow(id!!)
|
||||
refreshMap()
|
||||
}
|
||||
|
||||
fun hideInfoWindow(id: String?) {
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG,"markerop--hideInfoWindow:${id}")
|
||||
}
|
||||
mMapController.hideInfoWindow(id!!)
|
||||
refreshMap()
|
||||
}
|
||||
|
||||
fun setInfoWindowIcon(id: String?, markerInfoName: String) {
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG,"markerop--setInfoWindowIcon:${id}")
|
||||
}
|
||||
updateMarkerProperty(id!!, "markerInfoName", markerInfoName)
|
||||
// CommonController.instance.mapView?.updateInfoWindowWithBitMap(id!!, bitmapDescriptor.getBytes(), bitmapDescriptor.width, bitmapDescriptor.height)
|
||||
showInfoWindow(id)
|
||||
refreshMap()
|
||||
}
|
||||
|
||||
private fun getMarkerProperty(id:String,propertyName:String):String{
|
||||
return mMapController.getAnchorProperty(id,propertyName)?:""
|
||||
}
|
||||
|
||||
private fun updateMarkerProperty(id:String,propertyName:String,value:String):Boolean{
|
||||
val flag = mMapController.updateAnchorProperty(id,propertyName,value)
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG,"markerop--updateMarkerProperty:${id},${propertyName},${value},result:${flag}")
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
fun clear(): Boolean {
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG,"markerop--clear clearAllAluster --clearAllMarkers:")
|
||||
}
|
||||
// CommonController.instance.scope?.launch(Dispatchers.Main) {
|
||||
val isSuccess = mMapController.clearAllAnchors()
|
||||
mMapController.clearAllCluster()
|
||||
refreshMap()
|
||||
|
||||
// }
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
|
||||
override fun getAnimationListener(markerID: String): OnAnimationListener? {
|
||||
if (animationListenerMap == null || animationListenerMap.size == 0) {
|
||||
return null
|
||||
}
|
||||
for (id in animationListenerMap.keys) {
|
||||
if (TextUtils.equals(id, markerID)) {
|
||||
return animationListenerMap[markerID]
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
override fun addAnimationListener(markerID: String, onAnimationListener: OnAnimationListener?) {
|
||||
if(onAnimationListener == null){
|
||||
animationListenerMap.remove(markerID)
|
||||
}else{
|
||||
animationListenerMap[markerID] = onAnimationListener
|
||||
}
|
||||
}
|
||||
|
||||
override fun getInfoWindowClickListener(markerID: String): OnInfoWindowClickListener? {
|
||||
if (infoWindowClickListenerMap == null || infoWindowClickListenerMap.size == 0) {
|
||||
return null
|
||||
}
|
||||
for (id in infoWindowClickListenerMap.keys) {
|
||||
if (TextUtils.equals(id, markerID)) {
|
||||
return infoWindowClickListenerMap[markerID]
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
override fun addInfoWindowClickListener(markerID: String, onInfoWindowClickListener: OnInfoWindowClickListener?) {
|
||||
if(onInfoWindowClickListener == null){
|
||||
infoWindowClickListenerMap.remove(markerID)
|
||||
}else{
|
||||
infoWindowClickListenerMap[markerID] = onInfoWindowClickListener
|
||||
}
|
||||
}
|
||||
|
||||
override fun addMarkClickListener(markerID: String, onMarkClickListener: OnMarkClickListener?) {
|
||||
if(onMarkClickListener == null){
|
||||
markClickListenerMap.remove(markerID)
|
||||
}else{
|
||||
markClickListenerMap[markerID] = onMarkClickListener
|
||||
}
|
||||
}
|
||||
|
||||
override fun addMarkDragListener(markerID: String, onMarkerDragListener: OnMarkerDragListener?) {
|
||||
if(onMarkerDragListener == null){
|
||||
markDragListenerMap.remove(markerID)
|
||||
}else{
|
||||
markDragListenerMap[markerID] = onMarkerDragListener
|
||||
}
|
||||
}
|
||||
|
||||
override fun getMarkDragListener(markerID: String): OnMarkerDragListener?{
|
||||
if (markDragListenerMap == null || markDragListenerMap.size == 0) {
|
||||
return null
|
||||
}
|
||||
for (id in markDragListenerMap.keys) {
|
||||
if (TextUtils.equals(id, markerID)) {
|
||||
return markDragListenerMap[markerID]
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
override fun getMarkClickListener(markerID: String): OnMarkClickListener? {
|
||||
if (markClickListenerMap == null || markClickListenerMap.size == 0) {
|
||||
return null
|
||||
}
|
||||
for (id in markClickListenerMap.keys) {
|
||||
if (TextUtils.equals(id, markerID)) {
|
||||
return markClickListenerMap[markerID]
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
fun setAlpha(id: String?, alpha: Float) {
|
||||
updateMarkerProperty(id!!, "alpha", java.lang.Float.toString(alpha))
|
||||
refreshMap()
|
||||
}
|
||||
|
||||
fun getAlpha(id: String): Float {
|
||||
return java.lang.Float.valueOf(getMarkerProperty(id, "alpha"))
|
||||
}
|
||||
|
||||
fun setClickable(id: String?, clickable: Boolean) {
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG,"markerop--setClickable:${id}")
|
||||
}
|
||||
mMapController.setSomeAnchorCanClickable(id!!, clickable)
|
||||
refreshMap()
|
||||
}
|
||||
|
||||
fun addDynamicAnchorPostion(id: String, points: List<LonLatPoint>,angle:Float, isGps:Boolean,current:Long,duration: Int) {
|
||||
val data = MapTools.listToArray(points,!isGps)
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG,"markerop--addDynamicAnchorPostion:${id},${points},isGps:${isGps},duration:${duration}")
|
||||
}
|
||||
mMapController.addDynamicAnchorPostion(id, data,angle,current, duration)
|
||||
}
|
||||
|
||||
fun addTranslateAnimationToAnchor(id: String, points: DoubleArray, duration: Int) {
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG,"markerop--addTranslateAnimationToAnchor:${id}")
|
||||
}
|
||||
// CommonController.instance.scope?.launch(Dispatchers.Main) {
|
||||
mMapController.addTranslateAnimationToAnchor(id, points, duration)
|
||||
// }
|
||||
}
|
||||
|
||||
fun addScaleAnimationToAnchor(id: String, startScale: Float, endScale: Float, duration: Int) {
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG,"markerop--addScaleAnimationToAnchor:${id}")
|
||||
}
|
||||
// CommonController.instance.scope?.launch(Dispatchers.Main) {
|
||||
mMapController.addScaleAnimationToAnchor(id, startScale, endScale, duration)
|
||||
// }
|
||||
}
|
||||
|
||||
fun addFlashAnimationToAnchorPoint(id: String, images: String, duration: Int){
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG,"markerop--addFlashAnimationToAnchorPoint:${id}")
|
||||
}
|
||||
// CommonController.instance.scope?.launch(Dispatchers.Main) {
|
||||
mMapController.addFlashAnimationToAnchor(id, images, duration)
|
||||
// }
|
||||
}
|
||||
|
||||
fun addRotateAnimationToAnchorPoint(id: String, startAng: Float, endAng: Float, duration: Int){
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG,"markerop--addRotateAnimationToAnchorPoint:${id}")
|
||||
}
|
||||
// CommonController.instance.scope?.launch(Dispatchers.Main) {
|
||||
mMapController.addRotateAnimationToAnchor(id, startAng, endAng, duration)
|
||||
// }
|
||||
}
|
||||
fun startAnimation(id: String) {
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG,"markerop--startAnimation:${id}")
|
||||
}
|
||||
// CommonController.instance.scope?.launch(Dispatchers.Main) {
|
||||
mMapController.startAnimation(id)
|
||||
// }
|
||||
}
|
||||
|
||||
fun endAnimation(id: String) {
|
||||
// CommonController.instance.scope?.launch(Dispatchers.Main) {
|
||||
mMapController.endAnimation(id)
|
||||
// }
|
||||
}
|
||||
|
||||
fun setToTop(id: String) {
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG,"markerop--SetSomeAnchorTop:${id}")
|
||||
}
|
||||
// CommonController.instance.scope?.launch(Dispatchers.Main) {
|
||||
mMapController.setSomeAnchorTop(id)
|
||||
refreshMap()
|
||||
// }
|
||||
}
|
||||
|
||||
fun setZIndex(id: String, zIndex: Int) {
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG,"markerop--setZIndex:${id},${zIndex}")
|
||||
}
|
||||
// CommonController.instance.scope?.launch(Dispatchers.Main) {
|
||||
mMapController.setSomeAnchorZIndex(id, zIndex)
|
||||
refreshMap()
|
||||
// }
|
||||
}
|
||||
|
||||
//设置marker是否可以拖拽
|
||||
fun setDraggable(id: String, draggable: Boolean) {
|
||||
updateMarkerProperty(id!!, "draggable", draggable.toString())
|
||||
}
|
||||
|
||||
//设置marker是否需要指定方向
|
||||
fun setControlAngle(id: String, enable: Boolean) {
|
||||
updateMarkerProperty(id, "controlAngle", java.lang.Boolean.toString(enable))
|
||||
refreshMap()
|
||||
}
|
||||
|
||||
//设置marker 模型顔色
|
||||
fun set3DAnchorColor(id: String, color: String) {
|
||||
updateMarkerProperty(id!!, "anchorColor", color)
|
||||
}
|
||||
|
||||
fun vrIcon(id: String, flag: Boolean) {
|
||||
updateMarkerProperty(id, "vrIcon", java.lang.Boolean.toString(flag))
|
||||
refreshMap()
|
||||
}
|
||||
|
||||
//设置marker是否可以平贴
|
||||
fun setFlat(id: String, flat: Boolean) {
|
||||
updateMarkerProperty(id!!, "flat", flat.toString())
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG,"markerop--setFlat:${id},${flat}")
|
||||
}
|
||||
mMapController.setSomeAnchorFlat(id, flat)
|
||||
}
|
||||
|
||||
|
||||
//设置infowindow的偏移量
|
||||
fun setInfoWindowOffset(id: String, offsetX: Int, offsetY: Int) {
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG,"markerop--setInfoWindowOffset:${id},${offsetX},${offsetY}")
|
||||
}
|
||||
mMapController.setSomeAnchorInfowindowOffset(id, offsetX, offsetY)
|
||||
refreshMap()
|
||||
}
|
||||
|
||||
fun setMarkerOptions(id: String?, markerPtions: MarkerOptions) {
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG,"markerop--setMarkerOptions:${id},${markerPtions}")
|
||||
}
|
||||
mMapController.updateAnchorByJson(id!!, JSON.toJSONString(markerPtions), ByteArray(0), 0, 0)
|
||||
refreshMap()
|
||||
}
|
||||
|
||||
fun setUnTop(id: String) {
|
||||
mMapController.setSomeAnchorUnTop(id)
|
||||
refreshMap()
|
||||
}
|
||||
|
||||
private fun refreshMap() {
|
||||
// val isRefresh = CommonController.instance.mapAutoView?.getLockCar()?:false
|
||||
// if(isRefresh){
|
||||
// CommonController.instance.mapView?.shakeSceneManual()
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
fun addImagetoImageManager(markerIconName: String, markerBytes: ByteArray, width: Int, height: Int ){
|
||||
if (!containMarkerIcon(markerIconName)) {
|
||||
if (CompileConfig.DEBUG) {
|
||||
Log.i(TAG, "markerop--setIcon--addImagetoImageManager:${markerIconName}")
|
||||
}
|
||||
val result = mMapController.addImage(
|
||||
markerIconName,
|
||||
markerBytes,
|
||||
width,
|
||||
height
|
||||
)?:-1
|
||||
if (CompileConfig.DEBUG) {
|
||||
Log.i(TAG, "markerop--setIcon--addImagetoImageManager:${markerIconName},result:${result},threadop:${Thread.currentThread().id}")
|
||||
}
|
||||
if (result == 0) {
|
||||
addMarkerIcon(markerIconName)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* 更新marker资源
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
override fun updateMarkerResource(dataStr:String?) {
|
||||
dataStr?.let {
|
||||
val array = it.split(",")
|
||||
if(array.isEmpty()){
|
||||
return@let
|
||||
}
|
||||
val deleteList:ArrayList<String> = ArrayList<String>()
|
||||
for(id in markerInfoCacheMap.keys){
|
||||
if(!array.contains(id)){
|
||||
deleteList.add(id)
|
||||
}
|
||||
}
|
||||
for(id in deleteList){
|
||||
markerInfoCacheMap.remove(id)
|
||||
}
|
||||
deleteList.clear()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置锚点的动画资源
|
||||
*/
|
||||
fun setMarkerAnimResource(id: String?, resName: String) {
|
||||
mMapController.updateAnchorProperty(id!!, "animAnchorResource", resName)
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置锚点的动画开关
|
||||
*/
|
||||
fun setMarkerDisplayAnimEnable(id: String?, isDisplayAnim: Boolean) {
|
||||
mMapController.updateAnchorProperty(id!!, "isDisplayAnim", "${isDisplayAnim}")
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置锚点的动画停顿帧数
|
||||
*/
|
||||
fun setMarkerAnimWaitFrame(id: String?, animWaitFrame: Int) {
|
||||
mMapController.updateAnchorProperty(id!!, "animWaitFrame", "${animWaitFrame}")
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置锚点的动画类型
|
||||
*/
|
||||
fun setMarkerAnimType(id: String?, animType: Int) {
|
||||
mMapController.updateAnchorProperty(id!!, "animType", "${animType}")
|
||||
}
|
||||
|
||||
fun setMarkerAnchorType(id: String?, anchorType: Int) {
|
||||
mMapController.updateAnchorProperty(id!!, "anchorType", "${anchorType}")
|
||||
}
|
||||
|
||||
fun setMarkerAnchorShadow(id: String?, anchorShadow: Int) {
|
||||
mMapController.updateAnchorProperty(id!!, "anchorShadow", "${anchorShadow}")
|
||||
}
|
||||
|
||||
fun setMarkerColorType(id: String?, colorType: Int) {
|
||||
mMapController.updateAnchorProperty(id!!, "colorType", "${colorType}")
|
||||
}
|
||||
|
||||
fun setMarkerChangerColorTime(id: String?, changerColorTime: Float) {
|
||||
mMapController.updateAnchorProperty(id!!, "changeColorTime", "${changerColorTime}")
|
||||
}
|
||||
|
||||
fun setMarkerChangeColorAngle(id: String?, changeColorAngle: Float) {
|
||||
mMapController.updateAnchorProperty(id!!, "changeColorAngle", "${changeColorAngle}")
|
||||
}
|
||||
|
||||
fun setMarkerFlash(id: String, colorType: Int, color: String, time: Float, angle: Float){
|
||||
mMapController.setAnchorFlash(id, colorType, color, time, angle)
|
||||
}
|
||||
|
||||
val charset = Charset.forName("UTF-8")
|
||||
|
||||
private fun dealMarker(markerPtions: MarkerOptions):ByteArray?{
|
||||
val buffer = Unpooled.buffer()
|
||||
buffer.writeCharSequence(markerPtions.getId(), charset)
|
||||
buffer.writeDouble(markerPtions.getLonLatPoint()!!.lon)
|
||||
buffer.writeDouble(markerPtions.getLonLatPoint()!!.lat)
|
||||
buffer.writeCharSequence(markerPtions.getTitle(), charset)
|
||||
buffer.writeCharSequence(markerPtions.getSnippet(), charset)
|
||||
buffer.writeFloat(markerPtions.getAnchorU())
|
||||
buffer.writeFloat(markerPtions.getAnchorV())
|
||||
buffer.writeBoolean(markerPtions.isVisible())
|
||||
buffer.writeFloat(markerPtions.getRotateAngle())
|
||||
buffer.writeBoolean(markerPtions.isInfoWindowEnable())
|
||||
buffer.writeBoolean(markerPtions.isInfoWindowShown())
|
||||
buffer.writeFloat(markerPtions.getAlpha())
|
||||
buffer.writeInt(markerPtions.getOffectX())
|
||||
buffer.writeInt(markerPtions.getOffectY())
|
||||
buffer.writeInt(markerPtions.period)
|
||||
buffer.writeBoolean(markerPtions.isClickable())
|
||||
buffer.writeInt(markerPtions.getZIndex())
|
||||
buffer.writeCharSequence(markerPtions.getMarkerIconName(),charset)
|
||||
return buffer.array()
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.zhidaoauto.map.sdk.inner.marker
|
||||
|
||||
import android.util.Log
|
||||
import com.zhidaoauto.map.sdk.inner.CompileConfig
|
||||
import java.util.concurrent.CopyOnWriteArrayList
|
||||
import java.util.concurrent.atomic.AtomicLong
|
||||
|
||||
|
||||
class RecycleController {
|
||||
private val TAG = javaClass.simpleName
|
||||
|
||||
public constructor() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private val renderList: HashSet<String> = HashSet<String>()
|
||||
private val recycleList: CopyOnWriteArrayList<String> = CopyOnWriteArrayList<String>()
|
||||
|
||||
private val idStart:AtomicLong = AtomicLong(99999999)
|
||||
|
||||
fun addRecycle(markerId: String) {
|
||||
if(!recycleList.contains(markerId)){
|
||||
recycleList.add(markerId)
|
||||
}
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG, "RecycleController--addRecycle: ${markerId},total:${recycleList.size}")
|
||||
}
|
||||
}
|
||||
|
||||
fun getRecycle(): String {
|
||||
var id =""
|
||||
if(recycleList.isEmpty()){
|
||||
// id = UUID.randomUUID().toString().replace("-","")
|
||||
id = idStart.addAndGet(1).toString()
|
||||
}else{
|
||||
id = recycleList.removeAt(0)
|
||||
if(id.isEmpty()){
|
||||
// id = UUID.randomUUID().toString().replace("-","")
|
||||
id = idStart.addAndGet(1).toString()
|
||||
}
|
||||
}
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG, "RecycleController--getRecycle: ${id},total:${recycleList.size}")
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
fun addRender(markerId: String){
|
||||
renderList.add(markerId)
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG, "RecycleController--addRender: ${markerId},total:${renderList.size}")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun removeRender(markerId: String){
|
||||
renderList.remove(markerId)
|
||||
if(CompileConfig.DEBUG){
|
||||
Log.i(TAG, "RecycleController--removeRender: ${markerId},total:${renderList.size}")
|
||||
}
|
||||
}
|
||||
|
||||
fun clear() {
|
||||
idStart.set(1)
|
||||
renderList.clear()
|
||||
recycleList.clear()
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,83 @@
|
||||
package com.zhidaoauto.map.sdk.inner.obj;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.autonavi.nge.obj.SubCategory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Category implements Parcelable{
|
||||
|
||||
public static final Creator<com.autonavi.nge.obj.Category> CREATOR = new Creator<com.autonavi.nge.obj.Category>() {
|
||||
public com.autonavi.nge.obj.Category createFromParcel(Parcel in) {
|
||||
com.autonavi.nge.obj.Category category = new com.autonavi.nge.obj.Category();
|
||||
category.setCatName(in.readString());
|
||||
category.setKindId(in.readInt());
|
||||
category.setSubCategory(in.readArrayList(SubCategory.class.getClassLoader()));
|
||||
category.setSubNum(in.readInt());
|
||||
return category;
|
||||
}
|
||||
|
||||
public com.autonavi.nge.obj.Category[] newArray(int size) {
|
||||
return new com.autonavi.nge.obj.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,30 @@
|
||||
package com.zhidaoauto.map.sdk.inner.obj;
|
||||
|
||||
/**
|
||||
* 坐标基类
|
||||
*/
|
||||
public class Coordinate {
|
||||
private double x;
|
||||
private double y;
|
||||
|
||||
public Coordinate(double x, double y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public double getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public void setX(double x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public double getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public void setY(double y) {
|
||||
this.y = y;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.zhidaoauto.map.sdk.inner.obj
|
||||
|
||||
class CustomDriveStep {
|
||||
// private String road;
|
||||
// private String orientation;
|
||||
// private float distance;
|
||||
// private float duration;
|
||||
var customTmcList: List<CustomTMC>? = null
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user