opt
This commit is contained in:
@@ -132,7 +132,6 @@ public class WebSocketManager implements IMogoWebSocketManager, ISocketMsgSettin
|
||||
|
||||
@Override
|
||||
public void sendMsg(Object body, IMogoOnWebSocketMessageListener listener) {
|
||||
Logger.d(TAG, "websocket sendMsg body = " + body);
|
||||
if (handlerThread != null) {
|
||||
WebSocketData webSocketData = new WebSocketData();
|
||||
webSocketData.setSeq(computeSendMsgTime());
|
||||
@@ -181,7 +180,6 @@ public class WebSocketManager implements IMogoWebSocketManager, ISocketMsgSettin
|
||||
Logger.d(TAG, "websocket received msg = " + message);
|
||||
WebSocketData webSocketData = GsonUtil.objectFromJson(message, WebSocketData.class);
|
||||
int msgType = webSocketData.getMsgType();
|
||||
Logger.d(TAG, "websocket received msg type = " + msgType);
|
||||
|
||||
//服务端下发数据返回,上传数据回执默认不返回
|
||||
if (msgType == MSG_TYPE_DOWNLINK_CAR_DATA.getMsgType()) {
|
||||
@@ -191,7 +189,6 @@ public class WebSocketManager implements IMogoWebSocketManager, ISocketMsgSettin
|
||||
while (iterator.hasNext()) {
|
||||
IMogoOnWebSocketMessageListener listener = iterator.next();
|
||||
if (listener != null) {
|
||||
Logger.d(TAG, "received msgId = " + webSocketData.getSeq() + ", content = " + webSocketData.getData());
|
||||
Object receiveObj = GsonUtil.objectFromJson(webSocketData.getData(),listener.target());
|
||||
listener.onMsgReceived(receiveObj);
|
||||
}
|
||||
@@ -201,14 +198,12 @@ public class WebSocketManager implements IMogoWebSocketManager, ISocketMsgSettin
|
||||
if (webSocketData.getUtcTime() > 0) {
|
||||
serverTime = webSocketData.getUtcTime();
|
||||
receiveMsgTime = SystemClock.elapsedRealtime();
|
||||
Logger.d(TAG, "设置serverTime");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectClose() {
|
||||
Logger.d(TAG, "websocket ready to reconnect");
|
||||
SocketClient.getInstance().getClientProxy().stop();
|
||||
SocketClient.getInstance().getClientProxy().reConnect();
|
||||
}
|
||||
|
||||
@@ -70,13 +70,11 @@ public class MogoMarkerManager implements IMogoMarkerManager {
|
||||
|
||||
@Override
|
||||
public void removeMarkers( String tag ) {
|
||||
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
MogoMarkersHandler.getInstance().remove( tag );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeMarkers() {
|
||||
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
MogoMarkersHandler.getInstance().removeAll();
|
||||
}
|
||||
|
||||
@@ -92,7 +90,6 @@ public class MogoMarkerManager implements IMogoMarkerManager {
|
||||
|
||||
@Override
|
||||
public void removeMarkersExcept( String tag ) {
|
||||
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
MogoMarkersHandler.getInstance().deleteAllExcept( tag );
|
||||
}
|
||||
|
||||
|
||||
@@ -201,17 +201,18 @@ class SnapshotSetDataDrawer extends BaseDrawer {
|
||||
|
||||
private View inflateView( CloudRoadData data, boolean machineVision, double curSpeed ) {
|
||||
View rootView = LayoutInflater.from( AbsMogoApplication.getApp() ).inflate( R.layout.module_commons_layout_car, null );
|
||||
SafeType safeType = getSafeType( data.getDistance(), data.getSpeed(), curSpeed );
|
||||
TextView tv = rootView.findViewById( R.id.module_commons_marker_car_speed );
|
||||
// 机器视觉展示速度,用户视觉展示安全类型
|
||||
tv.setText( machineVision ? String.valueOf( data.getSpeed() ) : safeType.getMsg() );
|
||||
// SafeType safeType = getSafeType( data.getDistance(), data.getSpeed(), curSpeed );
|
||||
// TextView tv = rootView.findViewById( R.id.module_commons_marker_car_speed );
|
||||
// // 机器视觉展示速度,用户视觉展示安全类型
|
||||
// tv.setText( machineVision ? String.valueOf( data.getSpeed() ) : safeType.getMsg() );
|
||||
ImageView iv = rootView.findViewById( R.id.module_commons_marker_car_model );
|
||||
iv.setImageResource( MarkerResourceManager.getMarkerDrawableResId(
|
||||
machineVision ? VisionMode.Machine : VisionMode.User,
|
||||
AdasRecognizedType.valueFrom( data.getType() ),
|
||||
getCarModelType(),
|
||||
safeType
|
||||
) );
|
||||
// iv.setImageResource( MarkerResourceManager.getMarkerDrawableResId(
|
||||
// machineVision ? VisionMode.Machine : VisionMode.User,
|
||||
// AdasRecognizedType.valueFrom( data.getType() ),
|
||||
// getCarModelType(),
|
||||
// safeType
|
||||
// ) );
|
||||
iv.setImageResource( R.drawable.icon_map_marker_car_gray );
|
||||
return rootView;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,5 +16,6 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:visibility="gone"
|
||||
android:textColor="#FF0000" />
|
||||
</FrameLayout>
|
||||
@@ -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 );
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user