Merge remote-tracking branch 'origin/dev2_aiSdk' into dev2_aiSdk
This commit is contained in:
@@ -71,6 +71,7 @@ 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,
|
||||
IMogoMapUIController,
|
||||
@@ -1044,7 +1045,13 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, RoadCacheWrapper> roadCacheMap = new ArrayMap<>();
|
||||
Map<String, RoadCacheWrapper> roadCacheMap = new ConcurrentHashMap<>();
|
||||
private RoadCacheWrapper noCache = new RoadCacheWrapper(null);
|
||||
|
||||
@Override
|
||||
public void clearRoadCacheById(String id) {
|
||||
roadCacheMap.remove(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] matchRoad(String id, double lon, double lat, double angle, boolean isGpsLocation, boolean isRTK) {
|
||||
@@ -1068,7 +1075,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
|
||||
RoadCacheWrapper roadCache = roadCacheMap.get(id);
|
||||
double matchThreshold = -1;
|
||||
if (roadCache == null) {
|
||||
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());
|
||||
@@ -1116,7 +1123,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
} else if (matchedPoint[2] > matchThreshold && matchedPoint[2] < 1.5) {
|
||||
return null;
|
||||
} else {
|
||||
roadCacheMap.put(id, null);
|
||||
roadCacheMap.put(id, noCache);
|
||||
Log.i("timer-matchRoad-2", "cost " + (System.currentTimeMillis() - start) + "ms roadId: " + roadCache.getLastLat());
|
||||
if (usdCache) {
|
||||
return matchRoad(id, lon, lat, angle, isGpsLocation, isRTK, false);
|
||||
@@ -1126,7 +1133,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
// return null;
|
||||
}
|
||||
}
|
||||
roadCacheMap.put(id, null);
|
||||
roadCacheMap.put(id, noCache);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -336,4 +336,11 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
mClient.setMarkerInfoResName( speedVal, val );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearRoadCacheById(String id) {
|
||||
if (mClient != null) {
|
||||
mClient.clearRoadCacheById(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -289,6 +289,10 @@ public interface IMogoMapUIController {
|
||||
return null;
|
||||
}
|
||||
|
||||
default void clearRoadCacheById(String id) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取车速资源缓存 id
|
||||
* @param speedVal
|
||||
|
||||
@@ -379,4 +379,12 @@ public class MogoMapUIController implements IMogoMapUIController {
|
||||
mDelegate.setMarkerInfoResName( speedVal, val );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearRoadCacheById(String id) {
|
||||
initDelegate();
|
||||
if (mDelegate != null) {
|
||||
mDelegate.clearRoadCacheById(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,6 +167,10 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
}
|
||||
renderAdasOneFrame( recognizedListResult, newAdasRecognizedMarkersCaches );
|
||||
}
|
||||
for (String id : mAdasRecognizedMarkersCaches.keySet()) {
|
||||
// 清除道路缓存
|
||||
clearRoadCacheById(id);
|
||||
}
|
||||
sendMessage( MSG_REMOVE_DIRTY_MARKERS, mAdasRecognizedMarkersCaches );
|
||||
mAdasRecognizedMarkersCaches = newAdasRecognizedMarkersCaches;
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ class BaseDrawer {
|
||||
if ( recognizedType == AdasRecognizedType.classIdCar
|
||||
|| recognizedType == AdasRecognizedType.classIdTrafficBus
|
||||
|| recognizedType == AdasRecognizedType.classIdTrafficTruck ) {
|
||||
return R.raw.othercar;
|
||||
return R.raw.othercar2;
|
||||
} else if ( recognizedType == AdasRecognizedType.classIdBicycle
|
||||
|| recognizedType == AdasRecognizedType.classIdMoto ) {
|
||||
return R.raw.motorbike;
|
||||
@@ -271,6 +271,10 @@ class BaseDrawer {
|
||||
return matchRoad;
|
||||
}
|
||||
|
||||
public void clearRoadCacheById(String id) {
|
||||
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().clearRoadCacheById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用系统时间或卫星时间计算出动画的运动时间
|
||||
*
|
||||
|
||||
BIN
modules/mogo-module-common/src/main/res/raw/othercar2.n3d
Normal file
BIN
modules/mogo-module-common/src/main/res/raw/othercar2.n3d
Normal file
Binary file not shown.
Reference in New Issue
Block a user