update MoGoAiCloud sdk version and replace the CloudLocationInfo

This commit is contained in:
zhongchao
2021-02-23 17:24:30 +08:00
parent 22fabd4a52
commit fea65e541d
8 changed files with 25 additions and 208 deletions

View File

@@ -1,183 +0,0 @@
package com.mogo.module.common.entity;
import android.os.Parcel;
import android.os.Parcelable;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.utils.CoordinateUtils;
import java.util.Objects;
/**
* 云端定位信息和自车定位信息
*
* @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;
private int vehicleType = 0;
public CloudLocationInfo() {
if ( DebugConfig.getProductFlavor().contains( "taxi" ) ) {
vehicleType = 9;
} else if ( DebugConfig.getProductFlavor().contains( "bus" ) ) {
vehicleType = 10;
}
}
public CloudLocationInfo( CloudLocationInfo info ) {
this.lat = info.getLat();
this.lon = info.getLon();
this.heading = info.getHeading();
this.systemTime = System.currentTimeMillis();
this.satelliteTime = info.getSatelliteTime();
this.alt = info.alt;
this.speed = info.speed;
}
public void convertCoor2GCJ02(){
double[] amapCoord = CoordinateUtils.transformWgsToGcj( lat, lon );
if ( amapCoord != null ) {
this.lat = amapCoord[1];
this.lon = amapCoord[0];
}
}
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 +
'}';
}
public String print() {
return "CloudLocation{ lon: " + lon + " lat: " + lat + " heading: " + heading + " speed: "
+ speed + "}";
}
@Override
public boolean equals( Object o ) {
if ( this == o ) {
return true;
}
if ( o == null || getClass() != o.getClass() ) {
return false;
}
CloudLocationInfo that = ( CloudLocationInfo ) o;
return Double.compare( that.lat, lat ) == 0 &&
Double.compare( that.lon, lon ) == 0;
}
@Override
public int hashCode() {
return Objects.hash( lat, lon );
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel( Parcel dest, int flags ) {
dest.writeDouble( this.lat );
dest.writeDouble( this.lon );
dest.writeDouble( this.heading );
dest.writeLong( this.systemTime );
dest.writeLong( this.satelliteTime );
dest.writeDouble( this.alt );
dest.writeDouble( this.speed );
dest.writeInt( this.vehicleType );
}
protected CloudLocationInfo( Parcel in ) {
this.lat = in.readDouble();
this.lon = in.readDouble();
this.heading = in.readDouble();
this.systemTime = in.readLong();
this.satelliteTime = in.readLong();
this.alt = in.readDouble();
this.speed = in.readDouble();
this.vehicleType = in.readInt();
}
public static final Creator< CloudLocationInfo > CREATOR = new Creator< CloudLocationInfo >() {
@Override
public CloudLocationInfo createFromParcel( Parcel source ) {
return new CloudLocationInfo( source );
}
@Override
public CloudLocationInfo[] newArray( int size ) {
return new CloudLocationInfo[size];
}
};
}