地图模块代码更新3.0.0
This commit is contained in:
@@ -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();
|
||||
}
|
||||
Reference in New Issue
Block a user