This commit is contained in:
wangcongtao
2021-01-19 20:26:53 +08:00
parent 1b2f72092a
commit 386e882133
98 changed files with 9925 additions and 69 deletions

View File

@@ -39,8 +39,6 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
mContext = AbsMogoApplication.getApp();
}
private long mLastReceiveTime = 0L;
private Map< String, MogoLatLng > mLastPositions = new ConcurrentHashMap<>();
public static AdasRecognizedResultDrawer getInstance() {
@@ -124,10 +122,9 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
}
mLastPositions.put( uniqueKey, endLatLon );
if ( points.size() >= 1 ) {
marker.startSmoothInMs( points, SystemClock.elapsedRealtime() - mLastReceiveTime );
marker.startSmoothInMs( points, 100 );
}
}
mLastReceiveTime = SystemClock.elapsedRealtime();
}
/**

View File

@@ -1,6 +1,13 @@
package com.mogo.module.common.drawer;
import android.content.Context;
import android.graphics.Color;
import android.graphics.Typeface;
import android.view.ViewGroup;
import android.widget.TextView;
import com.mogo.map.CoordinatesTransformer;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.constants.AdasRecognizedType;
import com.mogo.module.common.constants.CarModelType;
@@ -94,4 +101,31 @@ class BaseDrawer {
}
return true;
}
private float mLastSpeed = 0;
private TextView mSpeedView = null;
protected void showSelfSpeed( Context context, IMogoMarker mogoMarker, double speed, boolean isVrMode ) {
if ( mogoMarker == null || mogoMarker.isDestroyed() ) {
return;
}
if ( !isVrMode ) {
mogoMarker.hideInfoWindow();
return;
}
if ( Math.abs( mLastSpeed - speed ) > 0 ) {
if ( mSpeedView == null ) {
mSpeedView = new TextView( context );
mSpeedView.setTextColor( Color.WHITE );
mSpeedView.setTypeface( Typeface.defaultFromStyle( Typeface.BOLD ) );
mSpeedView.setShadowLayer( 10f, 5F, 5F, Color.BLACK );
mSpeedView.setLayoutParams( new ViewGroup.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT ) );
}
mSpeedView.setText( String.valueOf( ( ( int ) ( speed * 3.6 ) ) ) );
mogoMarker.updateInfoWindowView( mSpeedView );
} else {
mogoMarker.hideInfoWindow();
}
}
}

View File

@@ -1,10 +1,13 @@
package com.mogo.module.common.drawer;
import android.content.Context;
import android.graphics.Color;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.map.MogoLatLng;
@@ -12,6 +15,7 @@ import com.mogo.map.location.MogoLocation;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.MapCameraPosition;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.R;
@@ -24,6 +28,7 @@ import com.mogo.service.statusmanager.StatusDescriptor;
import com.mogo.utils.ThreadPoolService;
import com.mogo.utils.ViewUtils;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
import com.zhidao.carchattingprovider.ICarsChattingProvider;
import com.zhidao.carchattingprovider.MogoDriverInfo;
@@ -141,6 +146,8 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
continue;
}
Logger.d( TAG, "%s", GsonUtil.jsonFromObject( cloudRoadData ) );
// 暂时只显示车辆
if ( TextUtils.isEmpty( cloudRoadData.getSn() ) ) {
if ( isCarType( cloudRoadData.getType() ) ) {
@@ -192,13 +199,16 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
}
}
Logger.d( TAG, "保持位置 - %s", uniqueKey );
marker.setPosition( lastPosition.getLat(), lastPosition.getLon() );
// marker.setPosition( lastPosition.getLat(), lastPosition.getLon() );
} else {
List< MogoLatLng > points = new ArrayList<>();
points.add( new MogoLatLng( lastPosition.getLat(), lastPosition.getLon() ) );
points.add( new MogoLatLng( cloudRoadData.getLat(), cloudRoadData.getLon() ) );
marker.startSmoothInMs( points, cloudRoadData.getSystemTime() - lastPosition.getSystemTime() );
Logger.d( TAG, "平滑移动 - %s duration = %s", uniqueKey, cloudRoadData.getSystemTime() - lastPosition.getSystemTime() );
long interval = cloudRoadData.getSystemTime() - lastPosition.getSystemTime();
long interval2 = cloudRoadData.getSatelliteTime() - lastPosition.getSatelliteTime();
interval2 = interval < interval2 || interval2 == 0 ? interval : interval2;
marker.startSmoothInMs( points, interval2 );
Logger.d( TAG, "平滑移动 - %s duration = %s", uniqueKey, interval2 );
}
} else {
MapCameraPosition position = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getMapCameraPosition();
@@ -209,11 +219,13 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
}
marker.setPosition( cloudRoadData.getLat(), cloudRoadData.getLon() );
}
showSelfSpeed( mContext, marker, cloudRoadData.getSpeed(), mIsVrMode );
}
mLastPositions.put( uniqueKey, cloudRoadData );
}
}
/**
* 过滤数据
*

View File

@@ -34,6 +34,7 @@ public class CloudRoadData implements Parcelable {
private double heading;
private long systemTime;
private long satelliteTime;
/**
* 红绿灯状态 1红 2绿 3黄
@@ -153,6 +154,14 @@ public class CloudRoadData implements Parcelable {
this.heading = heading;
}
public long getSatelliteTime() {
return satelliteTime;
}
public void setSatelliteTime( long satelliteTime ) {
this.satelliteTime = satelliteTime;
}
public String getUniqueKey() {
if ( !TextUtils.isEmpty( uuid ) ) {
return uuid;
@@ -171,6 +180,20 @@ public class CloudRoadData implements Parcelable {
public CloudRoadData() {
}
@Override
public boolean equals( Object o ) {
if ( this == o ) {
return true;
}
if ( o == null || getClass() != o.getClass() ) {
return false;
}
CloudRoadData that = ( CloudRoadData ) o;
return Double.compare( that.lat, lat ) == 0 &&
Double.compare( that.lon, lon ) == 0;
}
@Override
public int describeContents() {
return 0;
@@ -187,6 +210,7 @@ public class CloudRoadData implements Parcelable {
dest.writeDouble( this.speed );
dest.writeDouble( this.heading );
dest.writeLong( this.systemTime );
dest.writeLong( this.satelliteTime );
dest.writeInt( this.lightStatus );
dest.writeInt( this.lightLeftTime );
dest.writeString( this.rtmpUrl );
@@ -204,6 +228,7 @@ public class CloudRoadData implements Parcelable {
this.speed = in.readDouble();
this.heading = in.readDouble();
this.systemTime = in.readLong();
this.satelliteTime = in.readLong();
this.lightStatus = in.readInt();
this.lightLeftTime = in.readInt();
this.rtmpUrl = in.readString();
@@ -222,19 +247,4 @@ public class CloudRoadData implements Parcelable {
return new CloudRoadData[size];
}
};
@Override
public boolean equals( Object o ) {
if ( this == o ) {
return true;
}
if ( o == null || getClass() != o.getClass() ) {
return false;
}
CloudRoadData that = ( CloudRoadData ) o;
return Double.compare( that.lat, lat ) == 0 &&
Double.compare( that.lon, lon ) == 0;
}
}

View File

@@ -21,7 +21,7 @@ public class CarSeries {
if ( invokeFlag ) {
return isF8xxSeries;
}
isF8xxSeries = DebugConfig.getProductFlavor().startsWith( "f8" );
isF8xxSeries = DebugConfig.getProductFlavor().startsWith( "f" );
invokeFlag = true;
return isF8xxSeries;
}

View File

@@ -384,7 +384,9 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
mMove2CurrentLocation.setVisibility(View.VISIBLE);
mUploadRoadCondition.setVisibility(View.VISIBLE);
groupUserHead.setVisibility(View.VISIBLE);
seekHelpGroup.setVisibility(View.VISIBLE);
if(MogoApisHandler.getInstance().getApis().getStatusManagerApi().isSeekHelping()) {
seekHelpGroup.setVisibility( View.VISIBLE );
}
// mWeatherContainer.setVisibility(View.VISIBLE);
// mMsgContainer.setVisibility(View.VISIBLE);

View File

@@ -50,6 +50,26 @@ public class CarStateInfo implements Serializable {
private double heading;
private double acceleration;
private double yaw_rate;
//惯导车速 m/s
private float gnss_speed;
//gps 时间
private String satelliteTime;
public float getGnss_speed() {
return gnss_speed;
}
public void setGnss_speed( float gnss_speed ) {
this.gnss_speed = gnss_speed;
}
public String getSatelliteTime() {
return satelliteTime;
}
public void setSatelliteTime( String satelliteTime ) {
this.satelliteTime = satelliteTime;
}
public double getLon() {
return lon;

View File

@@ -8,6 +8,7 @@ import com.mogo.module.service.MarkerServiceHandler;
import com.mogo.module.service.ServiceConst;
import com.mogo.module.service.carinfo.CarStateInfo;
import com.mogo.module.service.receiver.MogoReceiver;
import com.mogo.module.service.uploadintime.SnapshotUploadInTime;
import com.mogo.utils.network.utils.GsonUtil;
import org.json.JSONObject;
@@ -64,11 +65,13 @@ class ADASStatusIntentHandler implements IntentHandler {
data.putOpt( "lon", stateInfo.getValues().getLon() );
data.putOpt( "lat", stateInfo.getValues().getLat() );
data.putOpt( "alt", stateInfo.getValues().getAlt() );
data.putOpt( "speed", stateInfo.getValues().getGnss_speed() );
data.putOpt( "satelliteTime", stateInfo.getValues().getSatelliteTime() );
data.putOpt( "heading", stateInfo.getValues().getHeading() );
data.putOpt( "acceleration", stateInfo.getValues().getAcceleration() );
data.putOpt( "yawRate", stateInfo.getValues().getYaw_rate() );
MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController()
.syncLocation2Map( data );
MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map( data );
SnapshotUploadInTime.getInstance().syncAdasLocationInfo( data );
} catch ( Exception e ) {
e.printStackTrace();
}

View File

@@ -28,6 +28,7 @@ import com.mogo.module.common.dialog.WMDialog;
import com.mogo.module.service.MarkerServiceHandler;
import com.mogo.module.service.R;
import com.mogo.service.entrance.ButtonIndex;
import com.mogo.utils.CoordinateUtils;
import com.mogo.utils.TipToast;
import com.mogo.utils.WorkThreadHandler;
import com.mogo.utils.logger.Logger;
@@ -391,6 +392,86 @@ public class MockIntentHandler implements IntentHandler {
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController()
.syncLocation2Map( null );
break;
case 40:
double[][] coors = new double[][]{{40.17511749267578, 116.74359130859375},
{40.20258331298828, 116.74071502685547},
{40.202598571777344, 116.74067687988281},
{40.20256805419922, 116.74071502685547},
{40.202598571777344, 116.74064636230469},
{40.20258712768555, 116.74067687988281},
{40.202579498291016, 116.74068450927734},
{40.202545166015625, 116.7406005859375},
{40.202571868896484, 116.74054718017578},
{40.20256042480469, 116.74057006835938},
{40.202510833740234, 116.74053192138672},
{40.202552795410156, 116.74053955078125},
{40.202537536621094, 116.74044799804688},
{40.202552795410156, 116.74042510986328},
{40.202510833740234, 116.74038696289062},
{40.202537536621094, 116.74044799804688},
{40.202552795410156, 116.74042510986328},
{40.202518463134766, 116.74039459228516},
{40.202537536621094, 116.74038696289062},
{40.202552795410156, 116.74036407470703},
{40.20252227783203, 116.7403335571289},
{40.20253372192383, 116.74038696289062},
{40.202552795410156, 116.74036407470703},
{40.2025260925293, 116.7403335571289},
{40.20253372192383, 116.74030303955078},
{40.20254898071289, 116.74028778076172},
{40.20252990722656, 116.7402572631836},
{40.2025260925293, 116.740234375},
{40.202545166015625, 116.74022674560547},
{40.20252990722656, 116.74020385742188},
{40.20254898071289, 116.74014282226562},
{40.20253372192383, 116.74011993408203},
{40.2025260925293, 116.74014282226562},
{40.20254898071289, 116.74014282226562},
{40.202537536621094, 116.74011993408203},
{40.2025260925293, 116.74014282226562},
{40.20255661010742, 116.74008178710938},
{40.20254135131836, 116.74005889892578},
{40.20252990722656, 116.74007415771484},
{40.20254898071289, 116.74008178710938},
{40.20254135131836, 116.74005889892578},
{40.20252227783203, 116.74006652832031},
{40.20254898071289, 116.74002838134766},
{40.20254135131836, 116.74000549316406},
{40.20252227783203, 116.73999786376953},
{40.20269012451172, 116.73983001708984},
{40.20265579223633, 116.73978424072266},
{40.202667236328125, 116.7397689819336},
{40.20264434814453, 116.73973083496094},
{40.202632904052734, 116.7397689819336},
{40.202613830566406, 116.73974609375},
{40.2026252746582, 116.73970794677734},
{40.202613830566406, 116.73968505859375},
{40.202598571777344, 116.73970031738281},
{40.20258712768555, 116.73969268798828},
{40.20258712768555, 116.73961639404297},
{40.202579498291016, 116.73960876464844},
{40.20257568359375, 116.7396240234375},
{40.20256805419922, 116.73960876464844},
{40.20256042480469, 116.73941802978516},
{40.20255661010742, 116.73941802978516},
{40.20256042480469, 116.73941802978516},
{40.20254898071289, 116.73941802978516},
{40.20255661010742, 116.7393569946289},
{40.20254898071289, 116.7393569946289},
{40.20256042480469, 116.7393569946289},
{40.20254898071289, 116.7393569946289},
{40.20255661010742, 116.73928833007812},
{40.202545166015625, 116.7392807006836},
{40.20254898071289, 116.73928833007812},
{40.20254135131836, 116.7392807006836}};
for ( double[] coor : coors ) {
double lat = coor[0], lon = coor[1];
double[] translateCoor = CoordinateUtils.transformFromWGSToGCJ( lat, lon );
double[] originCoor = CoordinateUtils.transformGcj02toWgs84( translateCoor[0], translateCoor[1] );
double delta = CoordinateUtils.calculateLineDistance( lon, lat, originCoor[0], originCoor[1] );
Logger.d( TAG, "偏差值:%s", delta );
}
}
}

View File

@@ -14,7 +14,9 @@ import android.os.Message;
import android.util.Log;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.module.common.entity.CloudLocationInfo;
import com.mogo.module.service.uploadintime.SnapshotUploadInTime;
import com.mogo.utils.WorkThreadHandler;
import com.mogo.utils.logger.Logger;
@@ -63,13 +65,19 @@ public class MogoRTKLocation {
private void sendLocationData() {
if (rtkLocationListener != null) {
List<CloudLocationInfo> list = new ArrayList<>(cacheList);
rtkLocationListener.onLocationChanged(list);
List<CloudLocationInfo> list = null;
if ( DebugConfig.isUseAdasRtkLocationInfo() ) {
list = new ArrayList<>(SnapshotUploadInTime.getInstance().getSendLocationData());
}
if ( list == null || list.isEmpty() ) {
list = new ArrayList<>(cacheList);
}
if (cacheList != null && cacheList.size() > 0) {
cacheList.clear();
}
if (rtkLocationListener != null) {
rtkLocationListener.onLocationChanged(list);
}
}
public void registerRTKLocationListener(RTKLocationListener locationListener) {

View File

@@ -176,9 +176,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
} );
// adas 每隔一秒传递的数据
MarkerServiceHandler.getApis().getAdasControllerApi().addAdasRecognizedDataCallback( resultList -> {
if ( resultList == null || resultList.isEmpty() ) {
return;
}
double speed = 0.0;
if ( MogoServices.getInstance().getLastCarLocation() != null ) {
speed = MogoServices.getInstance().getLastCarLocation().getSpeed();

View File

@@ -14,6 +14,8 @@ import com.mogo.service.connection.IMogoOnWebSocketMessageListener;
import com.mogo.service.connection.WebSocketMsgType;
import com.mogo.utils.logger.Logger;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
@@ -122,4 +124,46 @@ class SnapshotUploadInTime implements MogoRTKLocation.RTKLocationListener {
}
} );
}
// adda 工控机数据缓存
private List< CloudLocationInfo > cacheList = new ArrayList<>();
public void syncAdasLocationInfo( JSONObject data ) {
if ( data == null ) {
return;
}
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 = 0L;
try {
satelliteTime = Long.valueOf( data.optString( "satelliteTime" ) );
} catch ( Exception e ) {
e.printStackTrace();
}
CloudLocationInfo cloudLocationInfo = new CloudLocationInfo();
cloudLocationInfo.setAlt( alt );
cloudLocationInfo.setHeading( heading );
cloudLocationInfo.setLat( lat );
cloudLocationInfo.setLon( lon );
cloudLocationInfo.setSpeed( speed );
cloudLocationInfo.setSatelliteTime( satelliteTime );
cloudLocationInfo.setSystemTime( System.currentTimeMillis() );
cloudLocationInfo.convertCoor2GCJ02();
cacheList.add( cloudLocationInfo );
}
public List< CloudLocationInfo > getSendLocationData() {
List< CloudLocationInfo > list = new ArrayList<>( cacheList );
if ( cacheList != null && cacheList.size() > 0 ) {
cacheList.clear();
}
return list;
}
}