This commit is contained in:
tongchenfei
2021-03-09 16:16:34 +08:00
parent 1b98761014
commit 5dea7b6b13

View File

@@ -1055,16 +1055,20 @@ public class AMapViewWrapper implements IMogoMapView,
&& !roadCache.getRoad().isEmpty() ) {
start = System.currentTimeMillis();
double matchedPoint[] = PointInterpolatorUtil.mergeToRoad( wgs[0], wgs[1], roadCache.getRoad() );
double diff = CoordinateUtils.calculateLineDistance(lon, lat, roadCache.getLastLon(), roadCache.getLastLon());
if ( (roadCache.getLastDistanceDiff() == 0 || roadCache.getLastDistanceDiff() > diff)) {
roadCache.setLastDistanceDiff(diff);
roadCacheMap.put(id, roadCache);
Log.i("timer-matchRoad-3", "cost " + (System.currentTimeMillis() - start) + "ms");
if(matchedPoint[2]<1) {
double diff = CoordinateUtils.calculateLineDistance(lon, lat, roadCache.getLastLon(), roadCache.getLastLon());
if ((roadCache.getLastDistanceDiff() == 0 || roadCache.getLastDistanceDiff() > diff)) {
roadCache.setLastDistanceDiff(diff);
roadCacheMap.put(id, roadCache);
Log.i("timer-matchRoad-3", "cost " + (System.currentTimeMillis() - start) + "ms");
return matchedPoint;
}
roadCacheMap.put(id, null);
Log.i("timer-matchRoad-2", "cost " + (System.currentTimeMillis() - start) + "ms");
return matchRoad(id, lon, lat, angle, isGpsLocation, isRTK);
}else{
return matchedPoint;
}
roadCacheMap.put(id, null);
Log.i("timer-matchRoad-2", "cost " + (System.currentTimeMillis() - start) + "ms");
return matchRoad(id, lon, lat, angle, isGpsLocation, isRTK);
}
return null;
}