This commit is contained in:
wangcongtao
2020-04-30 19:53:08 +08:00
parent ce2dddc280
commit 86d7084b0b
4 changed files with 26 additions and 22 deletions

View File

@@ -452,20 +452,20 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
mMovingPointOverlay.setTotalDuration( duration );
mMovingPointOverlay.setMoveListener( v -> {
try {
LatLng position = mMovingPointOverlay.getPosition();
Point point = AMapWrapper.getAMap().getProjection().toScreenLocation( position );
if ( point.x < 0 || point.x > WindowUtils.getScreenWidth( AbsMogoApplication.getApp() )
|| point.y < 0 || point.y > WindowUtils.getScreenHeight( AbsMogoApplication.getApp() ) ) {
if ( mMarker.isVisible() ) {
mMovingPointOverlay.setVisible( false );
Logger.d( TAG, "hide moving marker" );
}
} else {
if ( !mMarker.isVisible() ) {
mMovingPointOverlay.setVisible( true );
Logger.d( TAG, "show moving marker" );
}
}
// LatLng position = mMovingPointOverlay.getPosition();
// Point point = AMapWrapper.getAMap().getProjection().toScreenLocation( position );
// if ( point.x < 0 || point.x > WindowUtils.getScreenWidth( AbsMogoApplication.getApp() )
// || point.y < 0 || point.y > WindowUtils.getScreenHeight( AbsMogoApplication.getApp() ) ) {
// if ( mMarker.isVisible() ) {
// mMovingPointOverlay.setVisible( false );
// Logger.d( TAG, "hide moving marker" );
// }
// } else {
// if ( !mMarker.isVisible() ) {
// mMovingPointOverlay.setVisible( true );
// Logger.d( TAG, "show moving marker" );
// }
// }
} catch ( Exception e ) {
Logger.e( TAG, e, "error." );
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 126 KiB

View File

@@ -278,6 +278,7 @@ public class MogoServices implements IMogoMapListener,
public void init( Context context ) {
mContext = context;
initWorkThread();
MarkerServiceHandler.init( mContext );
mRefreshModel = new RefreshModel( context );
@@ -325,7 +326,6 @@ public class MogoServices implements IMogoMapListener,
mCardManager = MarkerServiceHandler.getMogoCardManager();
mFragmentManager.addMainFragmentStackTransactionListener( this );
initWorkThread();
}
private void initWorkThread() {
@@ -452,6 +452,8 @@ public class MogoServices implements IMogoMapListener,
break;
case MotionEvent.ACTION_UP:
restartAutoRefreshAtTime( ServiceConst.DEFAULT_AUTO_REFRESH_WHEN_INTERRUPT );
mThreadHandler.removeMessages( ServiceConst.MSG_LOCK_CAR );
mThreadHandler.sendEmptyMessageDelayed( ServiceConst.MSG_LOCK_CAR, ServiceConst.DEFAULT_AUTO_REFRESH_WHEN_INTERRUPT );
break;
}
}
@@ -490,6 +492,8 @@ public class MogoServices implements IMogoMapListener,
@Override
public void onMapChanged( MogoLatLng latLng, float zoom, float tilt, float bearing ) {
MapMarkerManager.getInstance().syncLocation( latLng.lon, latLng. lat );
if ( mIsCameraInited ) {
mLastZoomLevel = zoom;
mLastCustomRefreshCenterLocation = latLng;
@@ -608,7 +612,6 @@ public class MogoServices implements IMogoMapListener,
mLastAutoRefreshLocation = point;
notifyRefreshData( mLastAutoRefreshLocation, getQueryRadius(), mAutoRefreshCallback );
}
MapMarkerManager.getInstance().syncLocation( latLng.getLongitude(), latLng.getLatitude() );
}
@Override

View File

@@ -1,6 +1,7 @@
package com.mogo.module.service.marker;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import android.view.animation.BounceInterpolator;
import android.view.animation.OvershootInterpolator;
@@ -865,7 +866,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
return;
}
runOnTargetThread( () -> {
drawOnlineCarMarkers( onlineCarList, ServiceConst.MAX_AMOUNT_SINGLE_CARD );
drawOnlineCarMarkers( onlineCarList, Integer.MAX_VALUE );
} );
}
@@ -910,7 +911,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
return;
}
List<MogoLatLng> points = new ArrayList<>();
List<MogoLatLng> points = new ArrayList<>();
for ( int j = 0; j < poiList.size(); j++ ) {
MarkerCarPois poi = poiList.get( j );
if ( poi == null || poi.getCoordinates() == null && poi.getCoordinates().size() != 2 ) {
@@ -919,13 +920,12 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
try {
double lat = Double.valueOf( poi.getCoordinates().get( 1 ) + "" );
double lng = Double.valueOf( poi.getCoordinates().get( 0 ) + "" );
points.add(new MogoLatLng(lat, lng));
} catch ( Exception e ) {
}
points.add(new MogoLatLng(lat, lng));
} catch ( Exception e ) { }
}
if (points.size() >= 1){
points.add(new MogoLatLng(markerLocation.getLat(), markerLocation.getLon()));
iMogoMarker.startSmooth( points, SMOOTH_DURATION );
iMogoMarker.startSmooth( points, SMOOTH_DURATION );
}
}
@@ -946,6 +946,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
double lat2 = Double.valueOf( end.getCoordinates().get( 1 ) + "" );
double lng2 = Double.valueOf( end.getCoordinates().get( 0 ) + "" );
if ( Utils.calculateLineDistance( new MogoLatLng( lat1, lng1 ), new MogoLatLng( lat2, lng2 ) ) >= 500 ) {
Logger.d( TAG, "filter point" );
return true;
}
} catch ( Exception e ) {