add new func
This commit is contained in:
@@ -50,6 +50,7 @@ import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.MapCameraPosition;
|
||||
import com.mogo.map.uicontroller.MapControlResult;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -479,6 +480,16 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeMapVisualAngle(VisualAngleMode angelMode) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public VisualAngleMode getCurrentMapVisualAngle() {
|
||||
return null;
|
||||
}
|
||||
|
||||
private void setUIMode( EnumMapUI ui, AMapNaviViewOptions options ) {
|
||||
this.mCurrentUIMode = ui;
|
||||
switch ( ui ) {
|
||||
|
||||
@@ -8,7 +8,6 @@ import android.location.Location;
|
||||
import android.os.Bundle;
|
||||
import android.os.SystemClock;
|
||||
import android.os.Trace;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.animation.Interpolator;
|
||||
@@ -28,7 +27,6 @@ import com.amap.api.maps.model.Polyline;
|
||||
import com.amap.api.maps.model.animation.Animation;
|
||||
import com.amap.api.maps.model.animation.TranslateAnimation;
|
||||
import com.amap.api.navi.model.NaviInfo;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.map.IMogoMap;
|
||||
import com.mogo.map.IMogoMapView;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
@@ -47,6 +45,7 @@ import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.MapCameraPosition;
|
||||
import com.mogo.map.uicontroller.MapControlResult;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.utils.NetworkUtils;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
@@ -384,6 +383,16 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeMapVisualAngle(VisualAngleMode angelMode) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public VisualAngleMode getCurrentMapVisualAngle() {
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean checkMapView() {
|
||||
if ( mMapView == null || mMapView.getMap() == null ) {
|
||||
Logger.e( TAG, "高德mapView实例为空,请检查" );
|
||||
|
||||
@@ -7,13 +7,13 @@ import android.view.View;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.MogoMap;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.uicontroller.CarCursorOption;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.MapCameraPosition;
|
||||
import com.mogo.map.uicontroller.MapControlResult;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -92,6 +92,16 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeMapVisualAngle(VisualAngleMode angelMode) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public VisualAngleMode getCurrentMapVisualAngle() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveToCenter(MogoLatLng latLng, boolean animate) {
|
||||
if (mClient != null) {
|
||||
|
||||
@@ -67,7 +67,7 @@ dependencies {
|
||||
implementation project(':foudations:mogo-commons')
|
||||
}
|
||||
|
||||
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-8.5.15'
|
||||
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-8.5.16'
|
||||
// implementation 'com.zhidaoauto.machine:map:1.0.0-vr-test-3.4'
|
||||
}
|
||||
|
||||
|
||||
@@ -33,12 +33,11 @@ import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.MapCameraPosition;
|
||||
import com.mogo.map.uicontroller.MapControlResult;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
import com.zhidaoauto.map.sdk.open.MapAutoApi;
|
||||
import com.zhidaoauto.map.sdk.open.abs.MapStatusListener;
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnCameraChangeListener;
|
||||
@@ -46,6 +45,7 @@ import com.zhidaoauto.map.sdk.open.abs.OnMapClickListener;
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnMapLoadedListener;
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnMapStyleListener;
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnMapTouchListener;
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnMapViewVisualAngleChangeListener;
|
||||
import com.zhidaoauto.map.sdk.open.camera.CameraPosition;
|
||||
import com.zhidaoauto.map.sdk.open.camera.CameraUpdateFactory;
|
||||
import com.zhidaoauto.map.sdk.open.camera.LatLngBounds;
|
||||
@@ -70,6 +70,10 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import static com.mogo.map.uicontroller.VisualAngleMode.MODE_CLOSE_SIGHT;
|
||||
import static com.mogo.map.uicontroller.VisualAngleMode.MODE_LONG_SIGHT;
|
||||
import static com.mogo.map.uicontroller.VisualAngleMode.MODE_MEDIUM_SIGHT;
|
||||
|
||||
public class AMapViewWrapper implements IMogoMapView,
|
||||
IMogoMapUIController,
|
||||
LocationListener,
|
||||
@@ -80,28 +84,26 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
OnMapTouchListener,
|
||||
OnMarkClickListener,
|
||||
OnMapStyleListener,
|
||||
MapStyleController.IMapStyleAutoChangedListener {
|
||||
MapStyleController.IMapStyleAutoChangedListener, OnMapViewVisualAngleChangeListener {
|
||||
|
||||
private static final String TAG = "AMapViewWrapper";
|
||||
private final MapAutoView mMapView;
|
||||
private IMogoMap mIMap;
|
||||
|
||||
private final IMogoMap mIMap;
|
||||
private AMapMarkerClickHandler mMarkerClickHandler;
|
||||
private EnumMapUI mCurrentCarUIMode;
|
||||
|
||||
private boolean mIsCarLocked = false;
|
||||
private int mLockZoom = 16;
|
||||
private long startTime;
|
||||
|
||||
private float mDefaultZoomLevel = 16.0f;
|
||||
private final CarCursorOption DEFAULT_OPTION = new CarCursorOption.Builder()
|
||||
.carCursorRes(R.drawable.map_api_ic_current_location2)
|
||||
.naviCursorRes(R.drawable.ic_amap_navi_cursor)
|
||||
.build();
|
||||
private CarCursorOption mCarCursorOption = DEFAULT_OPTION;
|
||||
|
||||
private Location mLastDriveLocationShadow = null;
|
||||
private EnumMapUI mCurrentCarUIMode;
|
||||
private EnumMapUI mCurrentUI;
|
||||
private VisualAngleMode mVisualAngleMode = MODE_MEDIUM_SIGHT;
|
||||
|
||||
private int mLockZoom = 16;
|
||||
private long startTime;
|
||||
private float mDefaultZoomLevel = 16.0f;
|
||||
private boolean mIsCarLocked = false;
|
||||
private boolean mIsLightStyle = false;
|
||||
private boolean mMapLoaded = false;
|
||||
private boolean mIsFirstLocated = true;
|
||||
@@ -206,6 +208,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
mMapView.registerListener(this, MapAutoApi.LISTENER_TYPE_3D);
|
||||
mMapView.setMOnCameraChangeListener(this);
|
||||
mMapView.setOnMapStyleListener(this);
|
||||
mMapView.setOnMapViewVisualAngleChangeListener(this);
|
||||
Logger.d(TAG, "styleop - initListeners - setOnMapStyleListener - view %s", mMapView);
|
||||
|
||||
// mMapView.setOnPolylineClickListener( this );
|
||||
@@ -371,6 +374,20 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeMapVisualAngle(VisualAngleMode angelMode) {
|
||||
MapAutoViewHelper mapAutoViewHelper = mMapView.getMapAutoViewHelper();
|
||||
if (mapAutoViewHelper != null) {
|
||||
mVisualAngleMode = angelMode;
|
||||
mapAutoViewHelper.setMapViewVisualAngle(angelMode.getCode());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public VisualAngleMode getCurrentMapVisualAngle() {
|
||||
return mVisualAngleMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveToCenter(MogoLatLng latLng) {
|
||||
moveToCenter(latLng, true);
|
||||
@@ -703,8 +720,6 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
} else {
|
||||
if (mCarCursorOption.getCarCursorRes() != 0) {
|
||||
style.myLocationIcon(mCarCursorOption.getCarCursorRes());
|
||||
} else {
|
||||
style.myLocationIcon(mCarCursorOption.getCarCursorRes());
|
||||
}
|
||||
}
|
||||
mMapView.getMapAutoViewHelper().setMyLocationStyle(style);
|
||||
@@ -728,7 +743,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
|
||||
@Override
|
||||
public long getTileId(double lon, double lat) {
|
||||
return getMap().getUIController().getTileId(lon,lat);
|
||||
return getMap().getUIController().getTileId(lon, lat);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -856,7 +871,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
@Override
|
||||
public void onMapLoaded() {
|
||||
Logger.i(TAG, "autoop--onMapLoaded: ");
|
||||
mMapView.getMapAutoViewHelper().setRenderFrequency(true,50);
|
||||
mMapView.getMapAutoViewHelper().setRenderFrequency(true, 50);
|
||||
MogoMapListenerHandler.getInstance().onMapLoaded();
|
||||
mMapLoaded = true;
|
||||
CameraPosition cameraPosition = mMapView.getMapAutoViewHelper().getCameraPosition();
|
||||
@@ -893,6 +908,24 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
// Logger.i( TAG, "mapop--onMapStatusChanged-: " + type + "," + value );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapViewVisualAngleChange(int i) {
|
||||
MogoMapListenerHandler.getInstance().onMapVisualAngleChanged(getVisualAngleMode(i));
|
||||
}
|
||||
|
||||
private VisualAngleMode getVisualAngleMode(int mode) {
|
||||
switch (mode) {
|
||||
case 0:
|
||||
return MODE_CLOSE_SIGHT;
|
||||
case 1:
|
||||
return MODE_MEDIUM_SIGHT;
|
||||
case 2:
|
||||
return MODE_LONG_SIGHT;
|
||||
default:
|
||||
throw new IllegalStateException("mode is unCorrect");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCameraChange(int type, int value) {
|
||||
// Logger.i( TAG, "mapop--onCameraChange-: " + type + "," + value );
|
||||
@@ -1028,7 +1061,6 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
}
|
||||
}
|
||||
|
||||
//TODO
|
||||
@Override
|
||||
public void syncLocation2Map(JSONObject data) {
|
||||
if (!checkAMapView()) {
|
||||
@@ -1189,4 +1221,5 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
public void setMarkerInfoResName(String speedVal, String val) {
|
||||
ResIdCache.putVal(speedVal, val);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.MapCameraPosition;
|
||||
import com.mogo.map.uicontroller.MapControlResult;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.zhidaoauto.map.sdk.open.MapAutoApi;
|
||||
|
||||
@@ -38,9 +39,9 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
}
|
||||
|
||||
public static AMapUIController getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( AMapUIController.class ) {
|
||||
if ( sInstance == null ) {
|
||||
if (sInstance == null) {
|
||||
synchronized (AMapUIController.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new AMapUIController();
|
||||
}
|
||||
}
|
||||
@@ -48,7 +49,7 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public void initClient( IMogoMapUIController client ) {
|
||||
public void initClient(IMogoMapUIController client) {
|
||||
this.mClient = client;
|
||||
}
|
||||
|
||||
@@ -57,87 +58,102 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTrafficEnabled( boolean visible ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.setTrafficEnabled( visible );
|
||||
public void setTrafficEnabled(boolean visible) {
|
||||
if (mClient != null) {
|
||||
mClient.setTrafficEnabled(visible);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapControlResult changeZoom( boolean zoom ) {
|
||||
if ( mClient != null ) {
|
||||
return mClient.changeZoom( zoom );
|
||||
public MapControlResult changeZoom(boolean zoom) {
|
||||
if (mClient != null) {
|
||||
return mClient.changeZoom(zoom);
|
||||
}
|
||||
return MapControlResult.ERROR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapControlResult changeZoom( float zoom ) {
|
||||
if ( mClient != null ) {
|
||||
return mClient.changeZoom( zoom );
|
||||
public MapControlResult changeZoom(float zoom) {
|
||||
if (mClient != null) {
|
||||
return mClient.changeZoom(zoom);
|
||||
}
|
||||
return MapControlResult.ERROR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeMapMode( EnumMapUI mode ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.changeMapMode( mode );
|
||||
public void changeMapMode(EnumMapUI mode) {
|
||||
if (mClient != null) {
|
||||
mClient.changeMapMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveToCenter( MogoLatLng latLng, boolean animate ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.moveToCenter( latLng, animate );
|
||||
public void changeMapVisualAngle(VisualAngleMode angelMode) {
|
||||
if (mClient != null) {
|
||||
mClient.changeMapVisualAngle(angelMode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showMyLocation( boolean visible ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.showMyLocation( visible );
|
||||
public VisualAngleMode getCurrentMapVisualAngle() {
|
||||
if (mClient != null) {
|
||||
return mClient.getCurrentMapVisualAngle();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveToCenter(MogoLatLng latLng, boolean animate) {
|
||||
if (mClient != null) {
|
||||
mClient.moveToCenter(latLng, animate);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showMyLocation( View view ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.showMyLocation( view );
|
||||
public void showMyLocation(boolean visible) {
|
||||
if (mClient != null) {
|
||||
mClient.showMyLocation(visible);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showMyLocation(View view) {
|
||||
if (mClient != null) {
|
||||
mClient.showMyLocation(view);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recoverLockMode() {
|
||||
if ( mClient != null ) {
|
||||
if (mClient != null) {
|
||||
mClient.recoverLockMode();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loseLockMode() {
|
||||
if ( mClient != null ) {
|
||||
if (mClient != null) {
|
||||
mClient.loseLockMode();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLockZoom( int var1 ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.setLockZoom( var1 );
|
||||
public void setLockZoom(int var1) {
|
||||
if (mClient != null) {
|
||||
mClient.setLockZoom(var1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayOverview( Rect bounds ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.displayOverview( bounds );
|
||||
public void displayOverview(Rect bounds) {
|
||||
if (mClient != null) {
|
||||
mClient.displayOverview(bounds);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getScalePerPixel() {
|
||||
if ( mClient != null ) {
|
||||
if (mClient != null) {
|
||||
return mClient.getScalePerPixel();
|
||||
}
|
||||
return 0;
|
||||
@@ -145,7 +161,7 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
|
||||
@Override
|
||||
public float getZoomLevel() {
|
||||
if ( mClient != null ) {
|
||||
if (mClient != null) {
|
||||
return mClient.getZoomLevel();
|
||||
}
|
||||
return 0;
|
||||
@@ -153,15 +169,15 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
|
||||
@Override
|
||||
public float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK) {
|
||||
if ( mClient != null ) {
|
||||
return mClient.getRoadWidth(lon,lat,angle,isGpsLocation,isRTK);
|
||||
if (mClient != null) {
|
||||
return mClient.getRoadWidth(lon, lat, angle, isGpsLocation, isRTK);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLatLng getCameraNorthEastPosition() {
|
||||
if ( mClient != null ) {
|
||||
if (mClient != null) {
|
||||
return mClient.getCameraNorthEastPosition();
|
||||
}
|
||||
return null;
|
||||
@@ -169,7 +185,7 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
|
||||
@Override
|
||||
public MogoLatLng getCameraSouthWestPosition() {
|
||||
if ( mClient != null ) {
|
||||
if (mClient != null) {
|
||||
return mClient.getCameraSouthWestPosition();
|
||||
}
|
||||
return null;
|
||||
@@ -177,124 +193,124 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
|
||||
@Override
|
||||
public MogoLatLng getWindowCenterLocation() {
|
||||
if ( mClient != null ) {
|
||||
if (mClient != null) {
|
||||
return mClient.getWindowCenterLocation();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPointToCenter( double mapCenterX, double mapCenterY ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.setPointToCenter( mapCenterX, mapCenterY );
|
||||
public void setPointToCenter(double mapCenterX, double mapCenterY) {
|
||||
if (mClient != null) {
|
||||
mClient.setPointToCenter(mapCenterX, mapCenterY);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point getLocationPointInScreen( MogoLatLng latLng ) {
|
||||
if ( mClient != null ) {
|
||||
return mClient.getLocationPointInScreen( latLng );
|
||||
public Point getLocationPointInScreen(MogoLatLng latLng) {
|
||||
if (mClient != null) {
|
||||
return mClient.getLocationPointInScreen(latLng);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLatLng getLocationMogoLatLngInScreen( Point point ) {
|
||||
if ( mClient != null ) {
|
||||
return mClient.getLocationMogoLatLngInScreen( point );
|
||||
public MogoLatLng getLocationMogoLatLngInScreen(Point point) {
|
||||
if (mClient != null) {
|
||||
return mClient.getLocationMogoLatLngInScreen(point);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startJumpAnimation( IMogoMarker marker, float high, Interpolator interpolator,
|
||||
long duration ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.startJumpAnimation( marker, high, interpolator, duration );
|
||||
public void startJumpAnimation(IMogoMarker marker, float high, Interpolator interpolator,
|
||||
long duration) {
|
||||
if (mClient != null) {
|
||||
mClient.startJumpAnimation(marker, high, interpolator, duration);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRenderFps( int fps ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.setRenderFps( fps );
|
||||
public void setRenderFps(int fps) {
|
||||
if (mClient != null) {
|
||||
mClient.setRenderFps(fps);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showBounds( String tag, MogoLatLng carPosition, List< MogoLatLng > lonLats, Rect bound, boolean lockCarPosition ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.showBounds( tag, carPosition, lonLats, bound, lockCarPosition );
|
||||
public void showBounds(String tag, MogoLatLng carPosition, List<MogoLatLng> lonLats, Rect bound, boolean lockCarPosition) {
|
||||
if (mClient != null) {
|
||||
mClient.showBounds(tag, carPosition, lonLats, bound, lockCarPosition);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forceRender() {
|
||||
if ( mClient != null ) {
|
||||
if (mClient != null) {
|
||||
mClient.forceRender();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float calculateLineDistance( MogoLatLng p1, MogoLatLng p2 ) throws Exception {
|
||||
if ( mClient != null ) {
|
||||
return mClient.calculateLineDistance( p1, p2 );
|
||||
public float calculateLineDistance(MogoLatLng p1, MogoLatLng p2) throws Exception {
|
||||
if (mClient != null) {
|
||||
return mClient.calculateLineDistance(p1, p2);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumMapUI getCurrentUiMode() {
|
||||
if ( mClient != null ) {
|
||||
if (mClient != null) {
|
||||
return mClient.getCurrentUiMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeMyLocation( Location location ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.changeMyLocation( location );
|
||||
public void changeMyLocation(Location location) {
|
||||
if (mClient != null) {
|
||||
mClient.changeMyLocation(location);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCarLocked() {
|
||||
if ( mClient != null ) {
|
||||
if (mClient != null) {
|
||||
return mClient.isCarLocked();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCarCursorOption( CarCursorOption option ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.setCarCursorOption( option );
|
||||
public void setCarCursorOption(CarCursorOption option) {
|
||||
if (mClient != null) {
|
||||
mClient.setCarCursorOption(option);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapCameraPosition getMapCameraPosition() {
|
||||
if ( mClient != null ) {
|
||||
if (mClient != null) {
|
||||
return mClient.getMapCameraPosition();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeBearing( float bearing ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.changeBearing( bearing );
|
||||
public void changeBearing(float bearing) {
|
||||
if (mClient != null) {
|
||||
mClient.changeBearing(bearing);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTileId(double lon, double lat) {
|
||||
return MapAutoApi.INSTANCE.getTileID(lon,lat,13); // 13为默认获取瓦片层级级别
|
||||
return MapAutoApi.INSTANCE.getTileID(lon, lat, 13); // 13为默认获取瓦片层级级别
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAnchorScale( float x, float y ) {
|
||||
public void setAnchorScale(float x, float y) {
|
||||
|
||||
}
|
||||
|
||||
@@ -304,51 +320,51 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAnchorRate( float rate ) {
|
||||
public void setAnchorRate(float rate) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rtkEnable( boolean enable ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.rtkEnable( enable );
|
||||
public void rtkEnable(boolean enable) {
|
||||
if (mClient != null) {
|
||||
mClient.rtkEnable(enable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncLocation2Map( JSONObject data ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.syncLocation2Map( data );
|
||||
public void syncLocation2Map(JSONObject data) {
|
||||
if (mClient != null) {
|
||||
mClient.syncLocation2Map(data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openVrMode( boolean zoomGestureEnable ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.openVrMode( zoomGestureEnable );
|
||||
public void openVrMode(boolean zoomGestureEnable) {
|
||||
if (mClient != null) {
|
||||
mClient.openVrMode(zoomGestureEnable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] matchRoad( String id, double lon, double lat, double angle, boolean isGpsLocation, boolean isRTK ) {
|
||||
if ( mClient != null ) {
|
||||
return mClient.matchRoad( id, lon, lat, angle, isGpsLocation, isRTK );
|
||||
public double[] matchRoad(String id, double lon, double lat, double angle, boolean isGpsLocation, boolean isRTK) {
|
||||
if (mClient != null) {
|
||||
return mClient.matchRoad(id, lon, lat, angle, isGpsLocation, isRTK);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMarkerInfoResName( String speedVal ) {
|
||||
if ( mClient != null ) {
|
||||
return mClient.getMarkerInfoResName( speedVal );
|
||||
public String getMarkerInfoResName(String speedVal) {
|
||||
if (mClient != null) {
|
||||
return mClient.getMarkerInfoResName(speedVal);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMarkerInfoResName( String speedVal, String val ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.setMarkerInfoResName( speedVal, val );
|
||||
public void setMarkerInfoResName(String speedVal, String val) {
|
||||
if (mClient != null) {
|
||||
mClient.setMarkerInfoResName(speedVal, val);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@ package com.mogo.map.listener;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.model.MogoPoi;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -18,42 +18,56 @@ public interface IMogoMapListener {
|
||||
/**
|
||||
* 地图加载完毕
|
||||
*/
|
||||
default void onMapLoaded(){};
|
||||
default void onMapLoaded() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 地图点击
|
||||
*
|
||||
* @param motionEvent
|
||||
*/
|
||||
default void onTouch( MotionEvent motionEvent ){};
|
||||
default void onTouch(MotionEvent motionEvent) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 地图上的任意poi点击
|
||||
*
|
||||
* @param poi
|
||||
*/
|
||||
default void onPOIClick( MogoPoi poi ){};
|
||||
default void onPOIClick(MogoPoi poi) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 地图点击
|
||||
*
|
||||
* @param latLng
|
||||
*/
|
||||
default void onMapClick( MogoLatLng latLng ){}
|
||||
default void onMapClick(MogoLatLng latLng) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 地图锁定
|
||||
*
|
||||
* @param isLock
|
||||
*/
|
||||
default void onLockMap( boolean isLock ){}
|
||||
default void onLockMap(boolean isLock) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 地图白天黑夜、导航视角切换
|
||||
*
|
||||
* @param ui
|
||||
*/
|
||||
default void onMapModeChanged( EnumMapUI ui ){}
|
||||
default void onMapModeChanged(EnumMapUI ui) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 地图视距切换回调
|
||||
*
|
||||
* @param visualAngleMode
|
||||
*/
|
||||
default void onMapVisualAngleChanged(VisualAngleMode visualAngleMode) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param latLng 中点的经纬度
|
||||
@@ -61,5 +75,6 @@ public interface IMogoMapListener {
|
||||
* @param tilt 倾斜度
|
||||
* @param bearing 旋转角度
|
||||
*/
|
||||
default void onMapChanged( MogoLatLng latLng, float zoom, float tilt, float bearing ){}
|
||||
default void onMapChanged(MogoLatLng latLng, float zoom, float tilt, float bearing) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,9 @@ package com.mogo.map.listener;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.model.MogoPoi;
|
||||
import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -22,9 +21,9 @@ public class MogoMapListenerHandler implements IMogoMapListener, IMogoMapListene
|
||||
}
|
||||
|
||||
public static MogoMapListenerHandler getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( MogoMapListenerHandler.class ) {
|
||||
if ( sInstance == null ) {
|
||||
if (sInstance == null) {
|
||||
synchronized (MogoMapListenerHandler.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new MogoMapListenerHandler();
|
||||
}
|
||||
}
|
||||
@@ -42,7 +41,7 @@ public class MogoMapListenerHandler implements IMogoMapListener, IMogoMapListene
|
||||
private IMogoMapListener mDelegateListener = null;
|
||||
|
||||
@Override
|
||||
public void registerHostMapListener( IMogoMapListener listener ) {
|
||||
public void registerHostMapListener(IMogoMapListener listener) {
|
||||
mDelegateListener = listener;
|
||||
}
|
||||
|
||||
@@ -53,50 +52,57 @@ public class MogoMapListenerHandler implements IMogoMapListener, IMogoMapListene
|
||||
|
||||
@Override
|
||||
public void onMapLoaded() {
|
||||
if ( mDelegateListener != null ) {
|
||||
if (mDelegateListener != null) {
|
||||
mDelegateListener.onMapLoaded();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTouch( MotionEvent motionEvent ) {
|
||||
if ( mDelegateListener != null ) {
|
||||
mDelegateListener.onTouch( motionEvent );
|
||||
public void onTouch(MotionEvent motionEvent) {
|
||||
if (mDelegateListener != null) {
|
||||
mDelegateListener.onTouch(motionEvent);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPOIClick( MogoPoi poi ) {
|
||||
if ( mDelegateListener != null ) {
|
||||
mDelegateListener.onPOIClick( poi );
|
||||
public void onPOIClick(MogoPoi poi) {
|
||||
if (mDelegateListener != null) {
|
||||
mDelegateListener.onPOIClick(poi);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapClick( MogoLatLng latLng ) {
|
||||
if ( mDelegateListener != null ) {
|
||||
mDelegateListener.onMapClick( latLng );
|
||||
public void onMapClick(MogoLatLng latLng) {
|
||||
if (mDelegateListener != null) {
|
||||
mDelegateListener.onMapClick(latLng);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLockMap( boolean isLock ) {
|
||||
if ( mDelegateListener != null ) {
|
||||
mDelegateListener.onLockMap( isLock );
|
||||
public void onLockMap(boolean isLock) {
|
||||
if (mDelegateListener != null) {
|
||||
mDelegateListener.onLockMap(isLock);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapModeChanged( EnumMapUI ui ) {
|
||||
if ( mDelegateListener != null ) {
|
||||
mDelegateListener.onMapModeChanged( ui );
|
||||
public void onMapModeChanged(EnumMapUI ui) {
|
||||
if (mDelegateListener != null) {
|
||||
mDelegateListener.onMapModeChanged(ui);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapChanged( MogoLatLng location, float zoom, float tilt, float bearing ) {
|
||||
if ( mDelegateListener != null ) {
|
||||
mDelegateListener.onMapChanged( location, zoom, tilt, bearing );
|
||||
public void onMapVisualAngleChanged(VisualAngleMode visualAngleMode) {
|
||||
if (mDelegateListener != null) {
|
||||
mDelegateListener.onMapVisualAngleChanged(visualAngleMode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapChanged(MogoLatLng location, float zoom, float tilt, float bearing) {
|
||||
if (mDelegateListener != null) {
|
||||
mDelegateListener.onMapChanged(location, zoom, tilt, bearing);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class MogoLocationListenerRegister implements IMogoLocationListenerRegist
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
private Set< IMogoLocationListener > sListeners = new HashSet<>( 10 );
|
||||
private final Set< IMogoLocationListener > sListeners = new HashSet<>( 10 );
|
||||
|
||||
/**
|
||||
* 注册定位回调
|
||||
|
||||
@@ -11,51 +11,70 @@ public enum EnumMapUI {
|
||||
/**
|
||||
* 正北朝上2D
|
||||
*/
|
||||
NorthUP_2D( 0, 1 ),
|
||||
NorthUP_2D(0, 1),
|
||||
/**
|
||||
* 车头朝上2D
|
||||
*/
|
||||
CarUp_2D( 1, 2 ),
|
||||
CarUp_2D(1, 2),
|
||||
|
||||
/**
|
||||
* 3D,只能头朝上
|
||||
*/
|
||||
CarUp_3D( 2, 0 ),
|
||||
CarUp_3D(2, 0),
|
||||
|
||||
/**
|
||||
* 白天模式
|
||||
*/
|
||||
Type_Light( 3, 5 ),
|
||||
Type_Light(3, 5),
|
||||
|
||||
/**
|
||||
* 夜晚模式
|
||||
*/
|
||||
Type_Night( 4, 4 ),
|
||||
Type_Night(4, 4),
|
||||
|
||||
/**
|
||||
* 夜晚模式
|
||||
*/
|
||||
Type_AUTO_LIGHT_Night( 5, 3 ),
|
||||
Type_AUTO_LIGHT_Night(5, 3),
|
||||
|
||||
/**
|
||||
* 自研地图的VR模式
|
||||
*/
|
||||
Type_VR( 0, 0 );
|
||||
Type_VR(0, 0),
|
||||
|
||||
/**
|
||||
* 视距远景
|
||||
*/
|
||||
MODE_LONG_SIGHT(6, 7),
|
||||
|
||||
/**
|
||||
* 视距中景
|
||||
*/
|
||||
MODE_MEDIUM_SIGHT(7, 8),
|
||||
|
||||
/**
|
||||
* 视距近景
|
||||
*/
|
||||
MODE_CLOSE_SIGHT(8, 6);
|
||||
|
||||
private int next;
|
||||
private int code;
|
||||
|
||||
EnumMapUI( int code, int next ) {
|
||||
EnumMapUI(int code, int next) {
|
||||
this.code = code;
|
||||
this.next = next;
|
||||
}
|
||||
|
||||
public EnumMapUI next() {
|
||||
for ( EnumMapUI value : EnumMapUI.values() ) {
|
||||
if ( value.code == next ) {
|
||||
for (EnumMapUI value : EnumMapUI.values()) {
|
||||
if (value.code == next) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getCode(){
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,50 +28,64 @@ public interface IMogoMapUIController {
|
||||
/**
|
||||
* 实时路况
|
||||
*/
|
||||
void setTrafficEnabled( boolean visible );
|
||||
void setTrafficEnabled(boolean visible);
|
||||
|
||||
/**
|
||||
* 地图缩放
|
||||
*
|
||||
* @param zoomIn true - 放大 false - 缩小
|
||||
*/
|
||||
MapControlResult changeZoom( boolean zoomIn );
|
||||
MapControlResult changeZoom(boolean zoomIn);
|
||||
|
||||
/**
|
||||
* 修改缩放级别
|
||||
*/
|
||||
MapControlResult changeZoom( float zoom );
|
||||
MapControlResult changeZoom(float zoom);
|
||||
|
||||
/**
|
||||
* 切换2D/3D模式
|
||||
*
|
||||
* @param mode true - 3D模式 false - 2D模式
|
||||
*/
|
||||
void changeMapMode( EnumMapUI mode );
|
||||
void changeMapMode(EnumMapUI mode);
|
||||
|
||||
/**
|
||||
* 切换3D模式下远距,中距,近距视角
|
||||
*
|
||||
* @param angelMode {@link VisualAngleMode}
|
||||
*/
|
||||
void changeMapVisualAngle(VisualAngleMode angelMode);
|
||||
|
||||
/**
|
||||
* 获得当前地图视距模式
|
||||
*
|
||||
* @return {@link VisualAngleMode}
|
||||
*/
|
||||
VisualAngleMode getCurrentMapVisualAngle();
|
||||
|
||||
/**
|
||||
* 将地图移动至当前位置
|
||||
*/
|
||||
default void moveToCenter( MogoLatLng latLng ) {
|
||||
moveToCenter( latLng, false );
|
||||
default void moveToCenter(MogoLatLng latLng) {
|
||||
moveToCenter(latLng, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将地图移动至当前位置
|
||||
*/
|
||||
void moveToCenter( MogoLatLng latLng, boolean animate );
|
||||
void moveToCenter(MogoLatLng latLng, boolean animate);
|
||||
|
||||
/**
|
||||
* 显示我的位置
|
||||
*
|
||||
* @param visible true - 显示 false - 不显示
|
||||
*/
|
||||
void showMyLocation( boolean visible );
|
||||
void showMyLocation(boolean visible);
|
||||
|
||||
/**
|
||||
* @param view
|
||||
*/
|
||||
void showMyLocation( View view );
|
||||
void showMyLocation(View view);
|
||||
|
||||
/**
|
||||
* 强调自车位置,加个动画突显一下自车位置
|
||||
@@ -83,7 +97,7 @@ public interface IMogoMapUIController {
|
||||
*
|
||||
* @param location
|
||||
*/
|
||||
void changeMyLocation( Location location );
|
||||
void changeMyLocation(Location location);
|
||||
|
||||
/**
|
||||
* 锁车
|
||||
@@ -100,14 +114,14 @@ public interface IMogoMapUIController {
|
||||
*
|
||||
* @param var1 级别 3-20
|
||||
*/
|
||||
void setLockZoom( int var1 );
|
||||
void setLockZoom(int var1);
|
||||
|
||||
/**
|
||||
* 预览全程
|
||||
*
|
||||
* @param bounds 显示范围
|
||||
*/
|
||||
void displayOverview( Rect bounds );
|
||||
void displayOverview(Rect bounds);
|
||||
|
||||
/**
|
||||
* 获取比例尺数据
|
||||
@@ -147,17 +161,17 @@ public interface IMogoMapUIController {
|
||||
* @param mapCenterX x 点位置x值与地图宽度的比例
|
||||
* @param mapCenterY y 点位置x值与地图高度的比例
|
||||
*/
|
||||
void setPointToCenter( double mapCenterX, double mapCenterY );
|
||||
void setPointToCenter(double mapCenterX, double mapCenterY);
|
||||
|
||||
/**
|
||||
* 获取经纬度对应的屏幕的位置
|
||||
*/
|
||||
Point getLocationPointInScreen( MogoLatLng latLng );
|
||||
Point getLocationPointInScreen(MogoLatLng latLng);
|
||||
|
||||
/**
|
||||
* 获取像素点对应的经纬度
|
||||
*/
|
||||
MogoLatLng getLocationMogoLatLngInScreen( Point point );
|
||||
MogoLatLng getLocationMogoLatLngInScreen(Point point);
|
||||
|
||||
/**
|
||||
* marker 跳跃动画
|
||||
@@ -170,13 +184,13 @@ public interface IMogoMapUIController {
|
||||
* @param duration 动画时间
|
||||
*/
|
||||
@Deprecated
|
||||
void startJumpAnimation( IMogoMarker marker, float high, Interpolator interpolator,
|
||||
long duration );
|
||||
void startJumpAnimation(IMogoMarker marker, float high, Interpolator interpolator,
|
||||
long duration);
|
||||
|
||||
/**
|
||||
* 设置刷新帧率
|
||||
*/
|
||||
void setRenderFps( int fps );
|
||||
void setRenderFps(int fps);
|
||||
|
||||
/**
|
||||
* @param tag 调用业务
|
||||
@@ -185,7 +199,7 @@ public interface IMogoMapUIController {
|
||||
* @param bound 地图上可显示的范围
|
||||
* @param lockCarPosition 是否锁定车辆位置
|
||||
*/
|
||||
void showBounds( String tag, MogoLatLng carPosition, List< MogoLatLng > lonLats, Rect bound, boolean lockCarPosition );
|
||||
void showBounds(String tag, MogoLatLng carPosition, List<MogoLatLng> lonLats, Rect bound, boolean lockCarPosition);
|
||||
|
||||
/**
|
||||
* 强制刷新地图
|
||||
@@ -199,7 +213,7 @@ public interface IMogoMapUIController {
|
||||
* @param p2
|
||||
* @return
|
||||
*/
|
||||
float calculateLineDistance( MogoLatLng p1, MogoLatLng p2 ) throws Exception;
|
||||
float calculateLineDistance(MogoLatLng p1, MogoLatLng p2) throws Exception;
|
||||
|
||||
/**
|
||||
* 当前的视图模式
|
||||
@@ -221,7 +235,7 @@ public interface IMogoMapUIController {
|
||||
* @param option 为空时使用
|
||||
* 默认配置
|
||||
*/
|
||||
void setCarCursorOption( @Nullable CarCursorOption option );
|
||||
void setCarCursorOption(@Nullable CarCursorOption option);
|
||||
|
||||
/**
|
||||
* 获取地图视图描述快照
|
||||
@@ -235,12 +249,13 @@ public interface IMogoMapUIController {
|
||||
*
|
||||
* @param bearing
|
||||
*/
|
||||
void changeBearing( float bearing );
|
||||
void changeBearing(float bearing);
|
||||
|
||||
void setAdasRecognizedResult(ADASRecognizedResult result);
|
||||
|
||||
/**
|
||||
* 获取瓦片id
|
||||
*
|
||||
* @param lon 经度
|
||||
* @param lat 纬度
|
||||
* @return 瓦片id
|
||||
@@ -248,11 +263,11 @@ public interface IMogoMapUIController {
|
||||
long getTileId(double lon, double lat);
|
||||
|
||||
|
||||
default void setAnchorScale( float x, float y ) {
|
||||
default void setAnchorScale(float x, float y) {
|
||||
|
||||
}
|
||||
|
||||
default void setAnchorRate( float rate ) {
|
||||
default void setAnchorRate(float rate) {
|
||||
|
||||
}
|
||||
|
||||
@@ -265,7 +280,7 @@ public interface IMogoMapUIController {
|
||||
*
|
||||
* @param enable
|
||||
*/
|
||||
default void rtkEnable( boolean enable ) {
|
||||
default void rtkEnable(boolean enable) {
|
||||
|
||||
}
|
||||
|
||||
@@ -278,7 +293,7 @@ public interface IMogoMapUIController {
|
||||
*
|
||||
* @param data
|
||||
*/
|
||||
default void syncLocation2Map( JSONObject data ) {
|
||||
default void syncLocation2Map(JSONObject data) {
|
||||
|
||||
}
|
||||
|
||||
@@ -287,7 +302,7 @@ public interface IMogoMapUIController {
|
||||
*
|
||||
* @param zoomGestureEnable 是否支持手势缩放改变地图样式
|
||||
*/
|
||||
default void openVrMode( boolean zoomGestureEnable ) {
|
||||
default void openVrMode(boolean zoomGestureEnable) {
|
||||
|
||||
}
|
||||
|
||||
@@ -301,7 +316,7 @@ public interface IMogoMapUIController {
|
||||
* @param isRTK
|
||||
* @return
|
||||
*/
|
||||
default double[] matchRoad(String id, double lon, double lat, double angle, boolean isGpsLocation, boolean isRTK ) {
|
||||
default double[] matchRoad(String id, double lon, double lat, double angle, boolean isGpsLocation, boolean isRTK) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -311,19 +326,21 @@ public interface IMogoMapUIController {
|
||||
|
||||
/**
|
||||
* 获取车速资源缓存 id
|
||||
*
|
||||
* @param speedVal
|
||||
* @return
|
||||
*/
|
||||
default String getMarkerInfoResName(String speedVal){
|
||||
default String getMarkerInfoResName(String speedVal) {
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取车速资源缓存 id
|
||||
*
|
||||
* @param speedVal
|
||||
* @return
|
||||
*/
|
||||
default void setMarkerInfoResName(String speedVal, String val){
|
||||
default void setMarkerInfoResName(String speedVal, String val) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.mogo.map.uicontroller;
|
||||
|
||||
public interface IMogoMapVisualAngle {
|
||||
|
||||
boolean isLongSight();
|
||||
|
||||
boolean isCloseSight();
|
||||
|
||||
boolean isMediumSight();
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.mogo.map.uicontroller;
|
||||
|
||||
public enum VisualAngleMode implements IMogoMapVisualAngle {
|
||||
|
||||
/**
|
||||
* 视距近景
|
||||
*/
|
||||
MODE_CLOSE_SIGHT(0),
|
||||
|
||||
/**
|
||||
* 视距中景
|
||||
*/
|
||||
MODE_MEDIUM_SIGHT(1),
|
||||
|
||||
/**
|
||||
* 视距远景
|
||||
*/
|
||||
MODE_LONG_SIGHT(2);
|
||||
|
||||
private int code;
|
||||
|
||||
VisualAngleMode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLongSight() {
|
||||
return code == MODE_LONG_SIGHT.getCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCloseSight() {
|
||||
return code == MODE_CLOSE_SIGHT.getCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMediumSight() {
|
||||
return code == MODE_MEDIUM_SIGHT.getCode();
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.MapCameraPosition;
|
||||
import com.mogo.map.uicontroller.MapControlResult;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -91,6 +92,23 @@ public class MogoMapUIController implements IMogoMapUIController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeMapVisualAngle(VisualAngleMode angelMode) {
|
||||
initDelegate();
|
||||
if (mDelegate != null) {
|
||||
Logger.d(TAG, "set VisualAngle: %s", angelMode.name());
|
||||
mDelegate.changeMapVisualAngle(angelMode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public VisualAngleMode getCurrentMapVisualAngle() {
|
||||
initDelegate();
|
||||
if (mDelegate != null) {
|
||||
return mDelegate.getCurrentMapVisualAngle();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveToCenter(MogoLatLng latLng, boolean animate) {
|
||||
|
||||
@@ -7,7 +7,6 @@ import android.os.Process;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -16,14 +15,11 @@ import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.main.MainActivity;
|
||||
import com.mogo.module.main.cards.MogoModulesManager;
|
||||
import com.mogo.module.main.utils.DisplayEffectsHelper;
|
||||
import com.mogo.module.service.receiver.MogoReceiver;
|
||||
import com.mogo.och.IMogoOCH;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.service.v2x.IV2XListener;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.model.MogoPoi;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -45,6 +46,11 @@ public abstract class MogoMapListenerAdapter implements IMogoMapListener {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapVisualAngleChanged(VisualAngleMode visualAngleMode) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapChanged( MogoLatLng latLng, float zoom, float tilt, float bearing ) {
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.map.navi.MogoTraffic;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.dialog.WMDialog;
|
||||
import com.mogo.module.common.glide.SkinAbleBitmapTarget;
|
||||
@@ -1082,6 +1083,11 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapVisualAngleChanged(VisualAngleMode visualAngleMode) {
|
||||
//todo visual
|
||||
}
|
||||
|
||||
private static final int SEEK_HELP_NOTICE_NUM_MSG_TYPE = 401015;
|
||||
//求助已通知周围XX位车主
|
||||
private final IMogoOnMessageListener<String> seekHelpNoticeListener =
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.mogo.map.navi.MogoCongestionInfo;
|
||||
import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.map.navi.MogoTraffic;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
import com.mogo.module.main.registercenter.MogoRegisterCenterHandler;
|
||||
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -293,6 +294,24 @@ public class EventDispatchCenter implements
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapVisualAngleChanged(VisualAngleMode visualAngleMode) {
|
||||
Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoMapListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
try {
|
||||
listener.onMapVisualAngleChanged( visualAngleMode );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapChanged( MogoLatLng location, float zoom, float tilt, float bearing ) {
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import com.mogo.commons.context.ContextHolderUtil;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.mvp.MvpActivity;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
@@ -34,7 +33,6 @@ import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.service.v2x.IV2XListener;
|
||||
import com.mogo.skin.support.SkinMode;
|
||||
import com.mogo.utils.NetworkUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -8,7 +8,6 @@ import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.intent.IMogoIntentManager;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
public
|
||||
/**
|
||||
|
||||
@@ -19,7 +19,6 @@ import com.mogo.module.navi.manager.SettingManager
|
||||
import com.mogo.module.navi.manager.VolumeManager
|
||||
import com.mogo.module.navi.ui.base.BaseFragment
|
||||
import com.mogo.utils.TipToast
|
||||
import com.mogo.utils.storage.SharedPrefsMgr
|
||||
import kotlinx.android.synthetic.main.fragment_navi_setting.*
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
|
||||
@@ -428,10 +428,12 @@ public class MogoServices implements IMogoMapListener,
|
||||
Logger.w( TAG, "lonLat is null." );
|
||||
return;
|
||||
}
|
||||
//请求大而全数据,刷新地图POI
|
||||
mRefreshModel.refreshExplorerWayData( ro.mLonLat, ro.mRadius, ro.mAmount, ro.mCallback );
|
||||
// if ( !DebugConfig.
|
||||
// isNeedUploadCoordinatesDurationInTime() ) { //todo 实时在线车辆需要注释,否则在2D模式下不能展示
|
||||
// }
|
||||
//请求在线车辆数据,刷新地图在线车辆
|
||||
MapMarkerManager.getInstance().getOnlineCarDataByAutoRefreshStrategy( ro.mLonLat );
|
||||
|
||||
Logger.i( TAG, "刷新半径 = %s, 点 = %s, zoomLevel = %s, amount = %s", ro.mRadius, ro.mLonLat, mLastZoomLevel, ro.mAmount );
|
||||
|
||||
@@ -2,28 +2,21 @@ package com.mogo.module.service.marker;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.location.Location;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
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;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.ModuleNames;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.api.CallChatApi;
|
||||
import com.mogo.module.common.constants.AdasRecognizedType;
|
||||
import com.mogo.module.common.drawer.AdasRecognizedResultDrawer;
|
||||
import com.mogo.module.common.drawer.MarkerDrawer;
|
||||
import com.mogo.module.common.drawer.OnlineCarDrawer;
|
||||
@@ -34,11 +27,9 @@ import com.mogo.module.common.drawer.marker.MapMarkerAdapter;
|
||||
import com.mogo.module.common.drawer.marker.OnlineCarMarkerView;
|
||||
import com.mogo.module.common.entity.MarkerCardResult;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerLocation;
|
||||
import com.mogo.module.common.entity.MarkerOnlineCar;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.common.entity.V2XWarningEntity;
|
||||
import com.mogo.module.common.utils.CloudPoiManager;
|
||||
import com.mogo.module.common.utils.Trigonometric;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
@@ -52,7 +43,6 @@ import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.realtime.entity.MogoSnapshotSetData;
|
||||
import com.mogo.realtime.socket.IMogoCloudOnMsgListener;
|
||||
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
import com.mogo.service.module.IMogoBizActionDoneListener;
|
||||
import com.mogo.utils.ResourcesHelper;
|
||||
import com.mogo.utils.ThreadPoolService;
|
||||
@@ -60,7 +50,6 @@ import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.ViewUtils;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
import com.zhidao.carchattingprovider.ICallChatResponse;
|
||||
|
||||
import org.json.JSONArray;
|
||||
@@ -73,8 +62,6 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_WARN_DATA;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
@@ -83,7 +70,6 @@ import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_WARN_
|
||||
* version: 1.0
|
||||
*/
|
||||
public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
IMogoOnMessageListener< MarkerResponse >,
|
||||
IMogoBizActionDoneListener,
|
||||
IMogoADASControlStatusChangedListener {
|
||||
private static final String TAG = "MapMarkerManager";
|
||||
@@ -107,8 +93,8 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
}
|
||||
|
||||
public static synchronized MapMarkerManager getInstance() {
|
||||
synchronized ( MapMarkerManager.class ) {
|
||||
if ( mMarkerManager == null ) {
|
||||
synchronized (MapMarkerManager.class) {
|
||||
if (mMarkerManager == null) {
|
||||
mMarkerManager = new MapMarkerManager();
|
||||
}
|
||||
}
|
||||
@@ -121,58 +107,58 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
*
|
||||
* @param context 上下文对象
|
||||
*/
|
||||
public void init( Context context ) {
|
||||
public void init(Context context) {
|
||||
|
||||
if ( mContext != null ) {
|
||||
if (mContext != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
mContext = context.getApplicationContext();
|
||||
mRefreshModel = new RefreshModel( mContext );
|
||||
CloudPoiManager.getInstance().updateFromConfig( context );
|
||||
MarkerServiceHandler.getActionManager().registerBizActionDoneListener( this );
|
||||
MarkerServiceHandler.getApis().getRegisterCenterApi().registerADASControlStatusChangedListener( TAG, this );
|
||||
mRefreshModel = new RefreshModel(mContext);
|
||||
CloudPoiManager.getInstance().updateFromConfig(context);
|
||||
MarkerServiceHandler.getActionManager().registerBizActionDoneListener(this);
|
||||
MarkerServiceHandler.getApis().getRegisterCenterApi().registerADASControlStatusChangedListener(TAG, this);
|
||||
|
||||
if ( CallChatApi.getInstance().getApiProvider() != null ) {
|
||||
CallChatApi.getInstance().getApiProvider().registerUserWindowStatusListener( TAG, mContext, new ICallChatResponse() {
|
||||
if (CallChatApi.getInstance().getApiProvider() != null) {
|
||||
CallChatApi.getInstance().getApiProvider().registerUserWindowStatusListener(TAG, mContext, new ICallChatResponse() {
|
||||
|
||||
@Override
|
||||
public void userWindowStatus( boolean show ) {
|
||||
public void userWindowStatus(boolean show) {
|
||||
try {
|
||||
if ( mLastCheckMarker == null ) {
|
||||
if (mLastCheckMarker == null) {
|
||||
return;
|
||||
}
|
||||
if ( TextUtils.equals( mLastCheckMarker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA )
|
||||
&& !show ) {
|
||||
closeMarker( mLastCheckMarker );
|
||||
if (TextUtils.equals(mLastCheckMarker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA)
|
||||
&& !show) {
|
||||
closeMarker(mLastCheckMarker);
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
} );
|
||||
});
|
||||
}
|
||||
// 下发的数据
|
||||
MoGoAiCloudRealTime.registerOnMsgListener( new IMogoCloudOnMsgListener() {
|
||||
MoGoAiCloudRealTime.registerOnMsgListener(new IMogoCloudOnMsgListener() {
|
||||
@Override
|
||||
public void onMsgSend( long id ) {
|
||||
DebugConfig.setStatus( DebugConfig.sDownloadLink, true );
|
||||
public void onMsgSend(long id) {
|
||||
DebugConfig.setStatus(DebugConfig.sDownloadLink, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived( MogoSnapshotSetData mogoSnapshotSetData ) {
|
||||
DebugConfig.setStatus( DebugConfig.sDownloadSnapshot, true );
|
||||
public void onMsgReceived(MogoSnapshotSetData mogoSnapshotSetData) {
|
||||
DebugConfig.setStatus(DebugConfig.sDownloadSnapshot, true);
|
||||
Message msg = mSnapshotHandler.obtainMessage();
|
||||
msg.obj = mogoSnapshotSetData;
|
||||
msg.sendToTarget();
|
||||
}
|
||||
} );
|
||||
});
|
||||
|
||||
// adas 每隔一秒传递的数据
|
||||
MarkerServiceHandler.getApis().getAdasControllerApi().addAdasRecognizedDataCallback( resultList -> {
|
||||
MarkerServiceHandler.getApis().getAdasControllerApi().addAdasRecognizedDataCallback(resultList -> {
|
||||
// 绘制近景识别到的车辆
|
||||
AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult( resultList );
|
||||
AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult(resultList);
|
||||
|
||||
//添加自车的定位图标,碰撞只有一个预警,还需要和adas 联调,
|
||||
// for ( ADASRecognizedResult result : resultList) {
|
||||
@@ -185,13 +171,14 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
// MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().setAdasRecognizedResult(result);
|
||||
// }
|
||||
// }
|
||||
|
||||
} );
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 实时绘制连线
|
||||
*
|
||||
* @param result
|
||||
*/
|
||||
private void drawLimberCollisionPolyline(ADASRecognizedResult result) {
|
||||
@@ -216,14 +203,14 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
}
|
||||
|
||||
|
||||
private Handler mSnapshotHandler = new Handler( WorkThreadHandler.newInstance( "snapshot-thread" ).getLooper() ) {
|
||||
private final Handler mSnapshotHandler = new Handler(WorkThreadHandler.newInstance("snapshot-thread").getLooper()) {
|
||||
@Override
|
||||
public void handleMessage( Message msg ) {
|
||||
super.handleMessage( msg );
|
||||
if ( msg.obj instanceof MogoSnapshotSetData ) {
|
||||
SnapshotSetDataDrawer.getInstance().renderSnapshotData( ( ( MogoSnapshotSetData ) msg.obj ) );
|
||||
} else if ( msg.obj == null ) {
|
||||
SnapshotSetDataDrawer.getInstance().renderSnapshotData( null );
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
if (msg.obj instanceof MogoSnapshotSetData) {
|
||||
SnapshotSetDataDrawer.getInstance().renderSnapshotData(((MogoSnapshotSetData) msg.obj));
|
||||
} else if (msg.obj == null) {
|
||||
SnapshotSetDataDrawer.getInstance().renderSnapshotData(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -232,32 +219,32 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* 地图上的Marker点击回调
|
||||
*/
|
||||
@Override
|
||||
public boolean onMarkerClicked( IMogoMarker marker ) {
|
||||
public boolean onMarkerClicked(IMogoMarker marker) {
|
||||
try {
|
||||
boolean result = switchMarkerOpenStatus( marker );
|
||||
if ( !result ) {
|
||||
updateCarUserInfoWindow( marker );
|
||||
boolean result = switchMarkerOpenStatus(marker);
|
||||
if (!result) {
|
||||
updateCarUserInfoWindow(marker);
|
||||
return false;
|
||||
}
|
||||
|
||||
Map< String, Object > properties = new HashMap<>();
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
|
||||
if ( marker.getObject() instanceof MarkerShowEntity ) {
|
||||
final String sn = MarkerDrawer.getInstance().getCarSnFromMarker( marker );
|
||||
if ( TextUtils.isEmpty( sn ) ) {
|
||||
if (marker.getObject() instanceof MarkerShowEntity) {
|
||||
final String sn = MarkerDrawer.getInstance().getCarSnFromMarker(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() );
|
||||
properties.put( "type", exploreWay.getPoiType() );
|
||||
} else if ( ( ( MarkerShowEntity ) marker.getObject() ).getBindObj() instanceof MarkerOnlineCar ) {
|
||||
properties.put( "type", "10000" );
|
||||
properties.put("sn", sn);
|
||||
if (((MarkerShowEntity) marker.getObject()).getBindObj() instanceof MarkerExploreWay) {
|
||||
MarkerExploreWay exploreWay = (MarkerExploreWay) ((MarkerShowEntity) marker.getObject()).getBindObj();
|
||||
properties.put("dbid", exploreWay.getInfoId());
|
||||
properties.put("type", exploreWay.getPoiType());
|
||||
} else if (((MarkerShowEntity) marker.getObject()).getBindObj() instanceof MarkerOnlineCar) {
|
||||
properties.put("type", "10000");
|
||||
}
|
||||
}
|
||||
MarkerServiceHandler.getMogoAnalytics().track( "v2x_road_click", properties );
|
||||
} catch ( Exception e ) {
|
||||
MarkerServiceHandler.getMogoAnalytics().track("v2x_road_click", properties);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
@@ -269,57 +256,57 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* @param marker 地图marker抽象对象
|
||||
* @return markerOpenStatus
|
||||
*/
|
||||
private boolean switchMarkerOpenStatus( IMogoMarker marker ) {
|
||||
if ( mLastCheckMarker != null ) {
|
||||
private boolean switchMarkerOpenStatus(IMogoMarker marker) {
|
||||
if (mLastCheckMarker != null) {
|
||||
// 判断点击的是否是同一个
|
||||
if ( marker.equals( mLastCheckMarker ) ) {
|
||||
if (marker.equals(mLastCheckMarker)) {
|
||||
return false;
|
||||
}
|
||||
// 将上次选中 Marker 设置为未选中状态
|
||||
closeMarker( mLastCheckMarker );
|
||||
closeMarker(mLastCheckMarker);
|
||||
}
|
||||
|
||||
// 将当前的Marker设置为选中
|
||||
openMarker( marker );
|
||||
openMarker(marker);
|
||||
return true;
|
||||
}
|
||||
|
||||
// 展开气泡
|
||||
private void openMarker( IMogoMarker mogoMarker ) {
|
||||
if ( mogoMarker == null ) {
|
||||
private void openMarker(IMogoMarker mogoMarker) {
|
||||
if (mogoMarker == null) {
|
||||
return;
|
||||
}
|
||||
mLastCheckMarker = mogoMarker;
|
||||
// 在线车辆点击使用infoWindow
|
||||
if ( TextUtils.equals( mogoMarker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA ) ) {
|
||||
updateCarUserInfoWindow( mogoMarker );
|
||||
if (TextUtils.equals(mogoMarker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA)) {
|
||||
updateCarUserInfoWindow(mogoMarker);
|
||||
} else {
|
||||
Object object = mogoMarker.getObject();
|
||||
if ( object instanceof MarkerShowEntity ) {
|
||||
MarkerShowEntity markerShowEntity = ( MarkerShowEntity ) object;
|
||||
markerShowEntity.setChecked( true );
|
||||
IMarkerView markerView = MapMarkerAdapter.getMarkerView( mContext, markerShowEntity, mogoMarker.getMogoMarkerOptions() );
|
||||
markerView.setMarker( mogoMarker );
|
||||
if ( markerView instanceof OnlineCarMarkerView ) {
|
||||
if (object instanceof MarkerShowEntity) {
|
||||
MarkerShowEntity markerShowEntity = (MarkerShowEntity) object;
|
||||
markerShowEntity.setChecked(true);
|
||||
IMarkerView markerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, mogoMarker.getMogoMarkerOptions());
|
||||
markerView.setMarker(mogoMarker);
|
||||
if (markerView instanceof OnlineCarMarkerView) {
|
||||
try {
|
||||
mogoMarker.setIcon( markerView.getBitmap( ( ( MarkerOnlineCar ) markerShowEntity.getBindObj() ).getCarInfo().getVehicleType() ) );
|
||||
} catch ( Exception e ) {
|
||||
mogoMarker.setIcon( markerView.getBitmap( 0 ) );
|
||||
mogoMarker.setIcon(markerView.getBitmap(((MarkerOnlineCar) markerShowEntity.getBindObj()).getCarInfo().getVehicleType()));
|
||||
} catch (Exception e) {
|
||||
mogoMarker.setIcon(markerView.getBitmap(0));
|
||||
}
|
||||
} else {
|
||||
if ( MarkerServiceHandler.getApis().getStatusManagerApi().isVrMode() ) {
|
||||
if (MarkerServiceHandler.getApis().getStatusManagerApi().isVrMode()) {
|
||||
mogoMarker.hideInfoWindow();
|
||||
mogoMarker.showInfoWindow();
|
||||
} else {
|
||||
mogoMarker.setIcon( ViewUtils.fromView( markerView.getView() ) );
|
||||
mogoMarker.setIcon(ViewUtils.fromView(markerView.getView()));
|
||||
}
|
||||
}
|
||||
mogoMarker.setToTop();
|
||||
}
|
||||
}
|
||||
if ( !MarkerServiceHandler.getApis().getStatusManagerApi().isVrMode() ) {
|
||||
MarkerServiceHandler.getMogoStatusManager().setUserInteractionStatus( TAG, true, false );
|
||||
MarkerServiceHandler.getMapUIController().moveToCenter( mogoMarker.getPosition(), DebugConfig.isRoadEventAnimated() );
|
||||
if (!MarkerServiceHandler.getApis().getStatusManagerApi().isVrMode()) {
|
||||
MarkerServiceHandler.getMogoStatusManager().setUserInteractionStatus(TAG, true, false);
|
||||
MarkerServiceHandler.getMapUIController().moveToCenter(mogoMarker.getPosition(), DebugConfig.isRoadEventAnimated());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -328,47 +315,47 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
*
|
||||
* @param marker
|
||||
*/
|
||||
private void updateCarUserInfoWindow( IMogoMarker marker ) {
|
||||
if ( marker != null && !marker.isDestroyed() ) {
|
||||
private void updateCarUserInfoWindow(IMogoMarker marker) {
|
||||
if (marker != null && !marker.isDestroyed()) {
|
||||
try {
|
||||
if ( !TextUtils.equals( marker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA ) ) {
|
||||
if (!TextUtils.equals(marker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA)) {
|
||||
return;
|
||||
}
|
||||
marker.setIcon( OnlineCarMarkerView.getInstance().getSelectedBitmap( getCarVehicleType( marker ) ) );
|
||||
MarkerOnlineCar onlineCar = ( MarkerOnlineCar ) ( ( MarkerShowEntity ) marker.getObject() ).getBindObj();
|
||||
CallChatApi.getInstance().showUserWindow( mContext, onlineCar );
|
||||
} catch ( Exception e ) {
|
||||
marker.setIcon(OnlineCarMarkerView.getInstance().getSelectedBitmap(getCarVehicleType(marker)));
|
||||
MarkerOnlineCar onlineCar = (MarkerOnlineCar) ((MarkerShowEntity) marker.getObject()).getBindObj();
|
||||
CallChatApi.getInstance().showUserWindow(mContext, onlineCar);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 折叠气泡
|
||||
private void closeMarker( IMogoMarker mogoMarker ) {
|
||||
if ( mogoMarker == null ) {
|
||||
private void closeMarker(IMogoMarker mogoMarker) {
|
||||
if (mogoMarker == null) {
|
||||
return;
|
||||
}
|
||||
// 在线车辆点击使用infoWindow
|
||||
if ( TextUtils.equals( mogoMarker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA ) ) {
|
||||
mogoMarker.setIcon( OnlineCarMarkerView.getInstance().getBitmap( getCarVehicleType( mogoMarker ) ) );
|
||||
if (TextUtils.equals(mogoMarker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA)) {
|
||||
mogoMarker.setIcon(OnlineCarMarkerView.getInstance().getBitmap(getCarVehicleType(mogoMarker)));
|
||||
} else {
|
||||
Object object = mogoMarker.getObject();
|
||||
if ( object != null ) {
|
||||
MarkerShowEntity markerShowEntity = ( MarkerShowEntity ) object;
|
||||
markerShowEntity.setChecked( false );
|
||||
IMarkerView markerView = MapMarkerAdapter.getMarkerView( mContext, markerShowEntity, mogoMarker.getMogoMarkerOptions() );
|
||||
markerView.setMarker( mogoMarker );
|
||||
if ( markerView instanceof OnlineCarMarkerView ) {
|
||||
if (object != null) {
|
||||
MarkerShowEntity markerShowEntity = (MarkerShowEntity) object;
|
||||
markerShowEntity.setChecked(false);
|
||||
IMarkerView markerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, mogoMarker.getMogoMarkerOptions());
|
||||
markerView.setMarker(mogoMarker);
|
||||
if (markerView instanceof OnlineCarMarkerView) {
|
||||
try {
|
||||
mogoMarker.setIcon( markerView.getBitmap( ( ( MarkerOnlineCar ) markerShowEntity.getBindObj() ).getCarInfo().getVehicleType() ) );
|
||||
} catch ( Exception e ) {
|
||||
mogoMarker.setIcon( markerView.getBitmap( 0 ) );
|
||||
mogoMarker.setIcon(markerView.getBitmap(((MarkerOnlineCar) markerShowEntity.getBindObj()).getCarInfo().getVehicleType()));
|
||||
} catch (Exception e) {
|
||||
mogoMarker.setIcon(markerView.getBitmap(0));
|
||||
}
|
||||
} else {
|
||||
if ( MarkerServiceHandler.getApis().getStatusManagerApi().isVrMode() ) {
|
||||
if (MarkerServiceHandler.getApis().getStatusManagerApi().isVrMode()) {
|
||||
mogoMarker.hideInfoWindow();
|
||||
mogoMarker.showInfoWindow();
|
||||
} else {
|
||||
mogoMarker.setIcon( ViewUtils.fromView( markerView.getView() ) );
|
||||
mogoMarker.setIcon(ViewUtils.fromView(markerView.getView()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -381,38 +368,38 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* @param marker
|
||||
* @return
|
||||
*/
|
||||
private int getCarVehicleType( IMogoMarker marker ) {
|
||||
private int getCarVehicleType(IMogoMarker marker) {
|
||||
try {
|
||||
return ( ( MarkerOnlineCar )
|
||||
( ( MarkerShowEntity ) marker.getObject() ).getBindObj() )
|
||||
return ((MarkerOnlineCar)
|
||||
((MarkerShowEntity) marker.getObject()).getBindObj())
|
||||
.getCarInfo()
|
||||
.getVehicleType();
|
||||
} catch ( Exception e ) {
|
||||
} catch (Exception e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// 绘制Marker
|
||||
public synchronized void drawMapMarker( MarkerResponse response ) {
|
||||
public synchronized void drawMapMarker(MarkerResponse response) {
|
||||
|
||||
if ( response == null || response.getResult() == null ) {
|
||||
if (response == null || response.getResult() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( MarkerServiceHandler.getMogoStatusManager().isSearchUIShow() ) {
|
||||
if (MarkerServiceHandler.getMogoStatusManager().isSearchUIShow()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 解析不同的Marker类型,然后对应的进行绘制
|
||||
|
||||
mLastDataResult = response.getResult();
|
||||
UiThreadHandler.post( this::dispatchDataToBiz );
|
||||
UiThreadHandler.post(this::dispatchDataToBiz);
|
||||
|
||||
drawMarkerByCurrentType( mLastDataResult );
|
||||
drawMarkerByCurrentType(mLastDataResult);
|
||||
|
||||
// 在首页时才埋点
|
||||
if ( MarkerServiceHandler.getMogoStatusManager().isMainPageOnResume() ) {
|
||||
trackData( mLastDataResult );
|
||||
if (MarkerServiceHandler.getMogoStatusManager().isMainPageOnResume()) {
|
||||
trackData(mLastDataResult);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -421,17 +408,21 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
*
|
||||
* @param markerCardResult
|
||||
*/
|
||||
private synchronized void drawMarkerByCurrentType( MarkerCardResult markerCardResult ) {
|
||||
private synchronized void drawMarkerByCurrentType(MarkerCardResult markerCardResult) {
|
||||
|
||||
if ( markerCardResult == null ) {
|
||||
if (markerCardResult == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( MarkerServiceHandler.getMogoStatusManager().isSearchUIShow() ) {
|
||||
if (MarkerServiceHandler.getMogoStatusManager().isSearchUIShow()) {
|
||||
return;
|
||||
}
|
||||
|
||||
drawAllMarker( markerCardResult );
|
||||
if (MarkerServiceHandler.getMapUIController().getCurrentMapVisualAngle().isLongSight()) {
|
||||
return;
|
||||
}
|
||||
|
||||
drawAllMarker(markerCardResult);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -439,9 +430,9 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
*
|
||||
* @param markerCardResult
|
||||
*/
|
||||
private void drawAllMarker( MarkerCardResult markerCardResult ) {
|
||||
List< MarkerExploreWay > exploreWayList = markerCardResult.getExploreWay();
|
||||
RoadConditionDrawer.getInstance().drawRoadConditionMarker( exploreWayList, ServiceConst.MAX_AMOUNT_ALL, this );
|
||||
private void drawAllMarker(MarkerCardResult markerCardResult) {
|
||||
List<MarkerExploreWay> exploreWayList = markerCardResult.getExploreWay();
|
||||
RoadConditionDrawer.getInstance().drawRoadConditionMarker(exploreWayList, ServiceConst.MAX_AMOUNT_ALL, this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -449,51 +440,51 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
*
|
||||
* @param markerCardResult
|
||||
*/
|
||||
private void trackData( MarkerCardResult markerCardResult ) {
|
||||
if ( markerCardResult == null ) {
|
||||
private void trackData(MarkerCardResult markerCardResult) {
|
||||
if (markerCardResult == null) {
|
||||
return;
|
||||
}
|
||||
List< MarkerExploreWay > exploreWayList = markerCardResult.getExploreWay();
|
||||
List<MarkerExploreWay> exploreWayList = markerCardResult.getExploreWay();
|
||||
|
||||
JSONArray array = new JSONArray();
|
||||
int size = 0;
|
||||
size = exploreWayList == null ? 0 : exploreWayList.size();
|
||||
final Map< String, Integer > typeCounterMap = new HashMap<>();
|
||||
for ( int i = 0; i < size; i++ ) {
|
||||
MarkerExploreWay exploreWay = exploreWayList.get( i );
|
||||
final Map<String, Integer> typeCounterMap = new HashMap<>();
|
||||
for (int i = 0; i < size; i++) {
|
||||
MarkerExploreWay exploreWay = exploreWayList.get(i);
|
||||
String poiType = exploreWay.getPoiType();
|
||||
int counter = 0;
|
||||
if ( !typeCounterMap.containsKey( poiType ) ) {
|
||||
if (!typeCounterMap.containsKey(poiType)) {
|
||||
counter = 0;
|
||||
} else {
|
||||
counter = typeCounterMap.get( poiType );
|
||||
counter = typeCounterMap.get(poiType);
|
||||
}
|
||||
typeCounterMap.put( poiType, counter + 1 );
|
||||
typeCounterMap.put(poiType, counter + 1);
|
||||
}
|
||||
if ( !typeCounterMap.isEmpty() ) {
|
||||
for ( Map.Entry< String, Integer > entry : typeCounterMap.entrySet() ) {
|
||||
if ( entry == null || entry.getKey() == null ) {
|
||||
if (!typeCounterMap.isEmpty()) {
|
||||
for (Map.Entry<String, Integer> entry : typeCounterMap.entrySet()) {
|
||||
if (entry == null || entry.getKey() == null) {
|
||||
continue;
|
||||
}
|
||||
JSONObject object = new JSONObject();
|
||||
try {
|
||||
object.put( "type", entry.getKey() );
|
||||
object.put( "num", entry.getValue() );
|
||||
array.put( object );
|
||||
} catch ( JSONException e ) {
|
||||
object.put("type", entry.getKey());
|
||||
object.put("num", entry.getValue());
|
||||
array.put(object);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
if ( array.length() == 0 ) {
|
||||
if (array.length() == 0) {
|
||||
return;
|
||||
}
|
||||
final Map< String, Object > properties = new HashMap<>();
|
||||
properties.put( "data", array.toString() );
|
||||
MarkerServiceHandler.getMogoAnalytics().track( "v2x_data_get", properties );
|
||||
} catch ( Exception e ) {
|
||||
final Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("data", array.toString());
|
||||
MarkerServiceHandler.getMogoAnalytics().track("v2x_data_get", properties);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -504,11 +495,11 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* 仅在数据刷新的时候分发
|
||||
*/
|
||||
private void dispatchDataToBiz() {
|
||||
if ( mLastDataResult == null ) {
|
||||
if (mLastDataResult == null) {
|
||||
return;
|
||||
}
|
||||
List< MarkerExploreWay > exploreWayList = mLastDataResult.getExploreWay();
|
||||
dispatchDataToBis( ServiceConst.CARD_TYPE_ROAD_CONDITION, exploreWayList == null ? new ArrayList<>() : exploreWayList );
|
||||
List<MarkerExploreWay> exploreWayList = mLastDataResult.getExploreWay();
|
||||
dispatchDataToBis(ServiceConst.CARD_TYPE_ROAD_CONDITION, exploreWayList == null ? new ArrayList<>() : exploreWayList);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -517,13 +508,13 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* @param biz
|
||||
* @param object
|
||||
*/
|
||||
private void dispatchDataToBis( String biz, Object object ) {
|
||||
if ( TextUtils.isEmpty( biz ) ) {
|
||||
private void dispatchDataToBis(String biz, Object object) {
|
||||
if (TextUtils.isEmpty(biz)) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
MarkerServiceHandler.getDataManager().syncData( biz, object );
|
||||
} catch ( Exception e ) {
|
||||
MarkerServiceHandler.getDataManager().syncData(biz, object);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -534,41 +525,28 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* @param markerShowEntity marker 绘制数据实体
|
||||
* @return 绘制的Marker
|
||||
*/
|
||||
public synchronized IMogoMarker drawMapMarker( MarkerShowEntity markerShowEntity, int zIndex ) {
|
||||
public synchronized IMogoMarker drawMapMarker(MarkerShowEntity markerShowEntity, int zIndex) {
|
||||
try {
|
||||
return MarkerDrawer.getInstance().drawMapMarkerImpl( markerShowEntity, zIndex, this );
|
||||
} catch ( Exception e ) {
|
||||
return MarkerDrawer.getInstance().drawMapMarkerImpl(markerShowEntity, zIndex, this);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class< MarkerResponse > target() {
|
||||
return MarkerResponse.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived( final MarkerResponse response ) {
|
||||
if ( ignoreDrawRequest() ) {
|
||||
return;
|
||||
}
|
||||
runOnTargetThread( () -> {
|
||||
drawMapMarker( response );
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步绘制大而全的数据 marker
|
||||
*
|
||||
* @param response
|
||||
*/
|
||||
public void onSyncMarkerResponse( MarkerResponse response ) {
|
||||
if ( ignoreDrawRequest() ) {
|
||||
public void onSyncMarkerResponse(MarkerResponse response) {
|
||||
Logger.d(TAG, "onSyncMarkerResponse response ");
|
||||
if (ignoreDrawRequest()) {
|
||||
Logger.d(TAG, "onSyncMarkerResponse ignoreDraw ");
|
||||
return;
|
||||
}
|
||||
runOnTargetThread( () -> {
|
||||
drawMapMarker( response );
|
||||
} );
|
||||
runOnTargetThread(() -> {
|
||||
drawMapMarker(response);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -577,8 +555,8 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* @param lon
|
||||
* @param lat
|
||||
*/
|
||||
public void syncLocation( double lon, double lat ) {
|
||||
mCarLatLng = new MogoLatLng( lat, lon );
|
||||
public void syncLocation(double lon, double lat) {
|
||||
mCarLatLng = new MogoLatLng(lat, lon);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -586,9 +564,9 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
*
|
||||
* @param latlng
|
||||
*/
|
||||
public void getOnlineCarDataByAutoRefreshStrategy( MogoLatLng latlng ) {
|
||||
UiThreadHandler.removeCallbacks( runnable );
|
||||
getOnlineCarDataImpl( latlng, false, false, ServiceConst.ONLINE_SEARCH_LIMIT, ServiceConst.ONLINE_SEARCH_RADIUS, false );
|
||||
public void getOnlineCarDataByAutoRefreshStrategy(MogoLatLng latlng) {
|
||||
UiThreadHandler.removeCallbacks(runnable);
|
||||
getOnlineCarDataImpl(latlng, false, false, ServiceConst.ONLINE_SEARCH_LIMIT, ServiceConst.ONLINE_SEARCH_RADIUS, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -598,19 +576,19 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* @param limit
|
||||
* @param radius
|
||||
*/
|
||||
public void getOnlineCarDataByVoiceControl( MogoLatLng latLng,
|
||||
boolean onlyFocus,
|
||||
boolean onlySameCity,
|
||||
int limit,
|
||||
int radius ) {
|
||||
UiThreadHandler.removeCallbacks( runnable );
|
||||
getOnlineCarDataImpl( latLng, onlyFocus, onlySameCity, limit, radius, true );
|
||||
public void getOnlineCarDataByVoiceControl(MogoLatLng latLng,
|
||||
boolean onlyFocus,
|
||||
boolean onlySameCity,
|
||||
int limit,
|
||||
int radius) {
|
||||
UiThreadHandler.removeCallbacks(runnable);
|
||||
getOnlineCarDataImpl(latLng, onlyFocus, onlySameCity, limit, radius, true);
|
||||
}
|
||||
|
||||
private final Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
getOnlineCarDataImpl( mCarLatLng, false, false, ServiceConst.ONLINE_SEARCH_LIMIT, ServiceConst.ONLINE_SEARCH_RADIUS, false );
|
||||
getOnlineCarDataImpl(mCarLatLng, false, false, ServiceConst.ONLINE_SEARCH_LIMIT, ServiceConst.ONLINE_SEARCH_RADIUS, false);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -618,7 +596,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* 移除绘制
|
||||
*/
|
||||
public void stopAutoRefresh() {
|
||||
UiThreadHandler.removeCallbacks( runnable );
|
||||
UiThreadHandler.removeCallbacks(runnable);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -637,81 +615,81 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
boolean onlySameCity,
|
||||
int limit,
|
||||
int radius,
|
||||
boolean fitBounds ) {
|
||||
boolean fitBounds) {
|
||||
|
||||
// if ( DebugConfig.isNeedUploadCoordinatesDurationInTime() ) {//todo 实时在线车辆需要注释,否则在2D模式下不能展示
|
||||
// return;
|
||||
// }
|
||||
|
||||
if ( DebugConfig.isDebug() ) {
|
||||
if ( !DebugConfig.isRequestOnlineCarData() ) {
|
||||
if (DebugConfig.isDebug()) {
|
||||
if (!DebugConfig.isRequestOnlineCarData()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( mCarLatLng == null ) {
|
||||
if (mCarLatLng == null) {
|
||||
mCarLatLng = latLng;
|
||||
}
|
||||
|
||||
if ( latLng == null ) {
|
||||
if (latLng == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ignoreOnlineCarRequest() ) {
|
||||
if (ignoreOnlineCarRequest()) {
|
||||
removeCarMarkers();
|
||||
return;
|
||||
}
|
||||
|
||||
mRefreshModel.queryOnLineCarWithRoute( latLng, onlyFocus, onlySameCity, radius, limit, false, new RefreshCallback() {
|
||||
mRefreshModel.queryOnLineCarWithRoute(latLng, onlyFocus, onlySameCity, radius, limit, false, new RefreshCallback() {
|
||||
@Override
|
||||
public void onSuccess( Object o ) {
|
||||
MarkerResponse data = ( MarkerResponse ) o;
|
||||
public void onSuccess(Object o) {
|
||||
MarkerResponse data = (MarkerResponse) o;
|
||||
MarkerCardResult result = data.getResult();
|
||||
if ( result == null ) {
|
||||
if (result == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
List< MarkerOnlineCar > onlineCarList = result.getOnlineCar();
|
||||
if ( MarkerServiceHandler.getMogoStatusManager().isSearchUIShow() ) {
|
||||
List<MarkerOnlineCar> onlineCarList = result.getOnlineCar();
|
||||
if (MarkerServiceHandler.getMogoStatusManager().isSearchUIShow()) {
|
||||
return;
|
||||
}
|
||||
final int size = onlineCarList == null ? 0 : onlineCarList.size();
|
||||
|
||||
if ( mMarkerDisplayBounds == null ) {
|
||||
if (mMarkerDisplayBounds == null) {
|
||||
mMarkerDisplayBounds = new Rect(
|
||||
ResourcesHelper.getDimensionPixelSize( AbsMogoApplication.getApp(), R.dimen.module_service_marker_bounds_leftMargin ),
|
||||
ResourcesHelper.getDimensionPixelSize( AbsMogoApplication.getApp(), R.dimen.module_service_marker_bounds_topMargin ),
|
||||
ResourcesHelper.getDimensionPixelSize( AbsMogoApplication.getApp(), R.dimen.module_service_marker_bounds_rightMargin ),
|
||||
ResourcesHelper.getDimensionPixelSize( AbsMogoApplication.getApp(), R.dimen.module_service_marker_bounds_bottomMargin )
|
||||
ResourcesHelper.getDimensionPixelSize(AbsMogoApplication.getApp(), R.dimen.module_service_marker_bounds_leftMargin),
|
||||
ResourcesHelper.getDimensionPixelSize(AbsMogoApplication.getApp(), R.dimen.module_service_marker_bounds_topMargin),
|
||||
ResourcesHelper.getDimensionPixelSize(AbsMogoApplication.getApp(), R.dimen.module_service_marker_bounds_rightMargin),
|
||||
ResourcesHelper.getDimensionPixelSize(AbsMogoApplication.getApp(), R.dimen.module_service_marker_bounds_bottomMargin)
|
||||
);
|
||||
}
|
||||
|
||||
runOnTargetThread( () -> {
|
||||
trackData( size );
|
||||
OnlineCarDrawer.getInstance().drawOnlineCarMarkers( onlineCarList, Integer.MAX_VALUE, fitBounds, fitBounds, mMarkerDisplayBounds, latLng, MapMarkerManager.this );
|
||||
UiThreadHandler.postDelayed( runnable, SMOOTH_DURATION * 1000 );
|
||||
} );
|
||||
runOnTargetThread(() -> {
|
||||
trackData(size);
|
||||
OnlineCarDrawer.getInstance().drawOnlineCarMarkers(onlineCarList, Integer.MAX_VALUE, fitBounds, fitBounds, mMarkerDisplayBounds, latLng, MapMarkerManager.this);
|
||||
UiThreadHandler.postDelayed(runnable, SMOOTH_DURATION * 1000);
|
||||
});
|
||||
}
|
||||
|
||||
private void trackData( int size ) {
|
||||
private void trackData(int size) {
|
||||
JSONArray array = new JSONArray();
|
||||
JSONObject object = new JSONObject();
|
||||
try {
|
||||
object.put( "type", "10000" );
|
||||
object.put( "num", size );
|
||||
array.put( object );
|
||||
} catch ( JSONException e ) {
|
||||
object.put("type", "10000");
|
||||
object.put("num", size);
|
||||
array.put(object);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if ( array.length() == 0 ) {
|
||||
if (array.length() == 0) {
|
||||
return;
|
||||
}
|
||||
final Map< String, Object > properties = new HashMap<>();
|
||||
properties.put( "data", array.toString() );
|
||||
MarkerServiceHandler.getMogoAnalytics().track( "v2x_data_get", properties );
|
||||
final Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("data", array.toString());
|
||||
MarkerServiceHandler.getMogoAnalytics().track("v2x_data_get", properties);
|
||||
}
|
||||
} );
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -727,7 +705,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* 移除在线车辆 marker
|
||||
*/
|
||||
private void removeCarMarkers() {
|
||||
MarkerServiceHandler.getMarkerManager().removeMarkers( ModuleNames.CARD_TYPE_USER_DATA );
|
||||
MarkerServiceHandler.getMarkerManager().removeMarkers(ModuleNames.CARD_TYPE_USER_DATA);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -740,14 +718,14 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
|| MarkerServiceHandler.getMogoStatusManager().isV2XShow()
|
||||
|| !MarkerServiceHandler.getMogoStatusManager().isMainPageLaunched()
|
||||
|| !MarkerServiceHandler.getMogoStatusManager().isMainPageOnResume()
|
||||
|| MarkerServiceHandler.getApis().getStatusManagerApi().isVrMode();
|
||||
|| MarkerServiceHandler.getMapUIController().getCurrentMapVisualAngle().isLongSight();
|
||||
}
|
||||
|
||||
private void runOnTargetThread( Runnable runnable ) {
|
||||
if ( runnable == null ) {
|
||||
private void runOnTargetThread(Runnable runnable) {
|
||||
if (runnable == null) {
|
||||
return;
|
||||
}
|
||||
ThreadPoolService.execute( runnable );
|
||||
ThreadPoolService.execute(runnable);
|
||||
}
|
||||
|
||||
public String getCurrentModuleName() {
|
||||
@@ -755,25 +733,25 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBizActionDone( String biz, int position, Object data ) {
|
||||
if ( data instanceof MarkerShowEntity && ( ( MarkerShowEntity ) data ).getMarker() != null ) {
|
||||
switchMarkerOpenStatus( ( ( MarkerShowEntity ) data ).getMarker() );
|
||||
public void onBizActionDone(String biz, int position, Object data) {
|
||||
if (data instanceof MarkerShowEntity && ((MarkerShowEntity) data).getMarker() != null) {
|
||||
switchMarkerOpenStatus(((MarkerShowEntity) data).getMarker());
|
||||
} else {
|
||||
IMogoMarkerManager markerManager = MarkerServiceHandler.getMarkerManager();
|
||||
List< IMogoMarker > markers = markerManager.getMarkers( biz );
|
||||
if ( markers != null ) {
|
||||
List<IMogoMarker> markers = markerManager.getMarkers(biz);
|
||||
if (markers != null) {
|
||||
try {
|
||||
IMogoMarker marker = markers.get( position );
|
||||
switchMarkerOpenStatus( marker );
|
||||
} catch ( Exception e ) {
|
||||
IMogoMarker marker = markers.get(position);
|
||||
switchMarkerOpenStatus(marker);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapUiModeChanged( EnumMapUI mapUI ) {
|
||||
switch ( mapUI ) {
|
||||
public void onMapUiModeChanged(EnumMapUI mapUI) {
|
||||
switch (mapUI) {
|
||||
case Type_Light:
|
||||
case Type_Night:
|
||||
redrawMarkerByStyleChanged();
|
||||
@@ -785,12 +763,12 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* 重绘内容
|
||||
*/
|
||||
public void redrawMarkerByStyleChanged() {
|
||||
if ( mLastDataResult != null ) {
|
||||
runOnTargetThread( () -> {
|
||||
MarkerServiceHandler.getMarkerManager().removeMarkers( ModuleNames.CARD_TYPE_ROAD_CONDITION );
|
||||
drawMarkerByCurrentType( mLastDataResult );
|
||||
if (mLastDataResult != null) {
|
||||
runOnTargetThread(() -> {
|
||||
MarkerServiceHandler.getMarkerManager().removeMarkers(ModuleNames.CARD_TYPE_ROAD_CONDITION);
|
||||
drawMarkerByCurrentType(mLastDataResult);
|
||||
mLastCheckMarker = null;
|
||||
} );
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -798,8 +776,8 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* 关闭当前点击过的 marker
|
||||
*/
|
||||
public void onCloseCurrentSelectedMarker() {
|
||||
if ( mLastCheckMarker != null && !mLastCheckMarker.isDestroyed() ) {
|
||||
closeMarker( mLastCheckMarker );
|
||||
if (mLastCheckMarker != null && !mLastCheckMarker.isDestroyed()) {
|
||||
closeMarker(mLastCheckMarker);
|
||||
mLastCheckMarker = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.model.MogoPoi;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
import com.mogo.module.common.ModuleNames;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerExploreWayItem;
|
||||
@@ -34,7 +35,6 @@ import com.mogo.module.common.utils.Const;
|
||||
import com.mogo.module.v2x.entity.net.V2XSeekHelpRes;
|
||||
import com.mogo.module.v2x.entity.net.V2XStrategyPushRes;
|
||||
import com.mogo.module.v2x.network.V2XRefreshCallback;
|
||||
import com.mogo.module.v2x.receiver.AdasDataBroadcastReceiver;
|
||||
import com.mogo.module.v2x.receiver.SceneBroadcastReceiver;
|
||||
import com.mogo.module.v2x.scenario.impl.V2XScenarioManager;
|
||||
import com.mogo.module.v2x.scenario.scene.livecar.V2XVoiceCallLiveBiz;
|
||||
@@ -431,6 +431,11 @@ public class V2XModuleProvider implements
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapVisualAngleChanged(VisualAngleMode visualAngleMode) {
|
||||
//todo visual 涉及到V2X,V2N业务,视距状态切换回调
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.content.Intent;
|
||||
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
@@ -162,6 +163,12 @@ public class TestPanelBroadcastReceiver extends BroadcastReceiver {
|
||||
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
|
||||
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
|
||||
LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent);
|
||||
} else if (sceneType == 18) { //test visualAngle UI
|
||||
V2XServiceManager.getMapService().getMapUIController().changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT);
|
||||
} else if (sceneType == 19) { //test visualAngle UI
|
||||
V2XServiceManager.getMapService().getMapUIController().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT);
|
||||
} else if (sceneType == 20) { //test visualAngle UI
|
||||
V2XServiceManager.getMapService().getMapUIController().changeMapVisualAngle(VisualAngleMode.MODE_CLOSE_SIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user