opt
This commit is contained in:
@@ -281,4 +281,3 @@ def getGitCommit() {
|
||||
assert !gitCommit.isEmpty()
|
||||
gitCommit
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,330 @@
|
||||
package com.mogo.map.impl.amap.marker;
|
||||
|
||||
import com.amap.api.maps.AMap;
|
||||
import com.amap.api.maps.AMapUtils;
|
||||
import com.amap.api.maps.model.BasePointOverlay;
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.autonavi.amap.mapcore.IPoint;
|
||||
import com.autonavi.amap.mapcore.MapProjection;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.SynchronousQueue;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/6/15
|
||||
* <p>
|
||||
*/
|
||||
class CombineMovingPointOverlay {
|
||||
|
||||
private static final String TAG = "CombineMovingPointOverlay";
|
||||
|
||||
private AMap mAMap;
|
||||
private long mDuration = 1_000L;
|
||||
private long mStepDuration = 20L;
|
||||
private LinkedList< LatLng > mPoints = new LinkedList<>();
|
||||
private LinkedList< Double > mEachDistance = new LinkedList<>();
|
||||
|
||||
private double mTotalDistance = 0.0D;
|
||||
private double mRemainDistance = 0.0D;
|
||||
private ExecutorService mThreadPools;
|
||||
private Object mLock = new Object();
|
||||
private BasePointOverlay mBaseOverlay = null;
|
||||
private int mIndex = 0;
|
||||
private boolean mUseDefaultDescriptor = false;
|
||||
AtomicBoolean mExitFlag = new AtomicBoolean( false );
|
||||
private MoveListener mMoveListener;
|
||||
private Status mStatus;
|
||||
private long mPauseMillis;
|
||||
private long mAnimationBeginTime;
|
||||
|
||||
public CombineMovingPointOverlay( AMap amap, BasePointOverlay baseOverlay ) {
|
||||
mStatus = Status.Status1;
|
||||
mAnimationBeginTime = System.currentTimeMillis();
|
||||
if ( amap != null && baseOverlay != null ) {
|
||||
this.mAMap = amap;
|
||||
this.mBaseOverlay = baseOverlay;
|
||||
mThreadPools = new ThreadPoolExecutor( 1, 2, 5L, TimeUnit.SECONDS, new SynchronousQueue(), new ThreadFactoryImpl() );
|
||||
}
|
||||
}
|
||||
|
||||
public void setMoveListener( MoveListener moveListener ) {
|
||||
this.mMoveListener = moveListener;
|
||||
}
|
||||
|
||||
public void setPoints( List< LatLng > list ) {
|
||||
synchronized ( mLock ) {
|
||||
if ( list != null && list.size() >= 2 ) {
|
||||
stopMove();
|
||||
if ( mPoints != null ) {
|
||||
mPoints.clear();
|
||||
}
|
||||
Iterator< LatLng > iterator = list.listIterator();
|
||||
while ( iterator.hasNext() ) {
|
||||
LatLng latLng = iterator.next();
|
||||
if ( latLng != null ) {
|
||||
mPoints.add( latLng );
|
||||
}
|
||||
}
|
||||
|
||||
mEachDistance.clear();
|
||||
mTotalDistance = 0.0D;
|
||||
|
||||
for ( int i = 0; i < mPoints.size(); i++ ) {
|
||||
double distance = AMapUtils.calculateLineDistance( mPoints.get( i ), mPoints.get( i + 1 ) );
|
||||
mEachDistance.add( distance );
|
||||
mTotalDistance += distance;
|
||||
}
|
||||
|
||||
mRemainDistance = mTotalDistance;
|
||||
mBaseOverlay.setPosition( mPoints.get( 0 ) );
|
||||
reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int getIndex() {
|
||||
return mIndex;
|
||||
}
|
||||
|
||||
public BasePointOverlay getBaseOverlay() {
|
||||
return mBaseOverlay;
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
try {
|
||||
removeMarker();
|
||||
mThreadPools.shutdown();
|
||||
synchronized ( mLock ) {
|
||||
mPoints.clear();
|
||||
mEachDistance.clear();
|
||||
;
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void removeMarker() {
|
||||
try {
|
||||
reset();
|
||||
if ( mBaseOverlay != null ) {
|
||||
mBaseOverlay.remove();
|
||||
mBaseOverlay = null;
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
|
||||
public void stopMove() {
|
||||
if ( mStatus == Status.Status3 ) {
|
||||
mStatus = Status.Status4;
|
||||
mPauseMillis = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
|
||||
private void reset() {
|
||||
if ( mStatus == Status.Status3 || mStatus == Status.Status4 ) {
|
||||
mExitFlag.set( true );
|
||||
try {
|
||||
mThreadPools.awaitTermination( mStepDuration + 20L, TimeUnit.MICROSECONDS );
|
||||
mBaseOverlay.setAnimation( null );
|
||||
mStatus = Status.Status1;
|
||||
} catch ( InterruptedException e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void resetIndex() {
|
||||
mIndex = 0;
|
||||
}
|
||||
|
||||
|
||||
public void setTotalDuration( int seconds ) {
|
||||
mDuration = seconds * 1_000L;
|
||||
}
|
||||
|
||||
public void startSmoothMove() {
|
||||
if ( mStatus == Status.Status4 ) {
|
||||
mStatus = Status.Status3;
|
||||
long interval = System.currentTimeMillis() - mPauseMillis;
|
||||
mAnimationBeginTime += interval;
|
||||
} else {
|
||||
if ( mStatus == Status.Status1 || mStatus == Status.Status5 ) {
|
||||
if ( mPoints.size() <= 0 ) {
|
||||
return;
|
||||
}
|
||||
mIndex = 0;
|
||||
mThreadPools.execute( new MarkerMovingRunnable() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setVisible( boolean visible ) {
|
||||
if ( mBaseOverlay != null ) {
|
||||
try {
|
||||
mBaseOverlay.setVisible( visible );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class MarkerMovingRunnable implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
mAnimationBeginTime = System.currentTimeMillis();
|
||||
mStatus = Status.Status2;
|
||||
mExitFlag.set( false );
|
||||
|
||||
try {
|
||||
for ( ; !mExitFlag.get() && mIndex <= mPoints.size() - 1; Thread.sleep( mStepDuration ) ) {
|
||||
synchronized ( mLock ) {
|
||||
if ( mExitFlag.get() ) {
|
||||
return;
|
||||
}
|
||||
if ( mStatus == Status.Status4 ) {
|
||||
long interval = System.currentTimeMillis() - mAnimationBeginTime;
|
||||
IPoint point = getCurPosition( interval );
|
||||
mBaseOverlay.setGeoPoint( point );
|
||||
mStatus = Status.Status3;
|
||||
}
|
||||
}
|
||||
}
|
||||
mStatus = Status.Status5;
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private IPoint getCurPosition( long interval ) {
|
||||
if ( interval > mDuration ) {
|
||||
mExitFlag.set( true );
|
||||
IPoint point = new IPoint();
|
||||
mIndex = mPoints.size() - 1;
|
||||
LatLng latLng = mPoints.get( mIndex );
|
||||
--mIndex;
|
||||
mIndex = Math.max( mIndex, 0 );
|
||||
mRemainDistance = 0.0D;
|
||||
MapProjection.lonlat2Geo( latLng.longitude, latLng.latitude, point );
|
||||
if ( mMoveListener != null ) {
|
||||
mMoveListener.move( mRemainDistance );
|
||||
}
|
||||
return point;
|
||||
} else {
|
||||
double step = interval * mTotalDistance / mDuration;
|
||||
mRemainDistance = mTotalDistance - step;
|
||||
int targetIndex = 0;
|
||||
double val = 1.0D;
|
||||
|
||||
for ( int i = 0; i < mEachDistance.size(); i++ ) {
|
||||
double distance = mEachDistance.get( i );
|
||||
if ( step <= distance ) {
|
||||
if ( distance > 0.0D ) {
|
||||
val = step / distance;
|
||||
}
|
||||
targetIndex = i;
|
||||
break;
|
||||
}
|
||||
step -= distance;
|
||||
}
|
||||
|
||||
if ( targetIndex != mIndex && mMoveListener != null ) {
|
||||
mMoveListener.move( mRemainDistance );
|
||||
}
|
||||
|
||||
mIndex = targetIndex;
|
||||
LatLng latLng = mPoints.get( mIndex );
|
||||
LatLng latLng1 = mPoints.get( mIndex + 1 );
|
||||
IPoint point = new IPoint();
|
||||
MapProjection.lonlat2Geo( latLng.longitude, latLng.latitude, point );
|
||||
IPoint point1 = new IPoint();
|
||||
MapProjection.lonlat2Geo( latLng1.longitude, latLng1.latitude, point1 );
|
||||
|
||||
int xDelta = point1.x - point.x;
|
||||
int yDelta = point1.y - point.y;
|
||||
|
||||
if ( AMapUtils.calculateLineDistance( latLng, latLng1 ) > 1.0F ) {
|
||||
float rotate = getRotate( point, point1 );
|
||||
setRotate( rotate );
|
||||
}
|
||||
return new IPoint( ( ( int ) ( point.x + ( ( double ) xDelta ) * val ) ), ( ( int ) ( point.y + ( ( double ) yDelta ) * val ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
private float getRotate( IPoint point, IPoint point1 ) {
|
||||
if ( point != null && point1 != null ) {
|
||||
double py1 = ( double ) point1.y;
|
||||
double py = ( double ) point.y;
|
||||
double px = ( double ) point.x;
|
||||
return ( float ) ( Math.atan2( ( double ) point1.x - px, py - py1 ) / 3.141592653589793D * 180.0D );
|
||||
} else {
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
||||
|
||||
public void setPoint( LatLng latLng ) {
|
||||
if ( mBaseOverlay != null ) {
|
||||
try {
|
||||
mBaseOverlay.setPosition( latLng );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setRotate( float rotate ) {
|
||||
if ( mBaseOverlay == null ) {
|
||||
return;
|
||||
}
|
||||
if ( mAMap == null ) {
|
||||
return;
|
||||
}
|
||||
if ( mAMap.getCameraPosition() == null ) {
|
||||
return;
|
||||
}
|
||||
mBaseOverlay.setRotateAngle( 360.0F - rotate + mAMap.getCameraPosition().bearing );
|
||||
}
|
||||
|
||||
public LatLng getPosition() {
|
||||
if ( mBaseOverlay != null ) {
|
||||
return mBaseOverlay.getPosition();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private enum Status {
|
||||
Status1,
|
||||
Status2,
|
||||
Status3,
|
||||
Status4,
|
||||
Status5
|
||||
}
|
||||
|
||||
public interface MoveListener {
|
||||
void move( double val );
|
||||
}
|
||||
|
||||
private static class ThreadFactoryImpl implements ThreadFactory {
|
||||
|
||||
private static int mCounter = 1;
|
||||
|
||||
@Override
|
||||
public Thread newThread( Runnable r ) {
|
||||
return new Thread( r, "MoveSmoothThread - " + mCounter++ );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,8 @@ import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
*/
|
||||
public class AppsListActivity extends MvpActivity< AppsListView, AppsListPresenter > implements AppsListView, FragmentStackTransactionListener {
|
||||
|
||||
private static final String TAG = "AppsListActivity";
|
||||
|
||||
private BottomSheetBehavior mBottomSheetBehavior;
|
||||
private IMogoFragmentManager mMogoFragmentManager;
|
||||
|
||||
@@ -38,12 +40,13 @@ public class AppsListActivity extends MvpActivity< AppsListView, AppsListPresent
|
||||
|
||||
@Override
|
||||
protected void onCreate( @Nullable Bundle savedInstanceState ) {
|
||||
overridePendingTransition( R.anim.module_apps_anim_enter, 0);
|
||||
getWindow().addFlags( WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||
overridePendingTransition( R.anim.module_apps_anim_enter, 0 );
|
||||
getWindow().addFlags( WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS );
|
||||
if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ) {
|
||||
getWindow().setStatusBarColor( Color.BLACK );
|
||||
}
|
||||
super.onCreate( savedInstanceState );
|
||||
AppServiceHandler.getApis().getStatusManagerApi().setAppListUIShow( TAG, true );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -53,8 +56,9 @@ public class AppsListActivity extends MvpActivity< AppsListView, AppsListPresent
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
.add( R.id.module_apps_id_container, new AppsFragment() )
|
||||
.replace( R.id.module_apps_id_container, new AppsFragment() )
|
||||
.commitAllowingStateLoss();
|
||||
|
||||
mBottomSheetBehavior = BottomSheetBehavior.from( findViewById( R.id.module_apps_id_container ) );
|
||||
@@ -74,14 +78,14 @@ public class AppsListActivity extends MvpActivity< AppsListView, AppsListPresent
|
||||
} );
|
||||
mBottomSheetBehavior.setState( BottomSheetBehavior.STATE_EXPANDED );
|
||||
|
||||
mMogoFragmentManager = ( IMogoFragmentManager ) ARouter.getInstance().build( MogoServicePaths.PATH_FRAGMENT_MANAGER ).navigation( this );
|
||||
mMogoFragmentManager = AppServiceHandler.getApis().getFragmentManagerApi();
|
||||
mMogoFragmentManager.addMainFragmentStackTransactionListener( this );
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
protected AppsListPresenter createPresenter() {
|
||||
return new AppsListPresenter(this);
|
||||
return new AppsListPresenter( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -100,12 +104,13 @@ public class AppsListActivity extends MvpActivity< AppsListView, AppsListPresent
|
||||
@Override
|
||||
public void closeAppsPanel() {
|
||||
finish();
|
||||
overridePendingTransition( R.anim.module_apps_anim_enter, R.anim.module_apps_anim_exit);
|
||||
overridePendingTransition( R.anim.module_apps_anim_enter, R.anim.module_apps_anim_exit );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
AppServiceHandler.getApis().getStatusManagerApi().setAppListUIShow( TAG, false );
|
||||
mMogoFragmentManager.removeMainFragmentStackTransactionListener( this );
|
||||
mMogoFragmentManager = null;
|
||||
mBottomSheetBehavior = null;
|
||||
|
||||
@@ -72,7 +72,6 @@ public class AppsPresenter extends Presenter< AppsView > {
|
||||
|
||||
mAnalytics = mApis.getAnalyticsApi();
|
||||
mMogoStatusManager = mApis.getStatusManagerApi();
|
||||
mMogoStatusManager.setAppListUIShow( TAG, true );
|
||||
}
|
||||
|
||||
private void renderAppsList() {
|
||||
@@ -202,7 +201,6 @@ public class AppsPresenter extends Presenter< AppsView > {
|
||||
@Override
|
||||
public void onDestroy( @NonNull LifecycleOwner owner ) {
|
||||
super.onDestroy( owner );
|
||||
mMogoStatusManager.setAppListUIShow( TAG, false );
|
||||
AppsListChangedLiveData.getInstance().release();
|
||||
mView = null;
|
||||
mLauncher.destroy();
|
||||
|
||||
@@ -56,9 +56,9 @@ public class MapCenterPointStrategy {
|
||||
{
|
||||
// 导航场景 vs 道路事件展示场景,定位视图右下角偏下
|
||||
Map< Integer, MapCenterPoint > naviWithRoadEvent = new HashMap<>();
|
||||
naviWithRoadEvent.put( CarSeries.CAR_SERIES_D80X, new MapCenterPoint( 0.669444444444444, 0.68333333333D ) );
|
||||
naviWithRoadEvent.put( CarSeries.CAR_SERIES_E84X, new MapCenterPoint( 0.734375D, 0.68333333333D ) );
|
||||
naviWithRoadEvent.put( CarSeries.CAR_SERIES_E84XCD, new MapCenterPoint( 0.734375D, 0.68333333333D ) );
|
||||
naviWithRoadEvent.put( CarSeries.CAR_SERIES_D80X, new MapCenterPoint( 0.669444444444444, 0.73936170212766D ) );
|
||||
naviWithRoadEvent.put( CarSeries.CAR_SERIES_E84X, new MapCenterPoint( 0.734375D, 0.73936170212766D ) );
|
||||
naviWithRoadEvent.put( CarSeries.CAR_SERIES_E84XCD, new MapCenterPoint( 0.734375D, 0.73936170212766D ) );
|
||||
naviWithRoadEvent.put( CarSeries.CAR_SERIES_F80X, new MapCenterPoint( 0.705208333D, 0.683333333333D ) );
|
||||
sStrategies.put( Scene.NAVI_WITH_ROAD_EVENT, naviWithRoadEvent );
|
||||
}
|
||||
@@ -76,9 +76,9 @@ public class MapCenterPointStrategy {
|
||||
{
|
||||
// 巡航场景 vs 道路事件展示场景
|
||||
Map< Integer, MapCenterPoint > aimlessWithRoadEvent = new HashMap<>();
|
||||
aimlessWithRoadEvent.put( CarSeries.CAR_SERIES_D80X, new MapCenterPoint( 0.669444444444444, 0.585 ) );
|
||||
aimlessWithRoadEvent.put( CarSeries.CAR_SERIES_E84X, new MapCenterPoint( 0.734375D, 0.585 ) );
|
||||
aimlessWithRoadEvent.put( CarSeries.CAR_SERIES_E84XCD, new MapCenterPoint( 0.734375D, 0.585 ) );
|
||||
aimlessWithRoadEvent.put( CarSeries.CAR_SERIES_D80X, new MapCenterPoint( 0.669444444444444, 0.68617 ) );
|
||||
aimlessWithRoadEvent.put( CarSeries.CAR_SERIES_E84X, new MapCenterPoint( 0.734375D, 0.68617 ) );
|
||||
aimlessWithRoadEvent.put( CarSeries.CAR_SERIES_E84XCD, new MapCenterPoint( 0.734375D, 0.68617 ) );
|
||||
aimlessWithRoadEvent.put( CarSeries.CAR_SERIES_F80X, new MapCenterPoint( 0.705208333D, 0.599074074D ) );
|
||||
sStrategies.put( Scene.AIMLESS_WITH_ROAD_EVENT, aimlessWithRoadEvent );
|
||||
}
|
||||
|
||||
@@ -147,6 +147,8 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
|
||||
// 启动一些基本的服务:定位等
|
||||
startBaseService();
|
||||
|
||||
Log.i( "timer", "cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||
} );
|
||||
MogoModulesManager.getInstance().loadMapModule( R.id.module_main_id_map_fragment_container );
|
||||
|
||||
@@ -159,8 +161,6 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
hideLayout();
|
||||
}
|
||||
} );
|
||||
|
||||
Log.i( "timer", "cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||
}
|
||||
|
||||
private void startBaseService() {
|
||||
|
||||
@@ -647,6 +647,10 @@ public class MogoServices implements IMogoMapListener,
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !mStatusManager.isMainPageOnResume() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( mStatusManager.isSearchUIShow() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public class Utils {
|
||||
}
|
||||
|
||||
public static void main( String[] args ) {
|
||||
double calculateLineDistance = calculateLineDistance( new MogoLatLng( 39.955533, 116.423262 ), new MogoLatLng( 39.955385, 116.414604 ) );
|
||||
double calculateLineDistance = calculateLineDistance( new MogoLatLng( 39.968598, 116.411121 ), new MogoLatLng( 39.968598, 116.411121 ) );
|
||||
System.out.println( "距离点 calculateLineDistance:" + calculateLineDistance );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +120,11 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
Map< String, Object > properties = new HashMap<>();
|
||||
|
||||
if ( marker.getObject() instanceof MarkerShowEntity ) {
|
||||
properties.put( "sn", getCarSnFromMarker( marker ) );
|
||||
final String sn = getCarSnFromEntity( marker );
|
||||
if ( TextUtils.isEmpty( sn ) ) {
|
||||
return false;
|
||||
}
|
||||
properties.put( "sn", sn );
|
||||
if ( ( ( MarkerShowEntity ) marker.getObject() ).getBindObj() instanceof MarkerExploreWay ) {
|
||||
MarkerExploreWay exploreWay = ( MarkerExploreWay ) ( ( MarkerShowEntity ) marker.getObject() ).getBindObj();
|
||||
properties.put( "dbid", exploreWay.getInfoId() );
|
||||
@@ -482,7 +486,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
} else if ( entity instanceof MarkerNoveltyInfo ) {
|
||||
return ( ( MarkerNoveltyInfo ) entity ).getSn();
|
||||
} else if ( entity instanceof MarkerExploreWay ) {
|
||||
return ( ( MarkerExploreWay ) entity ).getInfoId();
|
||||
return ( ( MarkerExploreWay ) entity ).getUserInfo().getSn();
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
|
||||
@@ -844,6 +848,10 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
}
|
||||
|
||||
List< MogoLatLng > points = new ArrayList<>();
|
||||
|
||||
double lastLat = 0.0d;
|
||||
double lastLon = 0.0d;
|
||||
|
||||
for ( int j = 0; j < poiList.size(); j++ ) {
|
||||
MarkerCarPois poi = poiList.get( j );
|
||||
if ( poi == null || poi.getCoordinates() == null && poi.getCoordinates().size() != 2 ) {
|
||||
@@ -852,6 +860,14 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
try {
|
||||
double lat = Double.valueOf( poi.getCoordinates().get( 1 ) + "" );
|
||||
double lng = Double.valueOf( poi.getCoordinates().get( 0 ) + "" );
|
||||
|
||||
float distance = Utils.calculateLineDistance( lastLon, lastLat, lng, lat );
|
||||
lastLon = lng;
|
||||
lastLat = lat;
|
||||
if ( distance < 0.5f ) {// 距离过短,认为静止不动
|
||||
continue;
|
||||
}
|
||||
|
||||
points.add( new MogoLatLng( lat, lng ) );
|
||||
} catch ( Exception e ) {
|
||||
}
|
||||
@@ -859,6 +875,8 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
if ( points.size() >= 1 ) {
|
||||
points.add( new MogoLatLng( markerLocation.getLat(), markerLocation.getLon() ) );
|
||||
iMogoMarker.startSmooth( points, SMOOTH_DURATION );
|
||||
} else {
|
||||
Logger.d( TAG, "静止小车,但是有相同的连续坐标" );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -892,7 +910,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
return MarkerServiceHandler.getMogoStatusManager().isSearchUIShow()
|
||||
|| MarkerServiceHandler.getMogoStatusManager().isV2XShow()
|
||||
|| !MarkerServiceHandler.getMogoStatusManager().isMainPageLaunched()
|
||||
|| !MarkerServiceHandler.getMogoStatusManager().isMainPageLaunched();
|
||||
|| !MarkerServiceHandler.getMogoStatusManager().isMainPageOnResume();
|
||||
}
|
||||
|
||||
private void runOnTargetThread( Runnable runnable ) {
|
||||
|
||||
@@ -74,16 +74,17 @@ public class MogoADASController implements IMogoADASController {
|
||||
init( AbsMogoApplication.getApp() );
|
||||
}
|
||||
|
||||
if ( mStatusManager.isSearchUIShow() ) {
|
||||
return;
|
||||
}
|
||||
if ( !mStatusManager.isMainPageOnResume() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
int delay = CarSeries.getSeries() == CarSeries.CAR_SERIES_F80X ? 0 : 100;
|
||||
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
|
||||
if ( mStatusManager.isSearchUIShow() ) {
|
||||
return;
|
||||
}
|
||||
if ( !mStatusManager.isMainPageOnResume() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
AutopilotServiceManage.getInstance().showAdas();
|
||||
} catch ( Exception e ) {
|
||||
|
||||
Reference in New Issue
Block a user