This commit is contained in:
wangcongtao
2020-12-02 17:36:56 +08:00
parent ac43f5f25c
commit d01e9db647
7 changed files with 58 additions and 64 deletions

View File

@@ -457,45 +457,45 @@ public class MogoServices implements IMogoMapListener,
startSendCarLocationAndAdasRecognizedResult2Server(cloudLocationInfos);
});
SimpleLocationCorrectStrategy.getInstance().setRecordLocationListener((history, correct,valid,err) -> {
// todo 打点
Logger.d("SimpleCorrect","correct: "+correct);
Logger.d("SimpleCorrect","valid: "+valid);
Logger.d("SimpleCorrect","err: "+err);
ArrayList<MogoMarkerOptions> optionList = new ArrayList<>();
// for (CloudLocationInfo h : history) {
// SimpleLocationCorrectStrategy.getInstance().setRecordLocationListener((history, correct,valid,err) -> {
// // todo 打点
// Logger.d("SimpleCorrect","correct: "+correct);
// Logger.d("SimpleCorrect","valid: "+valid);
// Logger.d("SimpleCorrect","err: "+err);
// ArrayList<MogoMarkerOptions> optionList = new ArrayList<>();
//// for (CloudLocationInfo h : history) {
//// MogoMarkerOptions options = new MogoMarkerOptions();
//// options.position(LocationParseUtil.cloudLocationToMogoLatLng(h));
//// options.icon(BitmapFactory.decodeResource(context.getResources(),
//// R.drawable.bg_map_marker_blue));
//// optionList.add(options);
//// }
//
// for (CloudLocationInfo v : valid) {
// MogoMarkerOptions options = new MogoMarkerOptions();
// options.position(LocationParseUtil.cloudLocationToMogoLatLng(h));
// options.position(LocationParseUtil.cloudLocationToMogoLatLng(v));
// options.icon(BitmapFactory.decodeResource(context.getResources(),
// R.drawable.bg_map_marker_blue));
// R.drawable.bg_map_marker_oragne));
// optionList.add(options);
// }
for (CloudLocationInfo v : valid) {
MogoMarkerOptions options = new MogoMarkerOptions();
options.position(LocationParseUtil.cloudLocationToMogoLatLng(v));
options.icon(BitmapFactory.decodeResource(context.getResources(),
R.drawable.bg_map_marker_oragne));
optionList.add(options);
}
for (CloudLocationInfo c : correct) {
MogoMarkerOptions options = new MogoMarkerOptions();
options.position(LocationParseUtil.cloudLocationToMogoLatLng(c));
options.icon(BitmapFactory.decodeResource(context.getResources(),
R.drawable.bg_map_marker_green));
optionList.add(options);
}
for (CloudLocationInfo e : err) {
MogoMarkerOptions options = new MogoMarkerOptions();
options.position(LocationParseUtil.cloudLocationToMogoLatLng(e));
options.icon(BitmapFactory.decodeResource(context.getResources(),
R.drawable.bg_map_marker_red));
optionList.add(options);
}
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(context).addMarkers("MogoServices", optionList, false);
});
//
// for (CloudLocationInfo c : correct) {
// MogoMarkerOptions options = new MogoMarkerOptions();
// options.position(LocationParseUtil.cloudLocationToMogoLatLng(c));
// options.icon(BitmapFactory.decodeResource(context.getResources(),
// R.drawable.bg_map_marker_green));
// optionList.add(options);
// }
//
// for (CloudLocationInfo e : err) {
// MogoMarkerOptions options = new MogoMarkerOptions();
// options.position(LocationParseUtil.cloudLocationToMogoLatLng(e));
// options.icon(BitmapFactory.decodeResource(context.getResources(),
// R.drawable.bg_map_marker_red));
// optionList.add(options);
// }
// MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(context).addMarkers("MogoServices", optionList, false);
// });
}
private void initLocationServiceProcess( Context context ) {
@@ -512,23 +512,25 @@ public class MogoServices implements IMogoMapListener,
private void startSendCarLocationAndAdasRecognizedResult2Server(List<CloudLocationInfo> cloudLocationInfo) {
// Location lastCarLocation = mLastCarLocation;
CloudLocationInfo lastInfo = LocationParseUtil.locationToCloudLocation(mLastCarLocation);
CloudLocationInfo lastInfo = null;
// 如果数组内容不为空,就用数组最后一个值
if (cloudLocationInfo != null && !cloudLocationInfo.isEmpty()) {
lastInfo = cloudLocationInfo.get(cloudLocationInfo.size() - 1);
}
if ( lastInfo == null ) {
lastInfo = LocationParseUtil.locationToCloudLocation(mLastCarLocation);
}
LocationResult locationResult = null;
if ( lastInfo != null ) {
// 定位点预测纠偏
lastInfo = SimpleLocationCorrectStrategy.getInstance().correct(lastInfo);
if (lastInfo == null) {
return;
}
locationResult = new LocationResult();
locationResult.lastCoordinate = lastInfo;
if (lastInfo != null) {
locationResult.lastCoordinate = lastInfo;
locationResult.mortonCode = MortonCode.wrapEncodeMorton( lastInfo.getLon(), lastInfo.getLat() );
}
locationResult.coordinates = new ArrayList<>();
locationResult.sn = com.mogo.commons.network.Utils.getSn();
locationResult.mortonCode = MortonCode.wrapEncodeMorton( lastInfo.getLon(), lastInfo.getLat() );
if(cloudLocationInfo == null){
locationResult.coordinates.addAll(new ArrayList<>());
}else {
@@ -577,7 +579,7 @@ public class MogoServices implements IMogoMapListener,
return;
}
mRefreshModel.refreshExplorerWayData( ro.mLonLat, ro.mRadius, ro.mAmount, ro.mCallback );
MapMarkerManager.getInstance().getOnlineCarDataByAutoRefreshStrategy( ro.mLonLat );
// MapMarkerManager.getInstance().getOnlineCarDataByAutoRefreshStrategy( ro.mLonLat );
Logger.i( TAG, "刷新半径 = %s, 点 = %s, zoomLevel = %s, amount = %s", ro.mRadius, ro.mLonLat, mLastZoomLevel, ro.mAmount );
}

View File

@@ -59,7 +59,6 @@ public class MogoRTKLocation {
private void sendLocationData() {
if (rtkLocationListener != null) {
Logger.d(TAG, "sendLocationData size : " + cacheList.size());
List<CloudLocationInfo> list = new ArrayList<>(cacheList);
rtkLocationListener.onLocationChanged(list);
}
@@ -110,7 +109,6 @@ public class MogoRTKLocation {
private LocationListener locationListener = new LocationListener() {
@Override
public void onLocationChanged(Location location) {
Logger.d(TAG, "onLocationChanged : " + location.toString());
if (location != null) {
CloudLocationInfo cloudLocationInfo = new CloudLocationInfo();
cloudLocationInfo.setAlt(location.getAltitude());

View File

@@ -159,14 +159,14 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
return;
}
if ( !MogoApisHandler.getInstance().getApis().getMapFrameControllerApi().isVrMode() ) {
return;
// return;
}
if ( MogoServices.getInstance().getLastCarLocation() != null ) {
data.curSpeed = MogoServices.getInstance().getLastCarLocation().getSpeed();
}
SnapshotSetDataDrawer.getInstance().renderSnapshotData( data, false );
VrModeController.getInstance().renderMogoSnapshotSetData( data );
// VrModeController.getInstance().renderMogoSnapshotSetData( data );
}
@Override