Merge branch 'qa_yingyan_custom' into qa_och_bus2
# Conflicts: # modules/mogo-module-common/src/main/java/com/mogo/module/common/uploadintime/SnapshotLocationController.java
This commit is contained in:
@@ -10,14 +10,13 @@ import org.json.JSONObject;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/*
|
||||
* @author congtaowang
|
||||
* @since 2020/12/14
|
||||
*
|
||||
* 实时坐标数据处理中心
|
||||
*/
|
||||
class SnapshotLocationController {
|
||||
public class SnapshotLocationController {
|
||||
|
||||
private static final String TAG = "SnapshotLocationController";
|
||||
|
||||
@@ -27,9 +26,9 @@ class SnapshotLocationController {
|
||||
}
|
||||
|
||||
public static SnapshotLocationController getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( SnapshotLocationController.class ) {
|
||||
if ( sInstance == null ) {
|
||||
if (sInstance == null) {
|
||||
synchronized (SnapshotLocationController.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new SnapshotLocationController();
|
||||
}
|
||||
}
|
||||
@@ -44,10 +43,10 @@ class SnapshotLocationController {
|
||||
private CloudLocationInfo mLastLocationInfo = null;
|
||||
|
||||
// GPS(1s1次) RTK(OS侧)缓存数据,
|
||||
private final List< CloudLocationInfo > mLocationList = new ArrayList<>();
|
||||
private final List<CloudLocationInfo> mLocationList = new ArrayList<>();
|
||||
|
||||
// adda 工控机数据缓存
|
||||
private final List< CloudLocationInfo > mMachineCacheList = new ArrayList<>();
|
||||
private final List<CloudLocationInfo> mMachineCacheList = new ArrayList<>();
|
||||
|
||||
private int mDataAccuracy = 0;
|
||||
private double mCurSpeed;
|
||||
@@ -59,15 +58,15 @@ class SnapshotLocationController {
|
||||
*
|
||||
* @param cli {@link CloudLocationInfo}
|
||||
*/
|
||||
public void syncLocationInfo( CloudLocationInfo cli ) {
|
||||
if ( cli == null ) {
|
||||
public void syncLocationInfo(CloudLocationInfo cli) {
|
||||
if (cli == null) {
|
||||
return;
|
||||
}
|
||||
mLastLocationInfo = cli;
|
||||
mCurSpeed = cli.getSpeed();
|
||||
mCurLon = cli.getLon();
|
||||
mCurLat = cli.getLat();
|
||||
mLocationList.add( cli );
|
||||
mLocationList.add(cli);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,33 +74,39 @@ class SnapshotLocationController {
|
||||
*
|
||||
* @param data JSON结构化数据
|
||||
*/
|
||||
public void syncAdasLocationInfo( JSONObject data ) {
|
||||
if ( data == null ) {
|
||||
public void syncAdasLocationInfo(JSONObject data) {
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
DebugConfig.setStatus( DebugConfig.sLocation, true );
|
||||
Logger.d( TAG, "同步到rtk数据" );
|
||||
double lon = data.optDouble( "lon", -1 );
|
||||
double lat = data.optDouble( "lat", -1 );
|
||||
double alt = data.optDouble( "alt", -1 );
|
||||
double heading = data.optDouble( "heading", -1 );
|
||||
double acceleration = data.optDouble( "acceleration", -1 );
|
||||
double yawRate = data.optDouble( "yawRate", -1 );
|
||||
double speed = data.optDouble( "speed", -1 );
|
||||
long satelliteTime = data.optLong( "satelliteTime" );
|
||||
long systemTime = data.optLong( "systemTime" );
|
||||
//测试面板状态同步
|
||||
DebugConfig.setStatus(DebugConfig.sLocation, true);
|
||||
|
||||
Logger.d(TAG, "同步到rtk数据");
|
||||
double lon = data.optDouble("lon", -1);
|
||||
double lat = data.optDouble("lat", -1);
|
||||
double alt = data.optDouble("alt", -1);
|
||||
double heading = data.optDouble("heading", -1);
|
||||
double acceleration = data.optDouble("acceleration", -1);
|
||||
double yawRate = data.optDouble("yawRate", -1);
|
||||
double speed = data.optDouble("speed", -1);
|
||||
long satelliteTime = data.optLong("satelliteTime");
|
||||
long systemTime = data.optLong("systemTime");
|
||||
|
||||
//测试面板状态同步
|
||||
DebugConfig.setStatusData(DebugConfig.sLon, lon);
|
||||
DebugConfig.setStatusData(DebugConfig.sLat, lat);
|
||||
|
||||
CloudLocationInfo cloudLocationInfo = new CloudLocationInfo();
|
||||
cloudLocationInfo.setAlt( alt );
|
||||
cloudLocationInfo.setHeading( heading );
|
||||
cloudLocationInfo.setLat( lat );
|
||||
cloudLocationInfo.setLon( lon );
|
||||
cloudLocationInfo.setSpeed( speed );
|
||||
cloudLocationInfo.setSatelliteTime( satelliteTime );
|
||||
cloudLocationInfo.setSystemTime( systemTime );
|
||||
cloudLocationInfo.setTileId(String.valueOf(MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getTileId(lon,lat)));
|
||||
cloudLocationInfo.setAlt(alt);
|
||||
cloudLocationInfo.setHeading(heading);
|
||||
cloudLocationInfo.setLat(lat);
|
||||
cloudLocationInfo.setLon(lon);
|
||||
cloudLocationInfo.setSpeed(speed);
|
||||
cloudLocationInfo.setSatelliteTime(satelliteTime);
|
||||
cloudLocationInfo.setSystemTime(systemTime);
|
||||
cloudLocationInfo.setTileId(String.valueOf(MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getTileId(lon, lat)));
|
||||
mLastLocationInfo = cloudLocationInfo;
|
||||
mMachineCacheList.add( cloudLocationInfo );
|
||||
mMachineCacheList.add(cloudLocationInfo);
|
||||
|
||||
mCurSpeed = cloudLocationInfo.getSpeed();
|
||||
mCurLon = cloudLocationInfo.getLon();
|
||||
@@ -113,25 +118,25 @@ class SnapshotLocationController {
|
||||
*
|
||||
* @return 坐标合集
|
||||
*/
|
||||
public List< CloudLocationInfo > getSendLocationData() {
|
||||
public List<CloudLocationInfo> getSendLocationData() {
|
||||
|
||||
List< CloudLocationInfo > list = null;
|
||||
if ( mMachineCacheList != null ) {
|
||||
List<CloudLocationInfo> list = null;
|
||||
if (mMachineCacheList != null) {
|
||||
mDataAccuracy = 1;
|
||||
list = new ArrayList<>( mMachineCacheList );
|
||||
list = new ArrayList<>(mMachineCacheList);
|
||||
mMachineCacheList.clear();
|
||||
}
|
||||
if ( list == null || list.isEmpty() ) {
|
||||
if (list == null || list.isEmpty()) {
|
||||
mDataAccuracy = 0;
|
||||
if ( mLocationList != null ) {
|
||||
list = new ArrayList<>( mLocationList );
|
||||
if (mLocationList != null) {
|
||||
list = new ArrayList<>(mLocationList);
|
||||
mLocationList.clear();
|
||||
}
|
||||
}
|
||||
if ( list == null || list.isEmpty() ) {
|
||||
if ( mLastLocationInfo != null ) {
|
||||
if (list == null || list.isEmpty()) {
|
||||
if (mLastLocationInfo != null) {
|
||||
list = new ArrayList();
|
||||
list.add( mLastLocationInfo );
|
||||
list.add(mLastLocationInfo);
|
||||
mLastLocationInfo = null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user