Merge remote-tracking branch 'origin/demo/shunyi_vr_map' into demo/shunyi_vr_map

This commit is contained in:
wangcongtao
2020-10-27 17:34:44 +08:00
10 changed files with 338 additions and 130 deletions

View File

@@ -1,75 +0,0 @@
package com.mogo.module.common.entity;
/**
* 通过AI云下发的红绿灯状态
*
* @author tongchenfei
*/
public class AITrafficLightEntity {
private int type;
private double lat;
private double lon;
private long systemTime;
/**红绿灯状态 1红 2绿 3黄*/
private Integer lightStatus;//
/**红绿灯剩余时间 读秒*/
private Integer lightLeftTime;
private double distance ;//距离
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public double getLat() {
return lat;
}
public void setLat(double lat) {
this.lat = lat;
}
public double getLon() {
return lon;
}
public void setLon(double lon) {
this.lon = lon;
}
public long getSystemTime() {
return systemTime;
}
public void setSystemTime(long systemTime) {
this.systemTime = systemTime;
}
public Integer getLightStatus() {
return lightStatus;
}
public void setLightStatus(Integer lightStatus) {
this.lightStatus = lightStatus;
}
public Integer getLightLeftTime() {
return lightLeftTime;
}
public void setLightLeftTime(Integer lightLeftTime) {
this.lightLeftTime = lightLeftTime;
}
public double getDistance() {
return distance;
}
public void setDistance(double distance) {
this.distance = distance;
}
}

View File

@@ -0,0 +1,129 @@
package com.mogo.module.common.entity;
import android.os.Parcel;
import android.os.Parcelable;
/**
* 云端定位信息和自车定位信息
*
* @author tongchenfei
*/
public class CloudLocationInfo implements Parcelable {
private double lat;
private double lon;
private double heading;
private long systemTime;
private long satelliteTime;
private double alt;
private double speed;
public CloudLocationInfo(){
}
protected CloudLocationInfo(Parcel in) {
lat = in.readDouble();
lon = in.readDouble();
heading = in.readDouble();
systemTime = in.readLong();
satelliteTime = in.readLong();
alt = in.readDouble();
speed = in.readDouble();
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeDouble(lat);
dest.writeDouble(lon);
dest.writeDouble(heading);
dest.writeLong(systemTime);
dest.writeLong(satelliteTime);
dest.writeDouble(alt);
dest.writeDouble(speed);
}
@Override
public int describeContents() {
return 0;
}
public static final Creator<CloudLocationInfo> CREATOR = new Creator<CloudLocationInfo>() {
@Override
public CloudLocationInfo createFromParcel(Parcel in) {
return new CloudLocationInfo(in);
}
@Override
public CloudLocationInfo[] newArray(int size) {
return new CloudLocationInfo[size];
}
};
public double getLat() {
return lat;
}
public void setLat(double lat) {
this.lat = lat;
}
public double getLon() {
return lon;
}
public void setLon(double lon) {
this.lon = lon;
}
public double getHeading() {
return heading;
}
public void setHeading(double heading) {
this.heading = heading;
}
public long getSystemTime() {
return systemTime;
}
public void setSystemTime(long systemTime) {
this.systemTime = systemTime;
}
public long getSatelliteTime() {
return satelliteTime;
}
public void setSatelliteTime(long satelliteTime) {
this.satelliteTime = satelliteTime;
}
public double getAlt() {
return alt;
}
public void setAlt(double alt) {
this.alt = alt;
}
public double getSpeed() {
return speed;
}
public void setSpeed(double speed) {
this.speed = speed;
}
@Override
public String toString() {
return "CloudLocationInfo{" +
"lat=" + lat +
", lon=" + lon +
", heading=" + heading +
", systemTime=" + systemTime +
", satelliteTime=" + satelliteTime +
", alt=" + alt +
", speed=" + speed +
'}';
}
}

View File

