merge
This commit is contained in:
@@ -214,7 +214,7 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
// 设置是否是第三APP登录
|
||||
clientConfig.setThirdLogin(false);
|
||||
// 设置是否输出日志
|
||||
clientConfig.setShowDebugLog(true);
|
||||
clientConfig.setShowDebugLog(DebugConfig.isDebug());
|
||||
// 设置从蘑菇AI开放平台获取的APPKey
|
||||
clientConfig.setThirdPartyAppKey("wbvpzgar");
|
||||
// 设置应用服务AppId 长链、鉴权
|
||||
|
||||
@@ -155,19 +155,19 @@ LOGLIB_VERSION = 1.0.4
|
||||
|
||||
######## MogoAiCloudSDK Version
|
||||
# 网络请求
|
||||
MOGO_NETWORK_VERSION=1.0.51
|
||||
MOGO_NETWORK_VERSION=1.0.55
|
||||
# 鉴权
|
||||
MOGO_PASSPORT_VERSION=1.0.51
|
||||
MOGO_PASSPORT_VERSION=1.0.55
|
||||
# 常链接
|
||||
MOGO_SOCKET_VERSION=1.0.51
|
||||
MOGO_SOCKET_VERSION=1.0.55
|
||||
# 数据采集
|
||||
MOGO_REALTIME_VERSION=1.0.53
|
||||
MOGO_REALTIME_VERSION=1.0.55
|
||||
# 探路,道路事件发布,获取
|
||||
MOGO_TANLU_VERSION=1.0.51
|
||||
MOGO_TANLU_VERSION=1.0.55
|
||||
# 直播推流
|
||||
MOGO_LIVE_VERSION=1.0.51
|
||||
MOGO_LIVE_VERSION=1.0.55
|
||||
# 直播拉流
|
||||
MOGO_TRAFFICLIVE_VERSION=1.0.51
|
||||
MOGO_TRAFFICLIVE_VERSION=1.0.55
|
||||
|
||||
######## Foundation MogoAiCloud Module
|
||||
# mogoAiCloud apk services
|
||||
|
||||
@@ -67,7 +67,7 @@ dependencies {
|
||||
implementation project(':foudations:mogo-commons')
|
||||
}
|
||||
|
||||
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-8.2.4'
|
||||
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-8.2.6'
|
||||
// implementation 'com.zhidaoauto.machine:map:1.0.0-vr-test-3.4'
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ class MapStyleController {
|
||||
private MapStyleController() {
|
||||
mVrAreaFilters.add( new ShunYiArea() );
|
||||
mVrAreaFilters.add( new OCHArea() );
|
||||
mVrAreaFilters.add( new HuiXinXiJieArea() );
|
||||
}
|
||||
|
||||
public static MapStyleController getInstance() {
|
||||
@@ -160,4 +161,27 @@ class MapStyleController {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static class HuiXinXiJieArea implements VrAreaFilter {
|
||||
|
||||
@Override
|
||||
public double getLeftBottomLat() {
|
||||
return 39.96741320378243;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getLeftBottomLon() {
|
||||
return 116.41045709250723;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getRightTopLat() {
|
||||
return 39.98232698552779;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getRightTopLon() {
|
||||
return 116.41879656379113;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -468,7 +468,7 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
return;
|
||||
}
|
||||
|
||||
List< LonLatPoint > newPoints = new ArrayList<>();
|
||||
ArrayList< LonLatPoint > newPoints = new ArrayList<>();
|
||||
for ( int i = 0; i < points.size(); i++ ) {
|
||||
LonLatPoint point = ObjectUtils.fromMogo( points.get( i ) );
|
||||
if ( point == null ) {
|
||||
@@ -480,6 +480,35 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// MarkerTranslateAnimation animation = new MarkerTranslateAnimation( newPoints );
|
||||
// animation.setDuration( duration );
|
||||
// animation.setAnimationListener( new MarkerAnimationListener() {
|
||||
// @Override
|
||||
// public void onAnimationStart( @NotNull Animation animation ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onAnimationEnd( @NotNull Animation animation ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// long lastTime = 0L;
|
||||
//
|
||||
// @Override
|
||||
// public void onAnimationRepeat( @NotNull Animation animation ) {
|
||||
// if ( lastTime == 0L ) {
|
||||
// lastTime = System.currentTimeMillis();
|
||||
// return;
|
||||
// }
|
||||
// Logger.d( TAG, "frame cost = %s", System.currentTimeMillis() - lastTime );
|
||||
// lastTime = System.currentTimeMillis();
|
||||
// }
|
||||
// } );
|
||||
// mMarker.setTranslateAnimation( animation );
|
||||
// mMarker.startAnimation();
|
||||
|
||||
mMarker.startSmooth( newPoints, ( int ) duration );
|
||||
// mMarker.addDynamicAnchorPostion( newPoints.get( newPoints.size() - 1 ), ( int ) duration );
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.graphics.Color;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
@@ -22,7 +23,10 @@ import com.mogo.map.search.poisearch.MogoPoiResult;
|
||||
import com.mogo.map.search.poisearch.MogoSearchBound;
|
||||
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
|
||||
import com.mogo.map.uicontroller.MapCameraPosition;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidaoauto.map.sdk.open.camera.CameraPosition;
|
||||
import com.zhidaoauto.map.sdk.open.data.MapDataApi;
|
||||
import com.zhidaoauto.map.sdk.open.data.SinglePointRoadInfo;
|
||||
import com.zhidaoauto.map.sdk.open.marker.BitmapDescriptor;
|
||||
import com.zhidaoauto.map.sdk.open.marker.BitmapDescriptorFactory;
|
||||
import com.zhidaoauto.map.sdk.open.marker.MarkerOptions;
|
||||
@@ -65,11 +69,26 @@ public class ObjectUtils {
|
||||
if ( icon == null || icon.isRecycled() ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
descriptors.add( new BitmapDescriptor( icon ) );
|
||||
}
|
||||
}
|
||||
|
||||
// 吸附到路边
|
||||
// if ( opt.isMatchOnRoadSide() ) {
|
||||
// double coors[] = new double[]{opt.getLongitude(), opt.getLatitude()};
|
||||
// if ( !opt.isGps() ) {
|
||||
// coors = CoordinateUtils.transformGcj02toWgs84( opt.getLatitude(), opt.getLongitude() );
|
||||
// opt.gps( true );
|
||||
// }
|
||||
// if ( coors != null ) {
|
||||
// SinglePointRoadInfo singlePointRoadInfo = MapDataApi.INSTANCE.getSinglePointMatchRoad( ( ( float ) coors[0] ), ( ( float ) coors[1] ), ( ( float ) opt.getRotate() ), true, true );
|
||||
// double data[] = PointInterpolatorUtil.mergeToRoad( coors[0], coors[1], singlePointRoadInfo.getCoords() );
|
||||
// if ( data != null ) {
|
||||
// opt.longitude( data[0] ).latitude( data[1] );
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
MarkerOptions markerOptions = new MarkerOptions()
|
||||
.position( new LonLatPoint( opt.getLongitude(), opt.getLatitude() ) )
|
||||
.anchor( opt.getU(), opt.getV() )
|
||||
@@ -85,7 +104,7 @@ public class ObjectUtils {
|
||||
// .draggable( opt.isDraggable() )
|
||||
.setInfoWindowOffset( opt.getOffsetX(), opt.getOffsetY() )
|
||||
.zIndex( opt.getzIndex() );
|
||||
if ( !TextUtils.isEmpty( opt.getResName() )) {
|
||||
if ( !TextUtils.isEmpty( opt.getResName() ) ) {
|
||||
markerOptions.setMarkerIconName( opt.getResName() );
|
||||
markerOptions.vrEnable( opt.is3DMode() );
|
||||
} else {
|
||||
|
||||
@@ -17,35 +17,6 @@ public class PointInterpolatorUtil {
|
||||
private static final String TAG = "PointInterpolatorUtil";
|
||||
private static final int DISTANCE_THRESHOLD = 2;
|
||||
|
||||
/**
|
||||
* 在两点之间插值
|
||||
*
|
||||
* @param start
|
||||
* @param end
|
||||
* @param frameInterval
|
||||
* @return
|
||||
*/
|
||||
public static List< MogoLatLng > interpolate( MogoLatLng start, MogoLatLng end, long frameInterval ) {
|
||||
if ( start == null || end == null ) {
|
||||
return null;
|
||||
}
|
||||
long locInterval = end.time - start.time;
|
||||
int interpolateFrame = ( int ) ( locInterval / frameInterval ) - 1;
|
||||
List< MogoLatLng > arrayList = new ArrayList<>();
|
||||
arrayList.add( start );
|
||||
if ( interpolateFrame > 0 ) {
|
||||
double lonStep = ( end.lon - start.lon ) / ( interpolateFrame + 1 );
|
||||
double latStep = ( end.lat - start.lat ) / ( interpolateFrame + 1 );
|
||||
for ( int i = 0; i < interpolateFrame; i++ ) {
|
||||
double lon = start.lon + lonStep * ( i + 1 );
|
||||
double lat = start.lat + latStep * ( i + 1 );
|
||||
arrayList.add( new MogoLatLng( lon, lat ) );
|
||||
}
|
||||
}
|
||||
arrayList.add( end );
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 在(x1,y1) (x2,y2)中间插入一些点,使每两个点之间距离<={@link #DISTANCE_THRESHOLD},利用如下公式进行计算
|
||||
* xn = x1 + (x2 - x1)*n/a
|
||||
|
||||
@@ -17,7 +17,6 @@ public class MogoLatLng implements Parcelable {
|
||||
@Deprecated
|
||||
public final double lng;
|
||||
public final double lon;
|
||||
public long time;
|
||||
|
||||
public MogoLatLng( double lat, double lon ) {
|
||||
this.lat = lat;
|
||||
@@ -43,14 +42,6 @@ public class MogoLatLng implements Parcelable {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public long getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime( long time ) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals( Object o ) {
|
||||
if ( this == o ) return true;
|
||||
@@ -83,14 +74,12 @@ public class MogoLatLng implements Parcelable {
|
||||
dest.writeDouble( this.lat );
|
||||
dest.writeDouble( this.lng );
|
||||
dest.writeDouble( this.lon );
|
||||
dest.writeLong( this.time );
|
||||
}
|
||||
|
||||
protected MogoLatLng( Parcel in ) {
|
||||
this.lat = in.readDouble();
|
||||
this.lng = in.readDouble();
|
||||
this.lon = in.readDouble();
|
||||
this.time = in.readLong();
|
||||
}
|
||||
|
||||
public static final Creator< MogoLatLng > CREATOR = new Creator< MogoLatLng >() {
|
||||
|
||||
@@ -86,6 +86,20 @@ public class MogoMarkerOptions extends Observable {
|
||||
*/
|
||||
private String mResName;
|
||||
|
||||
/**
|
||||
* 吸附在车道上
|
||||
*/
|
||||
private boolean mMatchOnRoadSide = true;
|
||||
|
||||
public MogoMarkerOptions matchOnRoadSide( boolean matchOnRoadSide ) {
|
||||
this.mMatchOnRoadSide = matchOnRoadSide;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isMatchOnRoadSide() {
|
||||
return mMatchOnRoadSide;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions resName( String resName ) {
|
||||
this.mResName = resName;
|
||||
return this;
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.mogo.module.common.drawer;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
@@ -17,6 +19,7 @@ import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -58,11 +61,11 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
}
|
||||
} else if ( msg.what == MSG_SET_POINT ) {
|
||||
if ( msg.obj instanceof MovingPoint ) {
|
||||
moveMarker( ( ( MovingPoint ) msg.obj ) );
|
||||
moveMarker( ( ( MovingPoint ) msg.obj ), msg.arg1 );
|
||||
}
|
||||
} else if( msg.what == MSG_SET_SPEED ){
|
||||
} else if ( msg.what == MSG_SET_SPEED ) {
|
||||
if ( msg.obj instanceof SpeedData ) {
|
||||
showSpeed( ( SpeedData ) msg.obj );
|
||||
showSpeed( ( SpeedData ) msg.obj );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -80,7 +83,12 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
Message msg = Message.obtain();
|
||||
msg.what = MSG_SET_POINT;
|
||||
msg.obj = points.get( i );
|
||||
mPointSettingHandler.sendMessageDelayed( msg, ( i + 1 ) * 10 );
|
||||
if ( i == 0 || i == points.size() - 1 ) {
|
||||
msg.arg1 = R.drawable.sr;
|
||||
} else {
|
||||
msg.arg1 = R.drawable.sy;
|
||||
}
|
||||
mPointSettingHandler.sendMessageDelayed( msg, points.get( i ).delay );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,14 +97,14 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
*
|
||||
* @param pointData
|
||||
*/
|
||||
private void moveMarker( MovingPoint pointData ) {
|
||||
private void moveMarker( MovingPoint pointData, int drId ) {
|
||||
if ( pointData == null ) {
|
||||
return;
|
||||
}
|
||||
pointData.move();
|
||||
}
|
||||
|
||||
private void showSpeed(SpeedData data){
|
||||
private void showSpeed( SpeedData data ) {
|
||||
if ( data == null ) {
|
||||
return;
|
||||
}
|
||||
@@ -126,7 +134,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
}
|
||||
|
||||
// adas marker 缓存
|
||||
private Map< String, IMogoMarker > mAdasRecognizedMarkersCaches = new ConcurrentHashMap<>();
|
||||
private Map< String, IMogoMarker > mAdasRecognizedMarkersCaches = new HashMap<>();
|
||||
|
||||
public boolean hasCached( String uniqueKey ) {
|
||||
return mAdasRecognizedMarkersCaches.containsKey( uniqueKey );
|
||||
@@ -143,7 +151,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
return;
|
||||
}
|
||||
|
||||
Map< String, IMogoMarker > newAdasRecognizedMarkersCaches = new ConcurrentHashMap<>();
|
||||
Map< String, IMogoMarker > newAdasRecognizedMarkersCaches = new HashMap<>();
|
||||
for ( ADASRecognizedResult recognizedListResult : resultList ) {
|
||||
if ( recognizedListResult == null ) {
|
||||
continue;
|
||||
@@ -158,6 +166,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
|
||||
/**
|
||||
* 绘制某个物体的一个数据
|
||||
*
|
||||
* @param recognizedListResult
|
||||
* @param newAdasRecognizedMarkersCaches
|
||||
*/
|
||||
@@ -171,7 +180,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
if ( TextUtils.isEmpty( uniqueKey ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
final long start = System.currentTimeMillis();
|
||||
double[] matchedPoint = SnapshotSetDataDrawer.getInstance().matchRoad( recognizedListResult.uuid, recognizedListResult.lon,
|
||||
recognizedListResult.lat,
|
||||
recognizedListResult.heading,
|
||||
@@ -210,29 +219,29 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
}
|
||||
newAdasRecognizedMarkersCaches.put( uniqueKey, marker );
|
||||
if ( lastPosition != null ) {
|
||||
MogoLatLng endLatLon = new MogoLatLng( recognizedListResult.lat, recognizedListResult.lon );
|
||||
long interval = computeAnimDuration( lastPosition.systemTime, recognizedListResult.systemTime, lastPosition.satelliteTime, recognizedListResult.satelliteTime );
|
||||
MogoLatLng lastPoint = new MogoLatLng( lastPosition.lat, lastPosition.lon );
|
||||
lastPoint.setTime( lastPosition.satelliteTime );
|
||||
endLatLon.setTime( recognizedListResult.satelliteTime );
|
||||
MovingPoint endPoint = new MovingPoint();
|
||||
endPoint.point = endLatLon;
|
||||
endPoint.marker = marker;
|
||||
endPoint.angle = ( float ) recognizedListResult.heading;
|
||||
|
||||
MovingPoint startPoint = new MovingPoint();
|
||||
startPoint.point = lastPoint;
|
||||
startPoint.point = new MogoLatLng( lastPosition.lat, lastPosition.lon );
|
||||
startPoint.marker = marker;
|
||||
startPoint.delay = 0L;
|
||||
startPoint.angle = ( float ) lastPosition.heading;
|
||||
List< MovingPoint > points = interpolate( startPoint, endPoint, 30, interval );
|
||||
|
||||
long cost = System.currentTimeMillis() - start;
|
||||
MovingPoint endPoint = new MovingPoint();
|
||||
endPoint.point = new MogoLatLng( recognizedListResult.lat, recognizedListResult.lon );
|
||||
endPoint.marker = marker;
|
||||
endPoint.angle = ( float ) recognizedListResult.heading;
|
||||
interval -= cost;
|
||||
endPoint.delay = interval;
|
||||
|
||||
List< MovingPoint > points = interpolate( startPoint, endPoint, interval );
|
||||
Message msg = new Message();
|
||||
MovingPoints obj = new MovingPoints();
|
||||
obj.points = points;
|
||||
msg.obj = obj;
|
||||
msg.what = MSG_POINTS_SETTING;
|
||||
mPointSettingHandler.sendMessage( msg );
|
||||
// marker.startSmoothInMs( points, interval );
|
||||
// marker.addDynamicAnchorPosition( endLatLon, interval );
|
||||
Logger.d( TAG, "anim duration: %s, points size = %s", interval, points.size() );
|
||||
} else {
|
||||
marker.setRotateAngle( ( ( float ) recognizedListResult.heading ) );
|
||||
|
||||
@@ -38,6 +38,11 @@ class BaseDrawer {
|
||||
public static final int MSG_REMOVE_DIRTY_MARKERS = 9990;
|
||||
public static final int MSG_REMOVE_ADAS_MARKERS = 9992;
|
||||
|
||||
/**
|
||||
* 地图刷新频率
|
||||
*/
|
||||
public static final int MAP_RENDER_FRAME_FREQUENCY = 25;
|
||||
|
||||
/**
|
||||
* 地图内部资源md5缓存,便于资源复用
|
||||
*/
|
||||
@@ -234,20 +239,26 @@ class BaseDrawer {
|
||||
*
|
||||
* @param start
|
||||
* @param end
|
||||
* @param frameInterval
|
||||
* @return
|
||||
*/
|
||||
public static List< MovingPoint > interpolate( MovingPoint start, MovingPoint end, long frameInterval, long duration ) {
|
||||
public static List< MovingPoint > interpolate( MovingPoint start, MovingPoint end, long duration ) {
|
||||
if ( start == null || end == null ) {
|
||||
return null;
|
||||
}
|
||||
int interpolateFrame = ( int ) ( duration / frameInterval ) - 1;
|
||||
|
||||
int interpolateFrame = ( int ) ( duration / MAP_RENDER_FRAME_FREQUENCY );
|
||||
if ( duration % MAP_RENDER_FRAME_FREQUENCY < MAP_RENDER_FRAME_FREQUENCY / 2 ) {
|
||||
interpolateFrame -= 1;
|
||||
}
|
||||
// if ( interpolateFrame == 0 ) {
|
||||
// interpolateFrame = 1;
|
||||
// }
|
||||
List< MovingPoint > arrayList = new ArrayList<>();
|
||||
double _angle = ( end.angle + start.angle ) / 2;
|
||||
if ( Math.abs( end.angle - start.angle ) > 5 ) {
|
||||
_angle = Math.atan2( Math.abs( start.point.lon - end.point.lon ), Math.abs( start.point.lat - end.point.lat ) ) * ( 180 / PI );
|
||||
}
|
||||
arrayList.add( start );
|
||||
// arrayList.add( start );
|
||||
if ( interpolateFrame > 0 ) {
|
||||
double lonStep = ( end.point.lon - start.point.lon ) / ( interpolateFrame + 1 );
|
||||
double latStep = ( end.point.lat - start.point.lat ) / ( interpolateFrame + 1 );
|
||||
@@ -256,6 +267,7 @@ class BaseDrawer {
|
||||
double lat = start.point.lat + latStep * ( i + 1 );
|
||||
MovingPoint pd = new MovingPoint();
|
||||
pd.point = new MogoLatLng( lat, lon );
|
||||
pd.delay = ( i + i ) * MAP_RENDER_FRAME_FREQUENCY;
|
||||
pd.angle = ( float ) _angle;
|
||||
pd.marker = start.marker;
|
||||
arrayList.add( pd );
|
||||
@@ -273,6 +285,7 @@ class BaseDrawer {
|
||||
public MogoLatLng point;
|
||||
public float angle;
|
||||
public IMogoMarker marker;
|
||||
public long delay;
|
||||
|
||||
public void move() {
|
||||
try {
|
||||
|
||||
@@ -60,14 +60,18 @@ class MarkerDrawer {
|
||||
}
|
||||
|
||||
public IMogoMarker drawMapMarkerImpl( MarkerShowEntity markerShowEntity, int zIndex, IMogoMarkerClickListener listener ) {
|
||||
return drawMapMarkerImpl(markerShowEntity, zIndex, 0, listener);
|
||||
return drawMapMarkerImpl( markerShowEntity, false, zIndex, 0, listener );
|
||||
}
|
||||
|
||||
public IMogoMarker drawMapMarkerImpl( MarkerShowEntity markerShowEntity, int zIndex, int icon3DRes, IMogoMarkerClickListener listener ) {
|
||||
public IMogoMarker drawMapMarkerImpl( MarkerShowEntity markerShowEntity, boolean matchRoadSide, int zIndex, IMogoMarkerClickListener listener ) {
|
||||
return drawMapMarkerImpl( markerShowEntity, matchRoadSide, zIndex, 0, listener );
|
||||
}
|
||||
|
||||
public IMogoMarker drawMapMarkerImpl( MarkerShowEntity markerShowEntity, boolean matchRoadSide, int zIndex, int icon3DRes, IMogoMarkerClickListener listener ) {
|
||||
if ( markerShowEntity == null || markerShowEntity.getMarkerLocation() == null ) {
|
||||
return null;
|
||||
}
|
||||
MogoMarkerOptions options = new MogoMarkerOptions().icon3DRes( icon3DRes ).owner( markerShowEntity.getMarkerType() ).zIndex( zIndex ).object( markerShowEntity ).latitude( markerShowEntity.getMarkerLocation().getLat() ).longitude( markerShowEntity.getMarkerLocation().getLon() );
|
||||
MogoMarkerOptions options = new MogoMarkerOptions().icon3DRes( icon3DRes ).matchOnRoadSide( matchRoadSide ).owner( markerShowEntity.getMarkerType() ).zIndex( zIndex ).object( markerShowEntity ).latitude( markerShowEntity.getMarkerLocation().getLat() ).longitude( markerShowEntity.getMarkerLocation().getLon() );
|
||||
IMarkerView markerView = MapMarkerAdapter.getMarkerView( AbsMogoApplication.getApp(), markerShowEntity, options );
|
||||
if ( markerView instanceof OnlineCarMarkerView ) {
|
||||
try {
|
||||
|
||||
@@ -105,7 +105,7 @@ class OnlineCarDrawer {
|
||||
String sn = MarkerDrawer.getInstance().getPrimaryKeyFromEntity( markerOnlineCar );
|
||||
IMogoMarker mogoMarker = existCarMap.get( sn );
|
||||
if ( mogoMarker == null || mogoMarker.isDestroyed() ) {
|
||||
mogoMarker = MarkerDrawer.getInstance().drawMapMarkerImpl( markerShowEntity, MarkerDrawer.MARKER_Z_INDEX_LOW, R.raw.taxi, listener );
|
||||
mogoMarker = MarkerDrawer.getInstance().drawMapMarkerImpl( markerShowEntity, false, MarkerDrawer.MARKER_Z_INDEX_LOW, R.raw.taxi, listener );
|
||||
}
|
||||
if ( mogoMarker != null ) {
|
||||
mogoMarker.setVisible( true );
|
||||
|
||||
@@ -86,14 +86,14 @@ class RoadConditionDrawer {
|
||||
Logger.d( TAG, "draw road condition, sn = %s", sn );
|
||||
try {
|
||||
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
mogoMarker = MarkerDrawer.getInstance().drawMapMarkerImpl( markerShowEntity, MarkerDrawer.MARKER_Z_INDEX_HIGH, listener );
|
||||
mogoMarker = MarkerDrawer.getInstance().drawMapMarkerImpl( markerShowEntity, true, MarkerDrawer.MARKER_Z_INDEX_HIGH, listener );
|
||||
mogoMarker.setInfoWindowAdapter( new RoadConditionInfoWindow3DAdapter( markerShowEntity, AbsMogoApplication.getApp(), mogoMarker.getMogoMarkerOptions() ) );
|
||||
mogoMarker.showInfoWindow();
|
||||
} else {
|
||||
if ( DebugConfig.isRoadEventAnimated() ) {
|
||||
post2AddAndStartAnimation( markerShowEntity, i * 100L, listener );
|
||||
} else {
|
||||
mogoMarker = MarkerDrawer.getInstance().drawMapMarkerImpl( markerShowEntity, MarkerDrawer.MARKER_Z_INDEX_HIGH, listener );
|
||||
mogoMarker = MarkerDrawer.getInstance().drawMapMarkerImpl( markerShowEntity, false, MarkerDrawer.MARKER_Z_INDEX_HIGH, listener );
|
||||
}
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.os.Handler;
|
||||
import android.os.HandlerThread;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.os.SystemClock;
|
||||
import android.text.TextUtils;
|
||||
import android.util.ArrayMap;
|
||||
|
||||
@@ -66,7 +67,23 @@ public class SimpleHandlerThreadPool {
|
||||
Message msg = Message.obtain();
|
||||
msg.what = MSG_SET_POINT;
|
||||
msg.obj = points.get( i );
|
||||
renderHandler.sendMessageDelayed( msg, ( i + 1 ) * 10 );
|
||||
renderHandler.sendMessageDelayed( msg, points.get(i).delay );
|
||||
}
|
||||
}
|
||||
|
||||
private long startMove = 0;
|
||||
private int lastIndex = 0;
|
||||
|
||||
private void slowTest(){
|
||||
if (startMove == 0) {
|
||||
startMove = SystemClock.uptimeMillis();
|
||||
} else {
|
||||
long diff = SystemClock.uptimeMillis() - startMove;
|
||||
int index = (int) (diff / 30);
|
||||
if (index - lastIndex > 1) {
|
||||
Logger.e("MapRenderSlow", "miss " + (index - lastIndex) + " diff: " + diff);
|
||||
}
|
||||
lastIndex = index;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,10 +92,11 @@ public class SimpleHandlerThreadPool {
|
||||
*
|
||||
* @param pointData
|
||||
*/
|
||||
private void moveMarker( BaseDrawer.MovingPoint pointData ) {
|
||||
if ( pointData == null ) {
|
||||
private void moveMarker(BaseDrawer.MovingPoint pointData) {
|
||||
if (pointData == null) {
|
||||
return;
|
||||
}
|
||||
// slowTest();
|
||||
pointData.move();
|
||||
}
|
||||
|
||||
@@ -175,6 +193,8 @@ public class SimpleHandlerThreadPool {
|
||||
return;
|
||||
}
|
||||
|
||||
final long start = System.currentTimeMillis();
|
||||
|
||||
IMogoMarker marker = markerCache.get( uniqueKey );
|
||||
CloudRoadData lastPosition = roadDataCache.put( uniqueKey, cloudRoadData );
|
||||
if ( marker == null || marker.isDestroyed() ) {
|
||||
@@ -218,25 +238,28 @@ public class SimpleHandlerThreadPool {
|
||||
|
||||
SnapshotSetDataDrawer.getInstance().changeIconResourceIfNecessary( cloudRoadData, marker );
|
||||
|
||||
// final IMogoMarker finalMarker = marker;
|
||||
final IMogoMarker finalMarker = marker;
|
||||
Logger.d( TAG, "work in " + Thread.currentThread().getName() );
|
||||
|
||||
if ( lastPosition != null ) {
|
||||
MogoLatLng endLatLon = new MogoLatLng( cloudRoadData.getWgslat(),cloudRoadData.getWgslon() );
|
||||
long interval = SnapshotSetDataDrawer.getInstance().computeAnimDuration( lastPosition.getSystemTime(), cloudRoadData.getSystemTime(), lastPosition.getSatelliteTime(), cloudRoadData.getSatelliteTime() );
|
||||
|
||||
long cost = System.currentTimeMillis() - start;
|
||||
interval -= cost;
|
||||
MogoLatLng lastPoint = new MogoLatLng( lastPosition.getWgslat(), lastPosition.getWgslon() );
|
||||
lastPoint.setTime( lastPosition.getSatelliteTime() );
|
||||
endLatLon.setTime( cloudRoadData.getSatelliteTime() );
|
||||
BaseDrawer.MovingPoint endPoint = new BaseDrawer.MovingPoint();
|
||||
endPoint.point = endLatLon;
|
||||
endPoint.marker = marker;
|
||||
endPoint.delay = interval;
|
||||
endPoint.angle = ( float ) cloudRoadData.getHeading();
|
||||
|
||||
BaseDrawer.MovingPoint startPoint = new BaseDrawer.MovingPoint();
|
||||
startPoint.point = lastPoint;
|
||||
startPoint.marker = marker;
|
||||
startPoint.delay = 0;
|
||||
startPoint.angle = ( float ) lastPosition.getHeading();
|
||||
List< BaseDrawer.MovingPoint > points = BaseDrawer.interpolate( startPoint, endPoint, 20, interval );
|
||||
List< BaseDrawer.MovingPoint > points = BaseDrawer.interpolate( startPoint, endPoint, interval );
|
||||
Message msg = new Message();
|
||||
BaseDrawer.MovingPoints obj = new BaseDrawer.MovingPoints();
|
||||
obj.points = points;
|
||||
@@ -261,6 +284,7 @@ public class SimpleHandlerThreadPool {
|
||||
// // 由于地图现在不支持addDynamicAnchorPosition并发,所以工作线程仅做相关计算,真正绘制发送到另外一条绘制线程中做
|
||||
// if ( lastPosition != null && !lastPosition.equals( cloudRoadData ) ) {
|
||||
// long interval = SystemClock.uptimeMillis() - lastExecutionTimeCache.get( uniqueKey );
|
||||
// interval = cloudRoadData.getSystemTime() - lastPosition.getSystemTime();
|
||||
// finalMarker.addDynamicAnchorPosition( new MogoLatLng( cloudRoadData.getWgslat(), cloudRoadData.getWgslon() ), interval );
|
||||
// Logger.d( TAG, "anim duration: %s in thread: %s", interval, Thread.currentThread().getName() );
|
||||
// } else {
|
||||
|
||||
BIN
modules/mogo-module-common/src/main/res/drawable/sr.png
Normal file
BIN
modules/mogo-module-common/src/main/res/drawable/sr.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 145 B |
BIN
modules/mogo-module-common/src/main/res/drawable/sy.png
Normal file
BIN
modules/mogo-module-common/src/main/res/drawable/sy.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 145 B |
File diff suppressed because one or more lines are too long
1
modules/mogo-module-service/src/main/assets/loc3.txt
Normal file
1
modules/mogo-module-service/src/main/assets/loc3.txt
Normal file
File diff suppressed because one or more lines are too long
4232
modules/mogo-module-service/src/main/assets/snapshot2.txt
Normal file
4232
modules/mogo-module-service/src/main/assets/snapshot2.txt
Normal file
File diff suppressed because it is too large
Load Diff
@@ -28,11 +28,14 @@ import com.mogo.map.search.geo.MogoGeocodeResult;
|
||||
import com.mogo.map.search.geo.MogoRegeocodeResult;
|
||||
import com.mogo.map.search.geo.query.MogoRegeocodeQuery;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.constants.DataTypes;
|
||||
import com.mogo.module.common.dialog.WMDialog;
|
||||
import com.mogo.module.common.drawer.AdasRecognizedResultDrawer;
|
||||
import com.mogo.module.common.drawer.SnapshotSetDataDrawer;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.R;
|
||||
import com.mogo.module.service.uploadintime.SnapshotLocationController;
|
||||
import com.mogo.realtime.core.SnapshotUploadInTime;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.realtime.entity.CloudRoadData;
|
||||
import com.mogo.realtime.entity.MogoSnapshotSetData;
|
||||
@@ -557,11 +560,28 @@ public class MockIntentHandler implements IntentHandler {
|
||||
break;
|
||||
case 47:
|
||||
mLocationMockHandler.sendEmptyMessageDelayed( 1, 200L );
|
||||
mLocationMockHandler.sendEmptyMessageDelayed( 2, 0 );
|
||||
// mLocationMockHandler.sendEmptyMessageDelayed( 2, 0 );
|
||||
// mLocationMockHandler.sendEmptyMessageDelayed( 21, 200 );
|
||||
// mLocationMockHandler.sendEmptyMessageDelayed( 3, 0L );
|
||||
mLocationMockHandler.sendEmptyMessageDelayed( 3, 0L );
|
||||
// mLocationMockHandler.sendEmptyMessageDelayed( 5, 0L );
|
||||
break;
|
||||
case 48:
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.owner( DataTypes.TYPE_MARKER_ADAS )
|
||||
.anchor( 0.5f, 0.5f )
|
||||
.set3DMode( true )
|
||||
.position( new MogoLatLng( 39.981971055705,116.41150648393 ) )
|
||||
.gps( true )
|
||||
.controlAngle( true )
|
||||
.icon3DRes( R.raw.cargrey )
|
||||
.rotate( ( float ) 358.526123 );
|
||||
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( context ).addMarker( DataTypes.TYPE_MARKER_ADAS, options );
|
||||
List<MogoLatLng> latLngs = new ArrayList<>( );
|
||||
latLngs.add( new MogoLatLng( 39.981971055705,116.41150648393 ) );
|
||||
latLngs.add( new MogoLatLng( 39.981990561932,116.412893641626 ) );
|
||||
marker.startSmoothInMs(latLngs, 20_000L );
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -647,6 +667,17 @@ public class MockIntentHandler implements IntentHandler {
|
||||
}
|
||||
br5 = null;
|
||||
}
|
||||
} else if ( msg.what == 48 ) {
|
||||
try {
|
||||
handleMockLocationIntent48();
|
||||
} catch ( Exception e ) {
|
||||
try {
|
||||
br48.close();
|
||||
} catch ( IOException ex ) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
br48 = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -663,17 +694,41 @@ public class MockIntentHandler implements IntentHandler {
|
||||
throw new Exception( "end of file." );
|
||||
}
|
||||
JSONObject jo = new JSONObject( line );
|
||||
jo.put( "satelliteTime", System.currentTimeMillis() );
|
||||
jo.put( "systemTime", System.currentTimeMillis() );
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map( jo );
|
||||
SnapshotLocationController.getInstance().syncAdasLocationInfo( jo );
|
||||
Log.i( "mock-timer-loc", "cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||
mLocationMockHandler.sendEmptyMessageDelayed( 1, 100L );
|
||||
return true;
|
||||
}
|
||||
|
||||
private BufferedReader br48;
|
||||
int count = 0;
|
||||
|
||||
private boolean handleMockLocationIntent48() throws Exception {
|
||||
if ( br48 == null ) {
|
||||
br48 = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "loc3.txt" ) ) );
|
||||
}
|
||||
final long start = System.currentTimeMillis();
|
||||
String line = br48.readLine();
|
||||
if ( line == null ) {
|
||||
throw new Exception( "end of file." );
|
||||
}
|
||||
JSONObject jo = new JSONObject( line );
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map( jo );
|
||||
Logger.i( "mock-timer-loc", "cost " + ( System.currentTimeMillis() - start ) + "ms: count=%s", ++count );
|
||||
mLocationMockHandler.sendEmptyMessageDelayed( 48, 100L );
|
||||
return true;
|
||||
}
|
||||
|
||||
private BufferedReader br2;
|
||||
|
||||
private long last = 0;
|
||||
|
||||
private boolean handleMockSnapshotIntent() throws Exception {
|
||||
if ( br2 == null ) {
|
||||
br2 = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "snapshot.txt" ) ) );
|
||||
br2 = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "snapshot2.txt" ) ) );
|
||||
}
|
||||
String line = br2.readLine();
|
||||
if ( line == null ) {
|
||||
@@ -688,15 +743,20 @@ public class MockIntentHandler implements IntentHandler {
|
||||
// double[] coor = CoordinateUtils.transformWgsToGcj( cloudRoadData.getLat(), cloudRoadData.getLon() );
|
||||
// cloudRoadData.setLon( coor[0] );
|
||||
// cloudRoadData.setLat( coor[1] );
|
||||
cloudRoadData.setWgslat(cloudRoadData.getLat());
|
||||
cloudRoadData.setWgslon(cloudRoadData.getLon());
|
||||
cloudRoadData.setWgslat( cloudRoadData.getLat() );
|
||||
cloudRoadData.setWgslon( cloudRoadData.getLon() );
|
||||
allList.add( cloudRoadData );
|
||||
data.setAllList( allList );
|
||||
|
||||
final long start = System.currentTimeMillis();
|
||||
SnapshotSetDataDrawer.getInstance().renderSnapshotData( data );
|
||||
Log.i( "mock-timer-snapshot", "cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||
mLocationMockHandler.sendEmptyMessageDelayed( 2, 100L );
|
||||
long delay = 100;
|
||||
if (last != 0){
|
||||
delay = cloudRoadData.getSystemTime() - last;
|
||||
}
|
||||
last = cloudRoadData.getSystemTime();
|
||||
mLocationMockHandler.sendEmptyMessageDelayed( 2, delay );
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -731,6 +791,7 @@ public class MockIntentHandler implements IntentHandler {
|
||||
}
|
||||
|
||||
private BufferedReader br3;
|
||||
private long lastTime = 0;
|
||||
|
||||
private boolean handleMockAdasIntent() throws Exception {
|
||||
if ( br3 == null ) {
|
||||
@@ -751,6 +812,7 @@ public class MockIntentHandler implements IntentHandler {
|
||||
allList.add( adasRecognizedResult );
|
||||
|
||||
final long start = System.currentTimeMillis();
|
||||
|
||||
AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult( allList );
|
||||
Log.i( "mock-timer-adas", "cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||
mLocationMockHandler.sendEmptyMessageDelayed( 3, 100L );
|
||||
|
||||
@@ -44,11 +44,30 @@ class LogWriter {
|
||||
super.handleMessage( msg );
|
||||
if ( msg.what == 100 ) {
|
||||
writeImpl( msg.obj );
|
||||
} else if ( msg.what == 101 ) {
|
||||
writeImpl( msg.obj, msg.arg1 );
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void writeImpl( Object log, int time ) {
|
||||
try {
|
||||
FileWriter fw = new FileWriter( path, true );
|
||||
fw.append( time + " - " );
|
||||
if ( log instanceof CharSequence ) {
|
||||
fw.append( ( ( CharSequence ) log ) );
|
||||
} else {
|
||||
fw.append( GsonUtil.jsonFromObject( log ) );
|
||||
}
|
||||
fw.append( "\n" );
|
||||
fw.flush();
|
||||
fw.close();
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void writeImpl( Object log ) {
|
||||
try {
|
||||
FileWriter fw = new FileWriter( path, true );
|
||||
@@ -72,4 +91,12 @@ class LogWriter {
|
||||
msg.what = 100;
|
||||
writeHandler.sendMessage( msg );
|
||||
}
|
||||
|
||||
public void write( Object log, long recTime ) {
|
||||
Message msg = Message.obtain();
|
||||
msg.obj = log;
|
||||
msg.what = 101;
|
||||
msg.arg1 = ( int ) ( System.currentTimeMillis() - recTime );
|
||||
writeHandler.sendMessage( msg );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -326,11 +326,23 @@ public class MogoADASController implements IMogoADASController {
|
||||
}
|
||||
}
|
||||
|
||||
private LogWriter locLogWriter;
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void ownerCarStateInfo( String ownerCarStateInfo ) {
|
||||
if ( locLogWriter == null ) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat( "yyyyMMddhhmmss" );
|
||||
String date = sdf.format( new Date() );
|
||||
String path = context.getExternalCacheDir().getAbsolutePath() + "/adaslog/" + date + "/loc.txt";
|
||||
Logger.d( TAG, path );
|
||||
locLogWriter = new LogWriter( path );
|
||||
}
|
||||
|
||||
final long start = System.currentTimeMillis();
|
||||
ADASCarStateInfo stateInfo = GsonUtil.objectFromJson( ownerCarStateInfo, ADASCarStateInfo.class );
|
||||
long cost = System.currentTimeMillis() - start;
|
||||
locLogWriter.write( ownerCarStateInfo, Long.valueOf( stateInfo.getValues().getReceiverDataTime() ) - cost );
|
||||
if ( stateInfo == null || stateInfo.getValues() == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user