This commit is contained in:
wangcongtao
2020-06-12 19:25:27 +08:00
parent a8544f8b51
commit e7391bc94b
13 changed files with 66 additions and 120 deletions

View File

@@ -263,6 +263,11 @@ public class MogoServices implements IMogoMapListener,
private Handler mThreadHandler;
/**
* 当前限速
*/
private int mCurrentLimit = 0;
public void init( Context context ) {
mContext = context;
@@ -357,6 +362,9 @@ public class MogoServices implements IMogoMapListener,
} else if ( msg.what == ServiceConst.MSG_REQUEST_DATA ) {
if ( msg.obj instanceof RefreshObject ) {
RefreshObject ro = ( ( RefreshObject ) msg.obj );
if ( ro.mLonLat == null ) {
return;
}
mRefreshModel.refreshData( ro.mLonLat, ro.mRadius, ro.mAmount, ro.mCallback );
MapMarkerManager.getInstance().getOnlineCarDataByAutoRefreshStrategy( ro.mLonLat );
@@ -749,10 +757,11 @@ public class MogoServices implements IMogoMapListener,
if ( traffic != null ) {
if ( traffic.getSpeedLimit() <= 0 ) {
if ( mCurrentLimit == traffic.getSpeedLimit() ) {
return;
}
mCurrentLimit = traffic.getSpeedLimit();
Logger.i( TAG, "speed = %d, desc = %s", traffic.getSpeedLimit(), traffic.getDesc() );
// 发送当前限速到 adas
Intent intent = new Intent( "com.mogo.launcher.adas" );

View File

@@ -200,4 +200,7 @@ public class ServiceConst {
* 返回桌面
*/
public static final String COMMAND_BACK = "com.ileja.launcher.back";
public static final int ONLINE_SEARCH_LIMIT = 20;
public static final int ONLINE_SEARCH_RADIUS = 2_000;
}

View File

@@ -286,6 +286,10 @@ public class MockIntentHandler implements IntentHandler {
case 16:
MarkerServiceHandler.getGpsSimulatorManager().close();
break;
case 17:
DebugConfig.setRequestOnlineCarData( intent.getBooleanExtra( "status", true ) );
break;
}
}
}

View File

@@ -65,8 +65,6 @@ class OnlineCarSearchIntentHandler implements IntentHandler {
}
boolean isFocus = false;
boolean isSameCity = false;
int limit = 50;
int radius = 5_000;
switch ( command ) {
case ServiceConst.COMMAND_ZHIDAO_NEARBY_FRIEND:
case ServiceConst.COMMAND_ZHIDAO_NEARBY_USER_ONLINE:
@@ -79,8 +77,8 @@ class OnlineCarSearchIntentHandler implements IntentHandler {
target,
isFocus,
isSameCity,
limit,
radius );
ServiceConst.ONLINE_SEARCH_LIMIT,
ServiceConst.ONLINE_SEARCH_RADIUS );
break;
case ServiceConst.COMMAND_ZHIDAO_NEARBY_FRIEND_BYLOCATION:
handleAreaSearch( intent, context, target );
@@ -114,8 +112,8 @@ class OnlineCarSearchIntentHandler implements IntentHandler {
target,
false,
false,
50,
5_000 );
ServiceConst.ONLINE_SEARCH_LIMIT,
ServiceConst.ONLINE_SEARCH_RADIUS );
} else {
String cityCode = MarkerServiceHandler.getMogoLocationClient().getLastKnowLocation().getCityCode();
IMogoGeoSearch search = MarkerServiceHandler.getMapService().getGeoSearch( context );
@@ -131,8 +129,8 @@ class OnlineCarSearchIntentHandler implements IntentHandler {
target,
false,
false,
50,
5_000 );
ServiceConst.ONLINE_SEARCH_LIMIT,
ServiceConst.ONLINE_SEARCH_RADIUS );
}
} );
MogoGeocodeQuery mogoGeocodeQuery = new MogoGeocodeQuery();

View File

@@ -5,6 +5,7 @@ import android.graphics.Rect;
import android.text.TextUtils;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.map.MogoLatLng;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerClickListener;
@@ -691,7 +692,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
public void getOnlineCarDataByAutoRefreshStrategy( MogoLatLng latlng ) {
UiThreadHandler.removeCallbacks( runnable );
getOnlineCarDataImpl( latlng, false, false, 50, 2_000, false );
getOnlineCarDataImpl( latlng, false, false, ServiceConst.ONLINE_SEARCH_LIMIT, ServiceConst.ONLINE_SEARCH_RADIUS, false );
}
/**
@@ -714,7 +715,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
@Override
public void run() {
Logger.d( TAG, "内部 - 自动刷新在线车辆" );
getOnlineCarDataImpl( mCarLatLng, false, false, 50, 2_000, false );
getOnlineCarDataImpl( mCarLatLng, false, false, ServiceConst.ONLINE_SEARCH_LIMIT, ServiceConst.ONLINE_SEARCH_RADIUS, false );
}
};
@@ -740,6 +741,12 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
int radius,
boolean fitBounds ) {
if( DebugConfig.isDebug() ){
if ( !DebugConfig.isRequestOnlineCarData() ) {
return;
}
}
if ( mCarLatLng == null ) {
mCarLatLng = latLng;
}