@@ -0,0 +1,95 @@
package com.mogo.module.common.entity;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.List;
/**
* 云端道路数据
* @author tongchenfei
*/
public class CloudRoadData implements Parcelable {
/**物体类型*/
private int type;
private double lat;
private double lon;
private double speed;
private long systemTime;
/**红绿灯状态 1红 2绿 3黄*/
private Integer lightStatus;//
/**红绿灯剩余时间 读秒*/
private Integer lightLeftTime;
/**视频流直播地址*/
private String rtmpUrl;//
private double distance ;//距离
public List<CloudLocationInfo> coordinates;
protected CloudRoadData(Parcel in) {
type = in.readInt();
lat = in.readDouble();
lon = in.readDouble();
speed = in.readDouble();
systemTime = in.readLong();
if (in.readByte() == 0) {
lightStatus = null;
} else {
lightStatus = in.readInt();
}
if (in.readByte() == 0) {
lightLeftTime = null;
} else {
lightLeftTime = in.readInt();
}
rtmpUrl = in.readString();
distance = in.readDouble();
coordinates = in.createTypedArrayList(CloudLocationInfo.CREATOR);
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(type);
dest.writeDouble(lat);
dest.writeDouble(lon);
dest.writeDouble(speed);
dest.writeLong(systemTime);
if (lightStatus == null) {
dest.writeByte((byte) 0);
} else {
dest.writeByte((byte) 1);
dest.writeInt(lightStatus);
}
if (lightLeftTime == null) {
dest.writeByte((byte) 0);
} else {
dest.writeByte((byte) 1);
dest.writeInt(lightLeftTime);
}
dest.writeString(rtmpUrl);
dest.writeDouble(distance);
dest.writeTypedList(coordinates);
}
@Override
public int describeContents() {
return 0;
}
public static final Creator<CloudRoadData> CREATOR = new Creator<CloudRoadData>() {
@Override
public CloudRoadData createFromParcel(Parcel in) {
return new CloudRoadData(in);
}
@Override
public CloudRoadData[] newArray(int size) {
return new CloudRoadData[size];
}
};
}

View File

