Merge branch 'qa_merge_shunyi_vr_map' into dev2
# Conflicts: # config.gradle # modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/CloudLocationInfo.java # services/mogo-service-api/src/main/java/com/mogo/service/adas/IMogoADASController.java # services/mogo-service/src/main/java/com/mogo/service/impl/adas/MogoADASController.java
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
package com.mogo.module.common.drawer;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.SystemClock;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
@@ -39,7 +39,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
mContext = AbsMogoApplication.getApp();
|
||||
}
|
||||
|
||||
private Map< String, MogoLatLng > mLastPositions = new ConcurrentHashMap<>();
|
||||
private Map< String, ADASRecognizedListResult > mLastPositions = new ConcurrentHashMap<>();
|
||||
|
||||
public static AdasRecognizedResultDrawer getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
@@ -94,36 +94,34 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
continue;
|
||||
}
|
||||
mAdasRecognizedMarkersCaches.put( uniqueKey, marker );
|
||||
}
|
||||
|
||||
MogoLatLng lastPosition = mLastPositions.get( uniqueKey );
|
||||
|
||||
List< MogoLatLng > points = new ArrayList<>();
|
||||
MogoLatLng endLatLon = null;
|
||||
if ( recognizedListResult.latLonList != null
|
||||
&& recognizedListResult.latLonList.size() > 1 ) {
|
||||
for ( int j = 0; j < recognizedListResult.latLonList.size(); j++ ) {
|
||||
ADASRecognizedListResult.LatLon latLon = recognizedListResult.latLonList.get( j );
|
||||
if ( latLon == null ) {
|
||||
continue;
|
||||
mLastPositions.put( uniqueKey, recognizedListResult );
|
||||
} else {
|
||||
ADASRecognizedListResult lastPosition = mLastPositions.get( uniqueKey );
|
||||
mLastPositions.put( uniqueKey, recognizedListResult );
|
||||
if ( lastPosition != null ) {
|
||||
List< MogoLatLng > points = new ArrayList<>();
|
||||
MogoLatLng endLatLon = new MogoLatLng( recognizedListResult.lat, recognizedListResult.lon );
|
||||
points.add( new MogoLatLng( lastPosition.lat, lastPosition.lon ) );
|
||||
points.add( endLatLon );
|
||||
if ( DebugConfig.isNotSmooth() ) {
|
||||
marker.setPosition( recognizedListResult.lat, recognizedListResult.lon );
|
||||
} else {
|
||||
long interval = recognizedListResult.systemTime - lastPosition.systemTime;
|
||||
if ( interval < 45 ) {
|
||||
interval = 45;
|
||||
}
|
||||
interval -= 25;
|
||||
marker.startSmoothInMs( points, interval );
|
||||
}
|
||||
points.add( endLatLon = new MogoLatLng( latLon.lat, latLon.lon ) );
|
||||
} else {
|
||||
marker.setPosition( recognizedListResult.lat, recognizedListResult.lon );
|
||||
}
|
||||
|
||||
} else if ( recognizedListResult.latLonList != null
|
||||
&& recognizedListResult.latLonList.size() == 1 ) {
|
||||
// 原来的点和新的点做一个数组进行平滑移动
|
||||
ADASRecognizedListResult.LatLon latLon = recognizedListResult.latLonList.get( 0 );
|
||||
if ( latLon == null ) {
|
||||
continue;
|
||||
}
|
||||
points.add( lastPosition );
|
||||
points.add( endLatLon = new MogoLatLng( latLon.lat, latLon.lon ) );
|
||||
}
|
||||
mLastPositions.put( uniqueKey, endLatLon );
|
||||
if ( points.size() >= 1 ) {
|
||||
marker.startSmoothInMs( points, 100 );
|
||||
}
|
||||
showSelfSpeed( mContext,
|
||||
marker,
|
||||
recognizedListResult.speed,
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,9 +173,10 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
.owner( DataTypes.TYPE_MARKER_ADAS )
|
||||
.anchor( 0.5f, 0.5f )
|
||||
.set3DMode( true )
|
||||
.controlAngle( true )
|
||||
.icon3DRes( getVrModel() )
|
||||
.rotate( ( float ) recognizedListResult.heading )
|
||||
.position( new MogoLatLng( recognizedListResult.latLonList.get( 0 ).lat, recognizedListResult.latLonList.get( 0 ).lon ) );
|
||||
.position( new MogoLatLng( recognizedListResult.lat, recognizedListResult.lon ) );
|
||||
return MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( mContext ).addMarker( DataTypes.TYPE_MARKER_ADAS, options );
|
||||
}
|
||||
|
||||
@@ -185,21 +184,4 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
return R.raw.carred;
|
||||
}
|
||||
|
||||
private View inflateView( ADASRecognizedListResult data, boolean machineVision, double curSpeed ) {
|
||||
View rootView = LayoutInflater.from( AbsMogoApplication.getApp() ).inflate( R.layout.module_commons_layout_car, null );
|
||||
// SafeType safeType = getSafeType( data.distanceX, data.distanceY, data.speed, curSpeed );
|
||||
// TextView tv = rootView.findViewById( R.id.module_commons_marker_car_speed );
|
||||
// tv.setText( safeType.getMsg() );
|
||||
ImageView iv = rootView.findViewById( R.id.module_commons_marker_car_model );
|
||||
// iv.setImageResource( MarkerResourceManager.getMarkerDrawableResId(
|
||||
// machineVision ? VisionMode.Machine : VisionMode.User,
|
||||
// AdasRecognizedType.valueFrom( data.type ),
|
||||
// getCarModelType(),
|
||||
// safeType
|
||||
// ) );
|
||||
|
||||
iv.setImageResource( R.drawable.icon_map_marker_car_gray );
|
||||
return rootView;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.R;
|
||||
import com.mogo.module.common.api.CallChatApi;
|
||||
import com.mogo.module.common.constants.DataTypes;
|
||||
import com.mogo.module.common.entity.CloudLocationInfo;
|
||||
import com.mogo.module.common.entity.CloudRoadData;
|
||||
import com.mogo.module.common.entity.MogoSnapshotSetData;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
@@ -203,10 +204,20 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
} else {
|
||||
List< MogoLatLng > points = new ArrayList<>();
|
||||
points.add( new MogoLatLng( lastPosition.getLat(), lastPosition.getLon() ) );
|
||||
points.add( new MogoLatLng( cloudRoadData.getLat(), cloudRoadData.getLon() ) );
|
||||
if ( cloudRoadData.getCoordinates() != null && !cloudRoadData.getCoordinates().isEmpty() ) {
|
||||
for ( CloudLocationInfo coordinate : cloudRoadData.getCoordinates() ) {
|
||||
points.add( new MogoLatLng( coordinate.getLat(), coordinate.getLon() ) );
|
||||
}
|
||||
} else {
|
||||
points.add( new MogoLatLng( cloudRoadData.getLat(), cloudRoadData.getLon() ) );
|
||||
}
|
||||
long interval = cloudRoadData.getSystemTime() - lastPosition.getSystemTime();
|
||||
long interval2 = cloudRoadData.getSatelliteTime() - lastPosition.getSatelliteTime();
|
||||
interval2 = interval < interval2 || interval2 == 0 ? interval : interval2;
|
||||
if ( interval2 < 45 ) {
|
||||
interval2 = 45;
|
||||
}
|
||||
interval2 -= 25;
|
||||
marker.startSmoothInMs( points, interval2 );
|
||||
Logger.d( TAG, "平滑移动 - %s duration = %s", uniqueKey, interval2 );
|
||||
}
|
||||
@@ -320,6 +331,7 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
.anchor( 0.5f, 0.5f )
|
||||
.rotate( ( float ) data.getHeading() )
|
||||
.object( data )
|
||||
.controlAngle( true )
|
||||
.position( new MogoLatLng( data.getLat(), data.getLon() ) );
|
||||
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
options.set3DMode( true );
|
||||
@@ -342,7 +354,7 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
// return R.raw.bus;
|
||||
case CloudRoadData.FROM_MY_LOCATION:
|
||||
default:
|
||||
return R.raw.carred;
|
||||
return R.raw.carblue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,8 @@ package com.mogo.module.common.entity;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.utils.CoordinateUtils;
|
||||
|
||||
import java.util.Objects;
|
||||
@@ -43,14 +41,52 @@ public class CloudLocationInfo implements Parcelable {
|
||||
this.speed = info.speed;
|
||||
}
|
||||
|
||||
public void convertCoor2GCJ02() {
|
||||
double[] amapCoord = CoordinateUtils.transformFromWGSToGCJ( lat, lon );
|
||||
public void convertCoor2GCJ02(){
|
||||
double[] amapCoord = CoordinateUtils.transformWgsToGcj( lat, lon );
|
||||
if ( amapCoord != null ) {
|
||||
this.lat = amapCoord[0];
|
||||
this.lon = amapCoord[1];
|
||||
this.lat = amapCoord[1];
|
||||
this.lon = amapCoord[0];
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -142,44 +178,4 @@ public class CloudLocationInfo implements Parcelable {
|
||||
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];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user