add tileId in uploadData
This commit is contained in:
@@ -9,7 +9,6 @@ import android.location.Location;
|
||||
import android.os.Bundle;
|
||||
import android.os.Trace;
|
||||
import android.text.TextUtils;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
@@ -17,7 +16,6 @@ import android.view.ViewGroup;
|
||||
import android.view.animation.Interpolator;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.autonavi.nge.map.LonLat;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.map.IMogoMap;
|
||||
import com.mogo.map.IMogoMapView;
|
||||
@@ -38,7 +36,6 @@ import com.mogo.map.uicontroller.MapControlResult;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
import com.zhidaoauto.map.sdk.open.MapAutoApi;
|
||||
import com.zhidaoauto.map.sdk.open.abs.MapStatusListener;
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnCameraChangeListener;
|
||||
@@ -57,7 +54,6 @@ import com.zhidaoauto.map.sdk.open.location.RTKAutopilotLocationBean;
|
||||
import com.zhidaoauto.map.sdk.open.marker.BitmapDescriptorFactory;
|
||||
import com.zhidaoauto.map.sdk.open.marker.Marker;
|
||||
import com.zhidaoauto.map.sdk.open.marker.OnMarkClickListener;
|
||||
import com.zhidaoauto.map.sdk.open.poyline.PolylineOptions;
|
||||
import com.zhidaoauto.map.sdk.open.query.LonLatPoint;
|
||||
import com.zhidaoauto.map.sdk.open.tools.MapTools;
|
||||
import com.zhidaoauto.map.sdk.open.view.MapAutoView;
|
||||
@@ -67,10 +63,8 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class AMapViewWrapper implements IMogoMapView,
|
||||
@@ -729,6 +723,11 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTileId(double lon, double lat) {
|
||||
return getMap().getUIController().getTileId(lon,lat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(@NotNull com.zhidaoauto.map.sdk.open.location.MogoLocation location) {
|
||||
Location sysLocation = new Location(location.getProvider());
|
||||
@@ -796,13 +795,13 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
String speedVal = String.valueOf(speedIntVal);
|
||||
String infoResName = ResIdCache.getVal(speedVal);
|
||||
int offset = 20;
|
||||
if ( !mMapView.getMapAutoViewHelper().getLockMode() ) {
|
||||
if (!mMapView.getMapAutoViewHelper().getLockMode()) {
|
||||
offset = 30;
|
||||
}
|
||||
if ( offset != mLastYOffset ) {
|
||||
if (offset != mLastYOffset) {
|
||||
mLastYOffset = offset;
|
||||
}
|
||||
mSelfMarker.setInfoWindowOffset( 0, offset );
|
||||
mSelfMarker.setInfoWindowOffset(0, offset);
|
||||
if (TextUtils.isEmpty(infoResName)) {
|
||||
if (mSpeedView == null) {
|
||||
mSpeedView = new TextView(mMapView.getContext());
|
||||
@@ -958,7 +957,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
/**
|
||||
* 切换到车头朝上
|
||||
*/
|
||||
private void change2CarUp(){
|
||||
private void change2CarUp() {
|
||||
mMapView.getMapAutoViewHelper().setMapViewPerspective(MapAutoApi.MAP_PERSPECTIVE_UP_CAR);
|
||||
}
|
||||
|
||||
@@ -1029,9 +1028,9 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
bean.setAcceleration(acceleration);
|
||||
bean.setAlt(alt);
|
||||
bean.setSystemTime(systemTime);
|
||||
bean.setSatelliteTime( satelliteTime );
|
||||
bean.setSatelliteTime(satelliteTime);
|
||||
bean.setReceiverDataTime(receiverDataTime);
|
||||
bean.setAdasSatelliteTime( adasSatelliteTime );
|
||||
bean.setAdasSatelliteTime(adasSatelliteTime);
|
||||
bean.setLon(lon);
|
||||
bean.setGnss_speed(((float) speed));
|
||||
bean.setLat(lat);
|
||||
@@ -1063,24 +1062,24 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
|
||||
/**
|
||||
* 带缓存的道路匹配算法
|
||||
*
|
||||
* <p>
|
||||
* 使用{@link MapDataApi#INSTANCE#getSinglePointMatchRoad()}这个方法获取道路数据会存在一定耗时,目前是4-10ms,因为请求频繁,为了
|
||||
* 减小这部分耗时,使用一个ConcurrentHashMap{@link #roadCacheMap}缓存道路数据,此缓存是以目标车id为key,道路数据为value,以此减少
|
||||
* 道路数据获取次数。
|
||||
*
|
||||
* <p>
|
||||
* 当出现道路改变的情况,需要重新获取道路数据,采用递归的方式重获道路数据以及添加缓存,为了避免一直获取不到道路数据,一直递归,增加useCache参数跳出递归。
|
||||
*
|
||||
* <p>
|
||||
* 道路改变的情况主要分为:
|
||||
* 1. 目标车距离道路中心线距离超过阈值 matchThreshold(取路宽的1/4为阈值);
|
||||
* 2. 目标车到道路中心线的映射点不在道路上(此判断在{@link PointInterpolatorUtil#mergeToRoad(double, double, List)}),也就是说已经驶出了这条道路
|
||||
* 1. 目标车距离道路中心线距离超过阈值 matchThreshold(取路宽的1/4为阈值);
|
||||
* 2. 目标车到道路中心线的映射点不在道路上(此判断在{@link PointInterpolatorUtil#mergeToRoad(double, double, List)}),也就是说已经驶出了这条道路
|
||||
*
|
||||
* @param id 目标车唯一标识
|
||||
* @param lon 目标车经度
|
||||
* @param lat 目标车纬度
|
||||
* @param angle 目标车角度
|
||||
* @param id 目标车唯一标识
|
||||
* @param lon 目标车经度
|
||||
* @param lat 目标车纬度
|
||||
* @param angle 目标车角度
|
||||
* @param isGpsLocation true-使用gps定位数据
|
||||
* @param isRTK true-使用rtk数据
|
||||
* @param usdCache true-使用道路缓存 false-不使用道路缓存
|
||||
* @param isRTK true-使用rtk数据
|
||||
* @param usdCache true-使用道路缓存 false-不使用道路缓存
|
||||
* @return double[]{匹配后经度,匹配后纬度,目标车距离车道中心线距离},若匹配后经纬度值为-1,则没有匹配成功
|
||||
*/
|
||||
private double[] matchRoad(String id, double lon, double lat, double angle, boolean isGpsLocation, boolean isRTK, boolean usdCache) {
|
||||
@@ -1089,7 +1088,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
|
||||
RoadCacheWrapper roadCache = roadCacheMap.get(id);
|
||||
double matchThreshold = -1;
|
||||
if (roadCache == null||roadCache == noCache) {
|
||||
if (roadCache == null || roadCache == noCache) {
|
||||
SinglePointRoadInfo singlePointRoadInfo = MapDataApi.INSTANCE.getSinglePointMatchRoad(((float) wgs[0]), ((float) wgs[1]), ((float) angle), isGpsLocation, isRTK);
|
||||
if (singlePointRoadInfo != null && singlePointRoadInfo.getCoords() != null && !singlePointRoadInfo.getCoords().isEmpty()) {
|
||||
Log.i("timer-matchRoad-4", "cost " + (System.currentTimeMillis() - start) + "ms roadId: " + singlePointRoadInfo.getRoadId());
|
||||
@@ -1127,7 +1126,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
matchThreshold = roadCache.getLaneWidth() / 4;
|
||||
|
||||
double[] matchedPoint = PointInterpolatorUtil.mergeToRoad(wgs[0], wgs[1], roadCache.getRoad());
|
||||
if (matchThreshold>0&&matchedPoint[2] > 0 && matchedPoint[2] <= matchThreshold) {
|
||||
if (matchThreshold > 0 && matchedPoint[2] > 0 && matchedPoint[2] <= matchThreshold) {
|
||||
// 目标车在阈值范围内
|
||||
roadCacheMap.put(id, roadCache);
|
||||
Log.i("timer-matchRoad-3", "cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
@@ -1152,8 +1151,8 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMarkerInfoResName( String speedVal ) {
|
||||
return ResIdCache.getVal( speedVal );
|
||||
public String getMarkerInfoResName(String speedVal) {
|
||||
return ResIdCache.getVal(speedVal);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.mogo.map.impl.custom;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Point;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.map.IMogoMap;
|
||||
import com.mogo.map.IMogoUiSettings;
|
||||
@@ -51,13 +50,13 @@ public class AMapWrapper implements IMogoMap {
|
||||
private IMogoUiSettings mUiSettings;
|
||||
|
||||
public AMapWrapper(MapAutoViewHelper map, MapAutoView mapView, IMogoMapUIController controller) {
|
||||
Logger.i(TAG, "autoop--AMapWrapper: init"+this);
|
||||
Logger.i(TAG, "autoop--AMapWrapper: init" + this);
|
||||
this.mAMap = map;
|
||||
sAMap = map;
|
||||
this.mMapView = mapView;
|
||||
mUIcontroller = controller;
|
||||
// 设置实现自定义 info window
|
||||
MapAutoApi.INSTANCE.setInfoWindowAdapter( new AMapInfoWindowAdapter() );
|
||||
MapAutoApi.INSTANCE.setInfoWindowAdapter(new AMapInfoWindowAdapter());
|
||||
AMapUIController.getInstance().initClient(mUIcontroller);
|
||||
}
|
||||
|
||||
@@ -83,7 +82,7 @@ public class AMapWrapper implements IMogoMap {
|
||||
|
||||
@Override
|
||||
public IMogoMarker addMarker(String tag, MogoMarkerOptions options) {
|
||||
Logger.i(TAG, "autoop-addMarker: " + tag + ",MogoMarkerOptions:" + options + ",AMap:" + (mAMap != null)+",this:"+this);
|
||||
Logger.i(TAG, "autoop-addMarker: " + tag + ",MogoMarkerOptions:" + options + ",AMap:" + (mAMap != null) + ",this:" + this);
|
||||
if (!checkAMap()) {
|
||||
return null;
|
||||
}
|
||||
@@ -134,7 +133,7 @@ public class AMapWrapper implements IMogoMap {
|
||||
multiPointOverlayOptions.setData(markerOptions);
|
||||
multiPointOverlayOptions.setMarkerIcon(R.drawable.marker_blue);
|
||||
List<MarkerOptions> data = mAMap.addMarkers(multiPointOverlayOptions).getOptions().getData();
|
||||
for (int i = 0 ;i< data.size();i++){
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
markers.add(new Marker(data.get(i)));
|
||||
}
|
||||
if (markers == null || markers.isEmpty()) {
|
||||
@@ -168,7 +167,7 @@ public class AMapWrapper implements IMogoMap {
|
||||
@Override
|
||||
public void setPointToCenter(int x, int y) {
|
||||
if (checkAMap()) {
|
||||
LonLatPoint lonLatPoint = MapTools.INSTANCE.fromScreenLocation(new Point(x,y));
|
||||
LonLatPoint lonLatPoint = MapTools.INSTANCE.fromScreenLocation(new Point(x, y));
|
||||
mAMap.setCenter(lonLatPoint);
|
||||
}
|
||||
}
|
||||
@@ -176,21 +175,21 @@ public class AMapWrapper implements IMogoMap {
|
||||
@Override
|
||||
public void setTouchPoiEnable(boolean touchPoiEnable) {
|
||||
if (checkAMap()) {
|
||||
mAMap.setTouchPoiEnable( touchPoiEnable );
|
||||
mAMap.setTouchPoiEnable(touchPoiEnable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTrafficEnable(boolean enable) {
|
||||
if (checkAMap()) {
|
||||
mAMap.setTraffic( enable );
|
||||
mAMap.setTraffic(enable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showBuildings(boolean enabled) {
|
||||
if (checkAMap()) {
|
||||
mAMap.showBuildings( enabled );
|
||||
mAMap.showBuildings(enabled);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,7 +203,7 @@ public class AMapWrapper implements IMogoMap {
|
||||
@Override
|
||||
public void showMapText(boolean enable) {
|
||||
if (checkAMap()) {
|
||||
mAMap.showMapText( enable );
|
||||
mAMap.showMapText(enable);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,7 +216,7 @@ public class AMapWrapper implements IMogoMap {
|
||||
|
||||
@Override
|
||||
public float getScalePerPixel() {
|
||||
if ( checkAMap() ) {
|
||||
if (checkAMap()) {
|
||||
return mAMap.getScalePerPixel();
|
||||
}
|
||||
return 0;
|
||||
@@ -247,19 +246,19 @@ public class AMapWrapper implements IMogoMap {
|
||||
|
||||
@Override
|
||||
public IMogoPolyline addPolyline(MogoPolylineOptions options) {
|
||||
if ( checkAMap() ) {
|
||||
PolylineOptions polylineOptions = ObjectUtils.fromMogo( options );
|
||||
if (checkAMap()) {
|
||||
PolylineOptions polylineOptions = ObjectUtils.fromMogo(options);
|
||||
Logger.d(TAG, "addPolyline %s", polylineOptions.toString());
|
||||
if ( polylineOptions == null ) {
|
||||
if (polylineOptions == null) {
|
||||
return null;
|
||||
}
|
||||
Polyline polyline = null;
|
||||
if (polylineOptions.getLineWidth() > 0){
|
||||
if (polylineOptions.getLineWidth() > 0) {
|
||||
polyline = mAMap.drawThickLine(polylineOptions);
|
||||
}else {
|
||||
} else {
|
||||
polyline = mAMap.drawLine(polylineOptions);
|
||||
}
|
||||
return new AMapPolylineWrapper( polyline, options );
|
||||
return new AMapPolylineWrapper(polyline, options);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.MapCameraPosition;
|
||||
import com.mogo.map.uicontroller.MapControlResult;
|
||||
import com.zhidaoauto.map.sdk.open.MapAutoApi;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
@@ -286,6 +287,11 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTileId(double lon, double lat) {
|
||||
return MapAutoApi.INSTANCE.getTileID(lon,lat,13); // 13为默认获取瓦片层级级别
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAnchorScale( float x, float y ) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user