优化已知问题
This commit is contained in:
@@ -184,7 +184,7 @@ public class WebSocketManager implements IMogoWebSocketManager, ISocketMsgSettin
|
||||
|
||||
@Override
|
||||
public void handleMessage(String message) {
|
||||
Logger.d(TAG, "websocket received msg = " + message);
|
||||
Logger.d(TAG, "websocket received msg = %s", message);
|
||||
WebSocketData webSocketData = GsonUtil.objectFromJson(message, WebSocketData.class);
|
||||
int msgType = webSocketData.getMsgType();
|
||||
Logger.d(TAG, "websocket received msg type = " + msgType);
|
||||
@@ -196,7 +196,7 @@ public class WebSocketManager implements IMogoWebSocketManager, ISocketMsgSettin
|
||||
while (iterator.hasNext()) {
|
||||
IMogoOnWebSocketMessageListener listener = iterator.next();
|
||||
if (listener != null) {
|
||||
Logger.d(TAG, "received msgId = " + webSocketData.getSeq() + ", content = " + webSocketData.getData());
|
||||
Logger.d(TAG, "received msgId = " + webSocketData.getSeq() + ", content = %s", webSocketData.getData());
|
||||
Object receiveObj = GsonUtil.objectFromJson(webSocketData.getData(),listener.target());
|
||||
final long start = System.currentTimeMillis();
|
||||
listener.onMsgReceived(receiveObj);
|
||||
|
||||
@@ -76,4 +76,44 @@ public class CoordinateUtils {
|
||||
return var10000;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param lon1
|
||||
* @param lat1
|
||||
* @param lon2
|
||||
* @param lat2
|
||||
* @return 两坐标的距离 单位:米(M)
|
||||
*/
|
||||
public static float calculateLineDistance( double lon1, double lat1, double lon2, double lat2 ) {
|
||||
try {
|
||||
double var2 = lon1;
|
||||
double var4 = lat1;
|
||||
double var6 = lon2;
|
||||
double var8 = lat2;
|
||||
var2 *= 0.01745329251994329D;
|
||||
var4 *= 0.01745329251994329D;
|
||||
var6 *= 0.01745329251994329D;
|
||||
var8 *= 0.01745329251994329D;
|
||||
double var10 = Math.sin( var2 );
|
||||
double var12 = Math.sin( var4 );
|
||||
double var14 = Math.cos( var2 );
|
||||
double var16 = Math.cos( var4 );
|
||||
double var18 = Math.sin( var6 );
|
||||
double var20 = Math.sin( var8 );
|
||||
double var22 = Math.cos( var6 );
|
||||
double var24 = Math.cos( var8 );
|
||||
double[] var28 = new double[3];
|
||||
double[] var29 = new double[3];
|
||||
var28[0] = var16 * var14;
|
||||
var28[1] = var16 * var10;
|
||||
var28[2] = var12;
|
||||
var29[0] = var24 * var22;
|
||||
var29[1] = var24 * var18;
|
||||
var29[2] = var20;
|
||||
return ( float ) ( Math.asin( Math.sqrt( ( var28[0] - var29[0] ) * ( var28[0] - var29[0] ) + ( var28[1] - var29[1] ) * ( var28[1] - var29[1] ) + ( var28[2] - var29[2] ) * ( var28[2] - var29[2] ) ) / 2.0D ) * 1.27420015798544E7D );
|
||||
} catch ( Throwable var26 ) {
|
||||
var26.printStackTrace();
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -61,7 +61,6 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
marker.setMObject( this );
|
||||
MarkerWrapperClickHelper.getInstance().setMogoMarkerMap( marker.getId(), this );
|
||||
}
|
||||
marker.setSaveBitmapEnable( true );
|
||||
setObject( mogoMarkerOptions.getObject() );
|
||||
this.mMogoMarkerOptions = mogoMarkerOptions;
|
||||
mMogoMarkerOptions.addObserver( this );
|
||||
@@ -141,12 +140,12 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
if ( icons == null || icons.isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
ArrayList<BitmapDescriptor> descriptors = new ArrayList<>();
|
||||
ArrayList< BitmapDescriptor > descriptors = new ArrayList<>();
|
||||
for ( Bitmap icon : icons ) {
|
||||
if ( icon == null || icon.isRecycled() ) {
|
||||
continue;
|
||||
}
|
||||
descriptors.add( BitmapDescriptorFactory.INSTANCE.fromBitmap(icon));
|
||||
descriptors.add( BitmapDescriptorFactory.INSTANCE.fromBitmap( icon ) );
|
||||
}
|
||||
if ( descriptors.isEmpty() ) {
|
||||
return;
|
||||
@@ -265,16 +264,16 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
@Override
|
||||
public void setOnMarkerClickListener( IMogoMarkerClickListener listener ) {
|
||||
mMogoMarkerClickListener = listener;
|
||||
if ( mMarker != null ) {
|
||||
mMarker.setOnMarkClickListener( new OnMarkClickListener() {
|
||||
@Override
|
||||
public void onMarkClick( @NotNull Marker marker ) {
|
||||
if ( mMogoMarkerClickListener != null ) {
|
||||
mMogoMarkerClickListener.onMarkerClicked( AMapMarkerWrapper.this );
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
// if ( mMarker != null ) {
|
||||
// mMarker.setOnMarkClickListener( new OnMarkClickListener() {
|
||||
// @Override
|
||||
// public void onMarkClick( @NotNull Marker marker ) {
|
||||
// if ( mMogoMarkerClickListener != null ) {
|
||||
// mMogoMarkerClickListener.onMarkerClicked( AMapMarkerWrapper.this );
|
||||
// }
|
||||
// }
|
||||
// } );
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -505,9 +504,14 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
@Override
|
||||
public void use3DResource( int model3D ) {
|
||||
try {
|
||||
mMarker.setMarkerOptions( mMarker.getMarkeOptions().marker3DIcon( model3D ) );
|
||||
mMarker.setMarkerOptions( mMarker.getMarkeOptions().anchorColor("#00FF00").marker3DIcon( model3D ) );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "use3DResource" );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAnchorColor( String anchorColor ) {
|
||||
mMarker.setMarkerOptions( mMarker.getMarkeOptions().anchorColor( anchorColor ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.map.impl.custom.utils;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
@@ -89,6 +90,11 @@ public class ObjectUtils {
|
||||
}
|
||||
if (opt.getIcon3DRes() != 0) {
|
||||
markerOptions.marker3DIcon(opt.getIcon3DRes());
|
||||
try {
|
||||
Color.parseColor(opt.getAnchorColor());
|
||||
markerOptions.anchorColor( opt.getAnchorColor() );
|
||||
} catch ( Exception e ) {
|
||||
}
|
||||
}
|
||||
if (!TextUtils.isEmpty(opt.getTitle())) {
|
||||
markerOptions.title(opt.getTitle());
|
||||
|
||||
@@ -349,4 +349,12 @@ public interface IMogoMarker {
|
||||
default void use3DResource( @RawRes int model3D ) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置3D车模颜色
|
||||
* @param anchorColor
|
||||
*/
|
||||
default void setAnchorColor(String anchorColor){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,6 +75,7 @@ public class MogoMarkerOptions extends Observable {
|
||||
|
||||
private @RawRes
|
||||
int mIcon3DRes = 0;
|
||||
private String mAnchorColor;
|
||||
|
||||
private boolean mIs3DMode = false;
|
||||
|
||||
@@ -233,6 +234,11 @@ public class MogoMarkerOptions extends Observable {
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions anchorColor( String anchorColor ) {
|
||||
this.mAnchorColor = anchorColor;
|
||||
return this;
|
||||
}
|
||||
|
||||
public double getLatitude() {
|
||||
return latitude;
|
||||
}
|
||||
@@ -334,6 +340,10 @@ public class MogoMarkerOptions extends Observable {
|
||||
return mIcon3DRes;
|
||||
}
|
||||
|
||||
public String getAnchorColor() {
|
||||
return mAnchorColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MogoMarkerOptions{" +
|
||||
|
||||
@@ -13,10 +13,8 @@ import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.R;
|
||||
import com.mogo.module.common.constants.AdasRecognizedType;
|
||||
import com.mogo.module.common.constants.DataTypes;
|
||||
import com.mogo.service.adas.entity.ADASRecognizedListResult;
|
||||
import com.mogo.utils.ViewUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -68,8 +66,6 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
// adas marker 缓存
|
||||
private Map< String, IMogoMarker > mAdasRecognizedMarkersCaches = new ConcurrentHashMap<>();
|
||||
|
||||
private boolean mIsVrMode = false;
|
||||
|
||||
public void renderAdasRecognizedResult( List< ADASRecognizedListResult > resultList, boolean machineVision, double curSpeed ) {
|
||||
if ( resultList == null || resultList.isEmpty() ) {
|
||||
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( mContext ).removeMarkers( DataTypes.TYPE_MARKER_ADAS );
|
||||
@@ -100,17 +96,6 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
continue;
|
||||
}
|
||||
mAdasRecognizedMarkersCaches.put( uniqueKey, marker );
|
||||
} else {
|
||||
if ( mIsVrMode != MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
mIsVrMode = MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode();
|
||||
if ( mIsVrMode ) {
|
||||
marker.getMogoMarkerOptions().set3DMode( true );
|
||||
marker.use3DResource( getVrModel() );
|
||||
} else {
|
||||
marker.getMogoMarkerOptions().set3DMode( false );
|
||||
marker.setIcon( ViewUtils.fromView( inflateView( recognizedListResult, machineVision, 0 ) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MogoLatLng lastPosition = mLastPositions.get( uniqueKey );
|
||||
@@ -124,8 +109,6 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
if ( latLon == null ) {
|
||||
continue;
|
||||
}
|
||||
// double targetPos[] = transformGcj02ToFitMap( latLon.lat, latLon.lon );
|
||||
// points.add( endLatLon = new MogoLatLng( targetPos[POS_LAT], targetPos[POS_LON] ) );
|
||||
points.add( endLatLon = new MogoLatLng( latLon.lat, latLon.lon ) );
|
||||
}
|
||||
|
||||
@@ -137,8 +120,6 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
continue;
|
||||
}
|
||||
points.add( lastPosition );
|
||||
// double targetPos[] = transformGcj02ToFitMap( latLon.lat, latLon.lon );
|
||||
// points.add( endLatLon = new MogoLatLng( targetPos[POS_LAT], targetPos[POS_LON] ) );
|
||||
points.add( endLatLon = new MogoLatLng( latLon.lat, latLon.lon ) );
|
||||
}
|
||||
mLastPositions.put( uniqueKey, endLatLon );
|
||||
@@ -193,22 +174,13 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
return null;
|
||||
}
|
||||
|
||||
// double targetPos[] = transformGcj02ToFitMap( recognizedListResult.latLonList.get( 0 ).lat, recognizedListResult.latLonList.get( 0 ).lon );
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.owner( DataTypes.TYPE_MARKER_ADAS )
|
||||
.anchor( 0.5f, 0.5f )
|
||||
.set3DMode( true )
|
||||
.icon3DRes( getVrModel() )
|
||||
.rotate( ( float ) recognizedListResult.heading )
|
||||
// .position( new MogoLatLng( targetPos[POS_LAT], targetPos[POS_LON] ) );
|
||||
.position( new MogoLatLng( recognizedListResult.latLonList.get( 0 ).lat, recognizedListResult.latLonList.get( 0 ).lon ) );
|
||||
|
||||
if ( mIsVrMode = MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
options.set3DMode( true );
|
||||
options.icon3DRes( getVrModel() );
|
||||
} else {
|
||||
options.set3DMode( false );
|
||||
options.icon( inflateView( recognizedListResult, machineVision, curSpeed ) );
|
||||
}
|
||||
|
||||
return MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( mContext ).addMarker( DataTypes.TYPE_MARKER_ADAS, options );
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
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;
|
||||
@@ -9,15 +8,20 @@ import android.widget.ImageView;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
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.MapCameraPosition;
|
||||
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.CloudRoadData;
|
||||
import com.mogo.module.common.entity.MogoSnapshotSetData;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.utils.ThreadPoolService;
|
||||
import com.mogo.utils.ViewUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.carchattingprovider.ICarsChattingProvider;
|
||||
@@ -36,16 +40,19 @@ public
|
||||
*
|
||||
* 云端数据绘制
|
||||
*/
|
||||
class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListener {
|
||||
class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListener, IMogoStatusChangedListener {
|
||||
|
||||
private static final String TAG = "SnapshotSetDataDrawer";
|
||||
|
||||
private static volatile SnapshotSetDataDrawer sInstance;
|
||||
|
||||
private Context mContext;
|
||||
private boolean mChangeCarModeStatus;
|
||||
|
||||
private SnapshotSetDataDrawer() {
|
||||
mContext = AbsMogoApplication.getApp();
|
||||
MogoApisHandler.getInstance().getApis()
|
||||
.getStatusManagerApi().registerStatusChangedListener( TAG, StatusDescriptor.VR_MODE, this );
|
||||
}
|
||||
|
||||
public static SnapshotSetDataDrawer getInstance() {
|
||||
@@ -71,12 +78,38 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
// 云端 marker 缓存
|
||||
private Map< String, IMogoMarker > mCloudSnapshotMarkersCaches = new ConcurrentHashMap<>();
|
||||
|
||||
private Map< String, MogoLatLng > mLastPositions = new ConcurrentHashMap<>();
|
||||
private Map< String, CloudRoadData > mLastPositions = new ConcurrentHashMap<>();
|
||||
|
||||
private boolean mIsVrMode = false;
|
||||
|
||||
private long mLastReceiveTime = 0L;
|
||||
private long mAnimationDuration = 500L;
|
||||
// private long mLastReceiveTime = 0L;
|
||||
// private long mAnimationDuration = 500L;
|
||||
|
||||
@Override
|
||||
public void onStatusChanged( StatusDescriptor descriptor, boolean isTrue ) {
|
||||
Logger.d( TAG, "%s - %s", descriptor, isTrue );
|
||||
mChangeCarModeStatus = true;
|
||||
ThreadPoolService.execute( () -> {
|
||||
clearOldStyleMarkers();
|
||||
} );
|
||||
}
|
||||
|
||||
private void clearOldStyleMarkers() {
|
||||
try {
|
||||
MogoApisHandler.getInstance().getApis()
|
||||
.getMapServiceApi().getMarkerManager( mContext )
|
||||
.removeMarkers( DataTypes.TYPE_MARKER_CLOUD_DATA );
|
||||
mLastPositions.clear();
|
||||
mCloudSnapshotMarkersCaches.clear();
|
||||
} catch ( Exception e ) {
|
||||
}
|
||||
try {
|
||||
MogoApisHandler.getInstance().getApis()
|
||||
.getMapServiceApi().getMarkerManager( mContext )
|
||||
.removeMarkers( DataTypes.TYPE_MARKER_ADAS );
|
||||
} catch ( Exception e ) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 其他车辆、rsu 车辆数据
|
||||
@@ -85,15 +118,7 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
*/
|
||||
public void renderSnapshotData( MogoSnapshotSetData data,
|
||||
boolean machineVision ) {
|
||||
if ( mLastReceiveTime != 0 ) {
|
||||
mAnimationDuration = System.currentTimeMillis() - mLastReceiveTime;
|
||||
if ( mAnimationDuration > 1000L ) {
|
||||
mAnimationDuration = 500L;
|
||||
}
|
||||
} else {
|
||||
mAnimationDuration = 500L;
|
||||
}
|
||||
mLastReceiveTime = System.currentTimeMillis();
|
||||
recordTimeFlag();
|
||||
if ( !MogoApisHandler.getInstance().getApis().getStatusManagerApi().isMainPageLaunched() ) {
|
||||
return;
|
||||
}
|
||||
@@ -103,10 +128,8 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( AbsMogoApplication.getApp() ).removeMarkers( DataTypes.TYPE_MARKER_CLOUD_DATA );
|
||||
return;
|
||||
}
|
||||
filterData( data.getAllList() );
|
||||
List< CloudRoadData > allDatumsList = new ArrayList<>();
|
||||
allDatumsList.addAll( data.getAllList() );
|
||||
purgeCloudSnapshotData( allDatumsList );
|
||||
prepareData( data.getAllList(), allDatumsList );
|
||||
for ( CloudRoadData cloudRoadData : allDatumsList ) {
|
||||
if ( cloudRoadData == null ) {
|
||||
continue;
|
||||
@@ -127,7 +150,6 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
if ( mCloudSnapshotMarkersCaches.containsKey( uniqueKey ) ) {
|
||||
marker = mCloudSnapshotMarkersCaches.get( uniqueKey );
|
||||
}
|
||||
MogoLatLng target = new MogoLatLng( cloudRoadData.getLat(), cloudRoadData.getLon() );
|
||||
if ( marker == null || marker.isDestroyed() ) {
|
||||
marker = drawSnapshotDataMarker( cloudRoadData, machineVision, data.curSpeed );
|
||||
if ( marker == null ) {
|
||||
@@ -138,42 +160,81 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
}
|
||||
mCloudSnapshotMarkersCaches.put( uniqueKey, marker );
|
||||
} else {
|
||||
if ( mIsVrMode != MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
if ( mChangeCarModeStatus ) {
|
||||
mChangeCarModeStatus = false;
|
||||
mIsVrMode = MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode();
|
||||
if ( mIsVrMode ) {
|
||||
Logger.d( TAG, "3D模型" );
|
||||
Logger.d( TAG, "3D模型-%s", uniqueKey );
|
||||
marker.getMogoMarkerOptions().set3DMode( true );
|
||||
marker.use3DResource( getVrModel( cloudRoadData ) );
|
||||
} else {
|
||||
Logger.d( TAG, "2D贴图" );
|
||||
Logger.d( TAG, "2D贴图-%s", uniqueKey );
|
||||
marker.getMogoMarkerOptions().set3DMode( false );
|
||||
marker.setIcon( ViewUtils.fromView( inflateView( cloudRoadData, machineVision, 0 ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
MogoLatLng lastPosition = mLastPositions.get( uniqueKey );
|
||||
// double targetPos[] = transformGcj02ToFitMap( target.lat, target.lon );
|
||||
// double lastPos[] = transformGcj02ToFitMap( lastPosition.lat, lastPosition.lon );
|
||||
CloudRoadData lastPosition = mLastPositions.get( uniqueKey );
|
||||
if ( lastPosition != null ) {
|
||||
if ( lastPosition.equals( target ) ) {
|
||||
if ( lastPosition.equals( cloudRoadData ) ) {
|
||||
if ( ( ( int ) cloudRoadData.getSpeed() ) == 0 ) {
|
||||
MapCameraPosition position = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getMapCameraPosition();
|
||||
if ( position != null ) {
|
||||
marker.setRotateAngle( 360 - ( float ) cloudRoadData.getHeading() - position.getBearing() );
|
||||
} else {
|
||||
marker.setRotateAngle( 360 - ( float ) cloudRoadData.getHeading() );
|
||||
}
|
||||
}
|
||||
Logger.d( TAG, "保持位置 - %s", uniqueKey );
|
||||
marker.setPosition( lastPosition.lat, lastPosition.lon );
|
||||
marker.setPosition( lastPosition.getLat(), lastPosition.getLon() );
|
||||
} else {
|
||||
List< MogoLatLng > points = new ArrayList<>();
|
||||
points.add( new MogoLatLng( lastPosition.lat, lastPosition.lon ) );
|
||||
points.add( new MogoLatLng( target.lat, target.lon ) );
|
||||
marker.startSmoothInMs( points, mAnimationDuration );
|
||||
Logger.d( TAG, "平滑移动 - %s duration = %s", uniqueKey, mAnimationDuration );
|
||||
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() );
|
||||
}
|
||||
} else {
|
||||
marker.setRotateAngle( 360 - ( float ) cloudRoadData.getHeading() );
|
||||
marker.setPosition( target.lat, target.lon );
|
||||
MapCameraPosition position = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getMapCameraPosition();
|
||||
if ( position != null ) {
|
||||
marker.setRotateAngle( 360 - ( float ) cloudRoadData.getHeading() - position.getBearing() );
|
||||
} else {
|
||||
marker.setRotateAngle( 360 - ( float ) cloudRoadData.getHeading() );
|
||||
}
|
||||
marker.setPosition( cloudRoadData.getLat(), cloudRoadData.getLon() );
|
||||
}
|
||||
}
|
||||
mLastPositions.put( uniqueKey, target );
|
||||
mLastPositions.put( uniqueKey, cloudRoadData );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 过滤数据
|
||||
*
|
||||
* @param in 输入集合
|
||||
* @param out 输出集合
|
||||
*/
|
||||
private void prepareData( List< CloudRoadData > in, List< CloudRoadData > out ) {
|
||||
filterData( in );
|
||||
out.addAll( in );
|
||||
purgeCloudSnapshotData( out );
|
||||
}
|
||||
|
||||
/**
|
||||
* 记录时间
|
||||
*/
|
||||
private void recordTimeFlag() {
|
||||
// if ( mLastReceiveTime != 0 ) {
|
||||
// mAnimationDuration = System.currentTimeMillis() - mLastReceiveTime;
|
||||
// if ( mAnimationDuration > 1000L ) {
|
||||
// mAnimationDuration = 500L;
|
||||
// }
|
||||
// } else {
|
||||
// mAnimationDuration = 500L;
|
||||
// }
|
||||
// mLastReceiveTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
/**
|
||||
* vr 模式下显示合并数据,否则只显示上报位置的车辆
|
||||
*
|
||||
@@ -251,21 +312,20 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
}
|
||||
|
||||
Logger.d( TAG, "draw marker uniqueKey = %s", data.getUniqueKey() );
|
||||
// double coor[] = transformGcj02ToFitMap( data.getLat(), data.getLon() );
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.owner( DataTypes.TYPE_MARKER_CLOUD_DATA )
|
||||
.anchor( 0.5f, 0.5f )
|
||||
.rotate( ( float ) data.getHeading() )
|
||||
.object( data )
|
||||
// .position( new MogoLatLng( coor[POS_LAT], coor[POS_LON] ) );
|
||||
.position( new MogoLatLng( data.getLat(), data.getLon() ) );
|
||||
if ( mIsVrMode = MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
options.set3DMode( true );
|
||||
Logger.d( TAG, "3D模型" );
|
||||
options.anchorColor( "#00FF00" );
|
||||
Logger.d( TAG, "3D模型 - %s", data.getUniqueKey() );
|
||||
options.icon3DRes( getVrModel( data ) );
|
||||
} else {
|
||||
options.set3DMode( false );
|
||||
Logger.d( TAG, "2D贴图" );
|
||||
Logger.d( TAG, "2D贴图 - %s", data.getUniqueKey() );
|
||||
options.icon( inflateView( data, machineVision, curSpeed ) );
|
||||
}
|
||||
return MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( mContext ).addMarker( DataTypes.TYPE_MARKER_CLOUD_DATA, options );
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.mogo.map.marker.IMogoInfoWindowAdapter;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
public
|
||||
/**
|
||||
@@ -17,6 +18,8 @@ public
|
||||
*/
|
||||
class RoadConditionInfoWindow3DAdapter implements IMogoInfoWindowAdapter {
|
||||
|
||||
private static final String TAG = "RoadConditionInfoWindow3DAdapter";
|
||||
|
||||
private MarkerShowEntity mEntity;
|
||||
private Context mContext;
|
||||
private MogoMarkerOptions mOptions;
|
||||
@@ -31,6 +34,7 @@ class RoadConditionInfoWindow3DAdapter implements IMogoInfoWindowAdapter {
|
||||
|
||||
@Override
|
||||
public View getInfoWindow( IMogoMarker marker ) {
|
||||
Logger.d( TAG, "创建marker的infowindow" );
|
||||
IMarkerView creator = MapMarkerAdapter.getMarkerInfoWindowView( mContext, mEntity, mOptions );
|
||||
return creator.getView();
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.module.common.entity;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.utils.CoordinateUtils;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -133,7 +133,7 @@ public class CloudRoadData implements Parcelable {
|
||||
this.coordinates = coordinates;
|
||||
}
|
||||
|
||||
public void setUuid(String uuid) {
|
||||
public void setUuid( String uuid ) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
@@ -222,4 +222,19 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
BIN
modules/mogo-module-common/src/main/res/raw/car.n3d
Normal file
BIN
modules/mogo-module-common/src/main/res/raw/car.n3d
Normal file
Binary file not shown.
@@ -7,6 +7,7 @@ import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.navi.IMogoAimless;
|
||||
import com.mogo.map.search.poisearch.IMogoPoiSearch;
|
||||
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
@@ -35,7 +36,7 @@ public class TanluServiceManager {
|
||||
private static IMogoAimless mIMogoAimless;
|
||||
|
||||
public static void init(Context context) {
|
||||
mServiceApis = (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context);
|
||||
mServiceApis = MogoApisHandler.getInstance().getApis();
|
||||
mMapService = mServiceApis.getMapServiceApi();
|
||||
mIMogoStatusManager = mServiceApis.getStatusManagerApi();
|
||||
mAnalytics = mServiceApis.getAnalyticsApi();
|
||||
|
||||
@@ -118,6 +118,9 @@ public class MogoADASController implements IMogoADASController {
|
||||
if ( !MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
return;
|
||||
}
|
||||
if ( !MogoApisHandler.getInstance().getApis().getStatusManagerApi().isMainPageLaunched() ) {
|
||||
return;
|
||||
}
|
||||
handleAdasRecognizedData( rectInfo );
|
||||
}
|
||||
|
||||
@@ -179,9 +182,6 @@ public class MogoADASController implements IMogoADASController {
|
||||
}
|
||||
|
||||
private void invokeCallbackPerSecond( List< RectInfo > data ) {
|
||||
if ( !MogoApisHandler.getInstance().getApis().getStatusManagerApi().isMainPageLaunched() ) {
|
||||
return;
|
||||
}
|
||||
List< RectInfo > newRef = data;
|
||||
List< ADASRecognizedListResult > recognizedListResults = AdasObjectUtils.regroupData( newRef );
|
||||
if ( recognizedListResults == null || recognizedListResults.isEmpty() ) {
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.network.IMogoNetwork;
|
||||
import com.mogo.service.statusmanager.IMogoMsgCenter;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.strategy.IMogoRefreshStrategyController;
|
||||
import com.mogo.service.windowview.IMogoTopViewManager;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -36,10 +37,10 @@ public class SingletonsHolder {
|
||||
sSingletons.put( IMogoNetwork.class, new MogoNetWorkService() );
|
||||
sSingletons.put( IMogoMsgCenter.class, new MogoMsgCenter() );
|
||||
sSingletons.put( IMogoStatusManager.class, new MogoStatusManager() );
|
||||
sSingletons.put( IMogoTopViewManager.class, ARouter.getInstance().navigation( IMogoTopViewManager.class ) );
|
||||
sSingletons.put( IMogoRefreshStrategyController.class, ARouter.getInstance().navigation( IMogoRefreshStrategyController.class ) );
|
||||
}
|
||||
|
||||
public static < T > T get( Class<T> clazz ) {
|
||||
public static < T > T get( Class< T > clazz ) {
|
||||
return ( T ) sSingletons.get( clazz );
|
||||
}
|
||||
|
||||
|
||||
@@ -70,12 +70,16 @@ public class SkinCompatDelegate implements LayoutInflater.Factory2 {
|
||||
}
|
||||
|
||||
List<SkinWrapper> wrapperList = SkinCompatManager.getInstance().getWrappers();
|
||||
for (SkinWrapper wrapper : wrapperList) {
|
||||
Context wrappedContext = wrapper.wrapContext(mContext, parent, attrs);
|
||||
if (wrappedContext != null) {
|
||||
context = wrappedContext;
|
||||
|
||||
if ( wrapperList != null ) {
|
||||
for (SkinWrapper wrapper : wrapperList) {
|
||||
Context wrappedContext = wrapper.wrapContext(mContext, parent, attrs);
|
||||
if (wrappedContext != null) {
|
||||
context = wrappedContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return mSkinCompatViewInflater.createView(parent, name, context, attrs);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user