@@ -3,6 +3,8 @@ package com.mogo.module.common.entity;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.List;
public
/**
* @author congtaowang
@@ -12,30 +14,80 @@ public
*/
class MogoSnapshotSetData implements Parcelable {
private String msgId;
private Long time;
//过期时间
private Long expire;
//总数据集合
private List<CloudRoadData> allList;
//红绿灯
private CloudRoadData trafficLight;
protected MogoSnapshotSetData(Parcel in) {
msgId = in.readString();
if (in.readByte() == 0) {
time = null;
} else {
time = in.readLong();
}
if (in.readByte() == 0) {
expire = null;
} else {
expire = in.readLong();
}
allList = in.createTypedArrayList(CloudRoadData.CREATOR);
trafficLight = in.readParcelable(CloudRoadData.class.getClassLoader());
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(msgId);
if (time == null) {
dest.writeByte((byte) 0);
} else {
dest.writeByte((byte) 1);
dest.writeLong(time);
}
if (expire == null) {
dest.writeByte((byte) 0);
} else {
dest.writeByte((byte) 1);
dest.writeLong(expire);
}
dest.writeTypedList(allList);
dest.writeParcelable(trafficLight, flags);
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel( Parcel dest, int flags ) {
}
public MogoSnapshotSetData() {
}
protected MogoSnapshotSetData( Parcel in ) {
}
public static final Creator< MogoSnapshotSetData > CREATOR = new Creator< MogoSnapshotSetData >() {
public static final Creator<MogoSnapshotSetData> CREATOR = new Creator<MogoSnapshotSetData>() {
@Override
public MogoSnapshotSetData createFromParcel( Parcel source ) {
return new MogoSnapshotSetData( source );
public MogoSnapshotSetData createFromParcel(Parcel in) {
return new MogoSnapshotSetData(in);
}
@Override
public MogoSnapshotSetData[] newArray( int size ) {
public MogoSnapshotSetData[] newArray(int size) {
return new MogoSnapshotSetData[size];
}
};
@Override
public String toString() {
return "MogoSnapshotSetData{" +
"msgId='" + msgId + '\'' +
", time=" + time +
", expire=" + expire +
", allList=" + allList +
", trafficLight=" + trafficLight +
'}';
}
}

View File

@@ -12,7 +12,7 @@ import android.widget.TextView;
import com.mogo.map.location.IMogoLocationListener;
import com.mogo.map.location.MogoLocation;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.entity.AITrafficLightEntity;
import com.mogo.module.common.entity.MogoSnapshotSetData;
import com.mogo.module.extensions.R;
import com.mogo.service.adas.IMogoAdasWarnMessageCallback;
import com.mogo.service.adas.MogoADASWarnType;
@@ -30,7 +30,7 @@ import org.json.JSONObject;
* @author tongchenfei
*/
public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLocationListener,
Handler.Callback , IMogoOnWebSocketMessageListener {
Handler.Callback , IMogoOnWebSocketMessageListener<MogoSnapshotSetData> {
private static final String TAG = "AdasNoticeHelper";
private static final int MSG_HIDE_TRAFFIC_LIGHT_BY_OBU = 1001;
@@ -204,7 +204,7 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca
}
}
private void handleCloudTrafficLight(AITrafficLightEntity trafficLightEntity){
private void handleCloudTrafficLight(){
if (tvTrafficLight != null && !handler.hasMessages(MSG_HIDE_TRAFFIC_LIGHT_BY_OBU)) {
handler.removeMessages(MSG_HIDE_TRAFFIC_LIGHT_BY_CLOUD);
// todo drawTrafficLight
@@ -239,4 +239,9 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca
public WebSocketMsgType getDownLinkType() {
return WebSocketMsgType.MSG_TYPE_DOWNLINK_CAR_DATA;
}
@Override
public void onMsgReceived(MogoSnapshotSetData obj) {
Logger.d(TAG, "收到大而全数据: " + obj);
}
}

View File

@@ -36,6 +36,7 @@ import com.mogo.map.navi.MogoTraffic;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.module.common.MogoModule;
import com.mogo.module.common.MogoModulePaths;
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;
@@ -439,7 +440,7 @@ public class MogoServices implements IMogoMapListener,
AutoPilotRemoteController.getInstance().start();
// mThreadHandler.sendEmptyMessageDelayed( ServiceConst.MSG_SEND_CAR_LOCATION_AND_ADAS_RECOGNIZED_RESULT_2_SERVER, 0 );
mThreadHandler.sendEmptyMessageDelayed( ServiceConst.MSG_SEND_CAR_LOCATION_AND_ADAS_RECOGNIZED_RESULT_2_SERVER, 0 );
}
private void initLocationServiceProcess( Context context ) {
@@ -459,17 +460,17 @@ public class MogoServices implements IMogoMapListener,
LocationResult locationResult = null;
if ( lastCarLocation != null ) {
locationResult = new LocationResult();
locationResult.lastCoordinate = new LocationResult.LocationInfo();
locationResult.lastCoordinate.alt = lastCarLocation.getAltitude();
locationResult.lastCoordinate.heading = lastCarLocation.getBearing();
locationResult.lastCoordinate.lat = lastCarLocation.getLatitude();
locationResult.lastCoordinate.lon = lastCarLocation.getLongitude();
locationResult.lastCoordinate.satelliteTime = lastCarLocation.getTime();
locationResult.lastCoordinate.systemTime = System.currentTimeMillis();
locationResult.lastCoordinate.speed = lastCarLocation.getSpeed();
locationResult.lastCoordinate = new CloudLocationInfo();
locationResult.lastCoordinate.setAlt(lastCarLocation.getAltitude());
locationResult.lastCoordinate.setHeading(lastCarLocation.getBearing());
locationResult.lastCoordinate.setLat(lastCarLocation.getLatitude());
locationResult.lastCoordinate.setLon(lastCarLocation.getLongitude());
locationResult.lastCoordinate.setSatelliteTime(lastCarLocation.getTime());
locationResult.lastCoordinate.setSystemTime(System.currentTimeMillis());
locationResult.lastCoordinate.setSpeed(lastCarLocation.getSpeed());
locationResult.coordinates = new ArrayList<>();
locationResult.sn = com.mogo.commons.network.Utils.getSn();
locationResult.mortonCode = MortonCode.wrapEncodeMorton( locationResult.lastCoordinate.lon, locationResult.lastCoordinate.lat );
locationResult.mortonCode = MortonCode.wrapEncodeMorton( locationResult.lastCoordinate.getLon(), locationResult.lastCoordinate.getLat() );
}
List< ADASRecognizedResult > recognizedResults = MarkerServiceHandler.getADASController().getLastADASRecognizedResult();
OnePerSecondSendContent content = new OnePerSecondSendContent();

View File

@@ -1,5 +1,7 @@
package com.mogo.module.service.websocket;
import com.mogo.module.common.entity.CloudLocationInfo;
import java.util.List;
public
@@ -14,16 +16,6 @@ class LocationResult {
public String sn;
public long mortonCode;
public LocationInfo lastCoordinate;
public List< LocationInfo > coordinates;
public static class LocationInfo {
public double lat;
public double lon;
public double heading;
public long systemTime;
public long satelliteTime;
public double alt;
public double speed;
}
public CloudLocationInfo lastCoordinate;
public List< CloudLocationInfo > coordinates;
}