opt
This commit is contained in:
@@ -29,6 +29,7 @@ import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.navi.IMogoAimlessModeListener;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
@@ -44,6 +45,8 @@ import com.mogo.module.common.entity.CloudLocationInfo;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.common.map.MapCenterPointStrategy;
|
||||
import com.mogo.module.common.map.Scene;
|
||||
import com.mogo.module.common.utils.CoordinateSystemTransformationUtil;
|
||||
import com.mogo.module.common.utils.CoordinateUtils;
|
||||
import com.mogo.module.service.autopilot.AutoPilotRemoteController;
|
||||
import com.mogo.module.service.intent.IntentHandlerFactory;
|
||||
import com.mogo.module.service.launchercard.LauncherCardRefresher;
|
||||
@@ -453,9 +456,9 @@ public class MogoServices implements IMogoMapListener,
|
||||
|
||||
AutoPilotRemoteController.getInstance().start();
|
||||
MogoRTKLocation.getInstance().registerRTKLocationListener( cloudLocationInfos -> {
|
||||
Logger.i(TAG,"cloudLocationInfos size : " + cloudLocationInfos.size());
|
||||
startSendCarLocationAndAdasRecognizedResult2Server(cloudLocationInfos);
|
||||
});
|
||||
Logger.i( TAG, "cloudLocationInfos size : " + cloudLocationInfos.size() );
|
||||
startSendCarLocationAndAdasRecognizedResult2Server( cloudLocationInfos );
|
||||
} );
|
||||
|
||||
// SimpleLocationCorrectStrategy.getInstance().setRecordLocationListener((history, correct,valid,err) -> {
|
||||
// // todo 打点
|
||||
@@ -510,31 +513,45 @@ public class MogoServices implements IMogoMapListener,
|
||||
}
|
||||
}
|
||||
|
||||
private void startSendCarLocationAndAdasRecognizedResult2Server(List<CloudLocationInfo> cloudLocationInfo) {
|
||||
|
||||
private List< List< Double > > coors = new ArrayList<>();
|
||||
private CloudLocationInfo mLastInfo;
|
||||
private void startSendCarLocationAndAdasRecognizedResult2Server( List< CloudLocationInfo > cloudLocationInfo ) {
|
||||
// Location lastCarLocation = mLastCarLocation;
|
||||
CloudLocationInfo lastInfo = null;
|
||||
// 如果数组内容不为空,就用数组最后一个值
|
||||
if (cloudLocationInfo != null && !cloudLocationInfo.isEmpty()) {
|
||||
lastInfo = cloudLocationInfo.get(cloudLocationInfo.size() - 1);
|
||||
if ( cloudLocationInfo != null && !cloudLocationInfo.isEmpty() ) {
|
||||
lastInfo = cloudLocationInfo.get( cloudLocationInfo.size() - 1 );
|
||||
mLastInfo = lastInfo;
|
||||
}
|
||||
if ( lastInfo == null ) {
|
||||
lastInfo = LocationParseUtil.locationToCloudLocation(mLastCarLocation);
|
||||
lastInfo = mLastInfo;
|
||||
}
|
||||
LocationResult locationResult = null;
|
||||
if ( lastInfo != null ) {
|
||||
// 定位点预测纠偏
|
||||
lastInfo = SimpleLocationCorrectStrategy.getInstance().correct(lastInfo);
|
||||
lastInfo = SimpleLocationCorrectStrategy.getInstance().correct( lastInfo );
|
||||
locationResult = new LocationResult();
|
||||
if (lastInfo != null) {
|
||||
if ( lastInfo != null ) {
|
||||
// List<Double> coor = new ArrayList<>( );
|
||||
// double pos[] = CoordinateUtils.transformFromWGSToGCJ( lastInfo.getLat(), lastInfo.getLon() );
|
||||
// coor.add( pos[1]);
|
||||
// coor.add(pos[0] );
|
||||
// coors.add( coor );
|
||||
// if ( coors.size()>50 ) {
|
||||
// Logger.d( "Print-coor", GsonUtil.jsonFromObject( coors ) );
|
||||
// coors.clear();
|
||||
// }
|
||||
// moveMarker( lastInfo.getLat(), lastInfo.getLon() );
|
||||
locationResult.lastCoordinate = lastInfo;
|
||||
locationResult.mortonCode = MortonCode.wrapEncodeMorton( lastInfo.getLon(), lastInfo.getLat() );
|
||||
}
|
||||
locationResult.coordinates = new ArrayList<>();
|
||||
locationResult.sn = com.mogo.commons.network.Utils.getSn();
|
||||
if(cloudLocationInfo == null){
|
||||
locationResult.coordinates.addAll(new ArrayList<>());
|
||||
}else {
|
||||
locationResult.coordinates.addAll(cloudLocationInfo);
|
||||
if ( cloudLocationInfo == null ) {
|
||||
locationResult.coordinates.addAll( new ArrayList<>() );
|
||||
} else {
|
||||
locationResult.coordinates.addAll( cloudLocationInfo );
|
||||
}
|
||||
}
|
||||
List< ADASRecognizedResult > recognizedResults = MarkerServiceHandler.getADASController().getLastADASRecognizedResult();
|
||||
@@ -556,6 +573,33 @@ public class MogoServices implements IMogoMapListener,
|
||||
} );
|
||||
}
|
||||
|
||||
private IMogoMarker marker = null;
|
||||
|
||||
private void moveMarker( double lat, double lon ) {
|
||||
List< Double > coor = new ArrayList<>();
|
||||
double pos[] = CoordinateSystemTransformationUtil.transformWgsToGcj( lat, lon );
|
||||
coor.add( pos[1] );
|
||||
coor.add( pos[0] );
|
||||
coors.add( coor );
|
||||
if ( coors.size() > 50 ) {
|
||||
Logger.d( "Print-coor", GsonUtil.jsonFromObject( coors ) );
|
||||
coors.clear();
|
||||
}
|
||||
if ( marker == null ) {
|
||||
marker = MogoApisHandler.getInstance().getApis()
|
||||
.getMapServiceApi().getMarkerManager( mContext )
|
||||
.addMarker( TAG, new MogoMarkerOptions()
|
||||
.latitude( lat )
|
||||
.longitude( lon )
|
||||
.gps( true )
|
||||
.icon( BitmapFactory.decodeResource( mContext.getResources(), R.drawable.bg_map_marker_blue ) ) )
|
||||
;
|
||||
}
|
||||
if ( marker != null ) {
|
||||
marker.setPosition( lat, lon );
|
||||
}
|
||||
}
|
||||
|
||||
private void initWorkThread() {
|
||||
mThreadHandler = new Handler( WorkThreadHandler.getInstance().getLooper() ) {
|
||||
@Override
|
||||
@@ -898,7 +942,9 @@ public class MogoServices implements IMogoMapListener,
|
||||
Message msg = Message.obtain();
|
||||
msg.what = ServiceConst.MSG_REQUEST_DATA;
|
||||
msg.obj = new RefreshObject( callback, radius, latLng, amount );
|
||||
mThreadHandler.sendMessage( msg );
|
||||
if ( mThreadHandler != null ) {
|
||||
mThreadHandler.sendMessage( msg );
|
||||
}
|
||||
}
|
||||
|
||||
private void notifySeekHelpingStatusChanged( boolean seekHelpingStatus ) {
|
||||
|
||||
@@ -40,7 +40,7 @@ public class MogoRTKLocation {
|
||||
}
|
||||
|
||||
private MogoRTKLocation() {
|
||||
mHandler = new Handler(WorkThreadHandler.getInstance().getLooper()) {
|
||||
mHandler = new Handler(WorkThreadHandler.newInstance( TAG ).getLooper() ) {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
@@ -63,8 +63,7 @@ public class MogoRTKLocation {
|
||||
rtkLocationListener.onLocationChanged(list);
|
||||
}
|
||||
if (cacheList != null && cacheList.size() > 0) {
|
||||
cacheList = null;
|
||||
cacheList = new ArrayList<>();
|
||||
cacheList.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +89,7 @@ public class MogoRTKLocation {
|
||||
} else {
|
||||
Logger.d(TAG, "RTK LocationManager Provider GPS_PROVIDER unable");
|
||||
}
|
||||
|
||||
|
||||
// 注册修改上报间隔的广播, 临时使用,后面可直接干掉,发送广播的地方在EntranceFragment
|
||||
IntentFilter filter = new IntentFilter("com.mogo.launcher.action.FIX_UPLOAT_DELAY");
|
||||
AbsMogoApplication.getApp().registerReceiver(fixUploadDelayReceiver, filter);
|
||||
|
||||
Reference in New Issue
Block a user