opt
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 过滤数据
|
||||
*
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user