1. mock添加10辆车
2. 道路吸附同步到snapshot
This commit is contained in:
@@ -197,76 +197,19 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
return;
|
||||
}
|
||||
|
||||
final double lon = recognizedListResult.lon;
|
||||
final double lat = recognizedListResult.lat;
|
||||
|
||||
final long start = System.currentTimeMillis();
|
||||
double[] matchedPoint = SnapshotSetDataDrawer.getInstance().matchRoad( recognizedListResult.uuid, recognizedListResult.lon,
|
||||
recognizedListResult.lat,
|
||||
recognizedListResult.heading,
|
||||
true
|
||||
);
|
||||
|
||||
ADASRecognizedResult lastPosition = mLastPositions.remove( uniqueKey );
|
||||
boolean match = false;
|
||||
if ( matchedPoint != null ) {
|
||||
Logger.d( TAG, "matchPoint %s distance = %s",lineCounter, matchedPoint[2] );
|
||||
match = matchedPoint[2] < 1 && matchedPoint[2] > 0;
|
||||
|
||||
if ( lastPosition != null ) {
|
||||
double clearAngle;
|
||||
if (recognizedListResult.heading > 0 && recognizedListResult.heading <= 90) {
|
||||
clearAngle = recognizedListResult.heading;
|
||||
} else if (recognizedListResult.heading > 90 && recognizedListResult.heading <= 180) {
|
||||
clearAngle = 180 - recognizedListResult.heading ;
|
||||
} else if (recognizedListResult.heading > 180 && recognizedListResult.heading <= 270) {
|
||||
clearAngle = recognizedListResult.heading - 180;
|
||||
}else{
|
||||
clearAngle = 360 - recognizedListResult.heading;
|
||||
}
|
||||
double _angle = Math.atan2(Math.abs(matchedPoint[0] - lastPosition.lon), Math.abs(matchedPoint[1] - lastPosition.lat)) * (180 / PI);
|
||||
_angle = Math.abs(clearAngle - _angle);
|
||||
Logger.d(TAG, "matchPoint %s angel = %s", lineCounter, _angle);
|
||||
if ( _angle > 22.5 ) {
|
||||
match = false;
|
||||
}
|
||||
}
|
||||
// mIsMatchStatusCache.put( uniqueKey, match );
|
||||
if ( match ) {
|
||||
recognizedListResult.lon = matchedPoint[0];
|
||||
recognizedListResult.lat = matchedPoint[1];
|
||||
}
|
||||
double lastLon = -1;
|
||||
double lastLat = -1;
|
||||
if (lastPosition != null) {
|
||||
lastLon = lastPosition.lon;
|
||||
lastLat = lastPosition.lat;
|
||||
}
|
||||
double[] matchLonLat = getMatchLonLat(recognizedListResult.uuid, recognizedListResult.lon, recognizedListResult.lat, recognizedListResult.heading, lastLon, lastLat);
|
||||
|
||||
recognizedListResult.lon = matchLonLat[0];
|
||||
recognizedListResult.lat = matchLonLat[1];
|
||||
|
||||
// Boolean isMatch = mIsMatchStatusCache.get( uniqueKey );
|
||||
// if ( matchedPoint != null ) {
|
||||
// if ( ( isMatch == null || !isMatch ) ) {
|
||||
// if ( matchedPoint[2] < 0.5 && matchedPoint[2] > 0 ) {
|
||||
// isMatch = true;
|
||||
// }
|
||||
// } else {
|
||||
// if ( matchedPoint[2] > 1 ) {
|
||||
// isMatch = false;
|
||||
// }
|
||||
// }
|
||||
// if ( isMatch == null ) {
|
||||
// isMatch = false;
|
||||
// }
|
||||
// if (lastPosition != null) {
|
||||
// double _angle = Math.atan2(Math.abs(matchedPoint[0] - lastPosition.lon), Math.abs(matchedPoint[1] - lastPosition.lat)) * (180 / PI);
|
||||
// Logger.d(TAG, "matchPoint %s angel = %s", lineCounter, _angle);
|
||||
// if (_angle > 22.5) {
|
||||
// isMatch = false;
|
||||
// }
|
||||
// }
|
||||
// mIsMatchStatusCache.put( uniqueKey, isMatch );
|
||||
//
|
||||
// if ( isMatch ) {
|
||||
// recognizedListResult.lon = matchedPoint[0];
|
||||
// recognizedListResult.lat = matchedPoint[1];
|
||||
// }
|
||||
// }
|
||||
mLastPositions.put( uniqueKey, recognizedListResult );
|
||||
Logger.d( "matchRoad", "cost = %s", System.currentTimeMillis() - start );
|
||||
IMogoMarker marker = mAdasRecognizedMarkersCaches.remove( uniqueKey );
|
||||
|
||||
@@ -16,8 +16,10 @@ import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.R;
|
||||
import com.mogo.module.common.constants.AdasRecognizedType;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.realtime.entity.CloudRoadData;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -384,4 +386,43 @@ class BaseDrawer {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected double[] getMatchLonLat(String id,double lon,double lat,double heading,double lastLon,double lastLat){
|
||||
double[] matchedPoint = SnapshotSetDataDrawer.getInstance().matchRoad( id, lon,
|
||||
lat,
|
||||
heading,
|
||||
true
|
||||
);
|
||||
|
||||
boolean match = false;
|
||||
if ( matchedPoint != null ) {
|
||||
// Logger.d( TAG, "matchPoint %s distance = %s",lineCounter, matchedPoint[2] );
|
||||
match = matchedPoint[2] < 1 && matchedPoint[2] > 0;
|
||||
|
||||
if ( lastLon != -1 ) {
|
||||
double clearAngle;
|
||||
if (heading > 0 && heading <= 90) {
|
||||
clearAngle = heading;
|
||||
} else if (heading > 90 && heading <= 180) {
|
||||
clearAngle = 180 - heading ;
|
||||
} else if (heading > 180 && heading <= 270) {
|
||||
clearAngle = heading - 180;
|
||||
}else{
|
||||
clearAngle = 360 - heading;
|
||||
}
|
||||
double _angle = Math.atan2(Math.abs(matchedPoint[0] - lastLon), Math.abs(matchedPoint[1] - lastLat)) * (180 / PI);
|
||||
_angle = Math.abs(clearAngle - _angle);
|
||||
// Logger.d(TAG, "matchPoint %s angel = %s", lineCounter, _angle);
|
||||
if ( _angle > 22.5 ) {
|
||||
match = false;
|
||||
}
|
||||
}
|
||||
if ( match ) {
|
||||
lon = matchedPoint[0];
|
||||
lat = matchedPoint[1];
|
||||
}
|
||||
}
|
||||
|
||||
return new double[]{lon,lat};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,39 +195,22 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
final long start = System.currentTimeMillis();
|
||||
// double[] matchedPoint = SnapshotSetDataDrawer.getInstance().matchRoad( recognizedListResult.getUniqueKey(), recognizedListResult.getWgslon(),
|
||||
// recognizedListResult.getWgslat(),
|
||||
// recognizedListResult.getHeading(),
|
||||
// true
|
||||
// );
|
||||
// Boolean isMatch = mIsMatchStatusCache.get( uniqueKey );
|
||||
// if ( matchedPoint != null ) {
|
||||
// if ( ( isMatch == null || !isMatch ) ) {
|
||||
// if ( matchedPoint[2] < 0.5 ) {
|
||||
// isMatch = true;
|
||||
// }
|
||||
// } else {
|
||||
// if ( matchedPoint[2] > 1 ) {
|
||||
// isMatch = false;
|
||||
// }
|
||||
// }
|
||||
// if ( isMatch == null ) {
|
||||
// isMatch = false;
|
||||
// }
|
||||
// mIsMatchStatusCache.put( uniqueKey, isMatch );
|
||||
//
|
||||
// if ( isMatch ) {
|
||||
// recognizedListResult.setWgslon(matchedPoint[0]);
|
||||
// recognizedListResult.setWgslat(matchedPoint[1]);
|
||||
// }
|
||||
// }
|
||||
// Logger.d( "matchRoad", "cost = %s", System.currentTimeMillis() - start );
|
||||
|
||||
IMogoMarker marker = mAdasRecognizedMarkersCaches.remove( uniqueKey );
|
||||
CloudRoadData lastPosition = mLastPositions.put( uniqueKey, recognizedListResult );
|
||||
|
||||
double lastLon = -1;
|
||||
double lastLat = -1;
|
||||
if (lastPosition != null) {
|
||||
lastLon = lastPosition.getWgslon();
|
||||
lastLat = lastPosition.getWgslat();
|
||||
}
|
||||
double[] matchLonLat = getMatchLonLat(recognizedListResult.getUniqueKey(), recognizedListResult.getWgslon(), recognizedListResult.getWgslat(), recognizedListResult.getHeading(), lastLon, lastLat);
|
||||
recognizedListResult.setWgslon(matchLonLat[0]);
|
||||
recognizedListResult.setWgslat(matchLonLat[1]);
|
||||
|
||||
if ( marker == null || marker.isDestroyed() ) {
|
||||
marker = drawSnapshotDataMarker( recognizedListResult );
|
||||
if ( marker == null ) {
|
||||
|
||||
Reference in New Issue
Block a user