[Update]Map按照新架构重构
This commit is contained in:
@@ -8,6 +8,7 @@ import androidx.fragment.app.FragmentActivity;
|
|||||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||||
|
import com.mogo.map.MogoMapUIController;
|
||||||
import com.mogo.module.common.MogoApisHandler;
|
import com.mogo.module.common.MogoApisHandler;
|
||||||
import com.mogo.och.bus.constant.OchBusConst;
|
import com.mogo.och.bus.constant.OchBusConst;
|
||||||
import com.mogo.och.bus.fragment.OchBusFragment;
|
import com.mogo.och.bus.fragment.OchBusFragment;
|
||||||
@@ -36,10 +37,7 @@ public class OchBusProvider implements IMogoOCH {
|
|||||||
*/
|
*/
|
||||||
private void stepIntoVrMode(){
|
private void stepIntoVrMode(){
|
||||||
Logger.d( TAG, "进入vr模式" );
|
Logger.d( TAG, "进入vr模式" );
|
||||||
MogoApisHandler.getInstance()
|
MogoMapUIController.getInstance()
|
||||||
.getApis()
|
|
||||||
.getMapServiceApi()
|
|
||||||
.getMapUIController()
|
|
||||||
.openVrMode(false);
|
.openVrMode(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
|
|||||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||||
|
import com.mogo.map.MogoMapUIController;
|
||||||
|
import com.mogo.map.MogoMarkerManager;
|
||||||
import com.mogo.map.listener.IMogoMapListener;
|
import com.mogo.map.listener.IMogoMapListener;
|
||||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||||
import com.mogo.module.common.MogoApisHandler;
|
import com.mogo.module.common.MogoApisHandler;
|
||||||
@@ -119,15 +121,13 @@ public abstract class BaseOchBusTabFragment<V extends IView, P extends Presenter
|
|||||||
@Override
|
@Override
|
||||||
public void onClickImpl(View v) {
|
public void onClickImpl(View v) {
|
||||||
//切换地图的远近视图
|
//切换地图的远近视图
|
||||||
if (MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getCurrentMapVisualAngle().isLongSight()) {
|
if (MogoMapUIController.getInstance().getCurrentMapVisualAngle().isLongSight()) {
|
||||||
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(AbsMogoApplication.getApp()).visibleAllMarkers();
|
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).visibleAllMarkers();
|
||||||
MogoApisHandler.getInstance().getApis().getMapServiceApi()
|
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
|
||||||
.getMapUIController().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
|
|
||||||
mSwitchText.setText(R.string.bus_map_model_normal);
|
mSwitchText.setText(R.string.bus_map_model_normal);
|
||||||
} else if (MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getCurrentMapVisualAngle().isMediumSight()) {
|
} else if (MogoMapUIController.getInstance().getCurrentMapVisualAngle().isMediumSight()) {
|
||||||
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(AbsMogoApplication.getApp()).inVisibleWithoutMarkers(DataTypes.TYPE_MARKER_ADAS);
|
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).inVisibleWithoutMarkers(DataTypes.TYPE_MARKER_ADAS);
|
||||||
MogoApisHandler.getInstance().getApis().getMapServiceApi()
|
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null);
|
||||||
.getMapUIController().changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null);
|
|
||||||
mSwitchText.setText(R.string.bus_map_model_faster);
|
mSwitchText.setText(R.string.bus_map_model_faster);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
|||||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
|
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
|
||||||
|
import com.mogo.map.MogoMarkerManager;
|
||||||
import com.mogo.map.marker.MogoMarkerOptions;
|
import com.mogo.map.marker.MogoMarkerOptions;
|
||||||
import com.mogo.module.common.MogoApisHandler;
|
import com.mogo.module.common.MogoApisHandler;
|
||||||
import com.mogo.och.bus.R;
|
import com.mogo.och.bus.R;
|
||||||
@@ -331,12 +332,10 @@ public class OchBusFragment extends BaseOchBusTabFragment<OchBusFragment, OchBus
|
|||||||
options.icon(bitmap);
|
options.icon(bitmap);
|
||||||
options.latitude(lat);
|
options.latitude(lat);
|
||||||
options.longitude(longi);
|
options.longitude(longi);
|
||||||
MogoApisHandler.getInstance().getApis().getMapServiceApi()
|
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).addMarker(uuid, options);
|
||||||
.getMarkerManager(AbsMogoApplication.getApp()).addMarker(uuid, options);
|
}else {
|
||||||
} else {
|
Log.d("RemoveMapMaker=",uuid+"=latitude="+lat+",longitude="+longi);
|
||||||
Log.d("RemoveMapMaker=", uuid + "=latitude=" + lat + ",longitude=" + longi);
|
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).removeMarkers(uuid);
|
||||||
MogoApisHandler.getInstance().getApis().getMapServiceApi()
|
|
||||||
.getMarkerManager(AbsMogoApplication.getApp()).removeMarkers(uuid);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import androidx.fragment.app.FragmentActivity;
|
|||||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||||
|
import com.mogo.map.MogoMapUIController;
|
||||||
import com.mogo.module.common.MogoApisHandler;
|
import com.mogo.module.common.MogoApisHandler;
|
||||||
import com.mogo.och.taxi.passenger.constant.TaxiPassengerConst;
|
import com.mogo.och.taxi.passenger.constant.TaxiPassengerConst;
|
||||||
import com.mogo.och.taxi.passenger.ui.TaxiPassengerBaseFragment;
|
import com.mogo.och.taxi.passenger.ui.TaxiPassengerBaseFragment;
|
||||||
@@ -43,10 +44,7 @@ class MogoOCHTaxi implements IMogoOCH, IMogoStatusChangedListener {
|
|||||||
*/
|
*/
|
||||||
private void stepIntoVrMode() {
|
private void stepIntoVrMode() {
|
||||||
Logger.d( TAG, "进入vr模式" );
|
Logger.d( TAG, "进入vr模式" );
|
||||||
MogoApisHandler.getInstance()
|
MogoMapUIController.getInstance()
|
||||||
.getApis()
|
|
||||||
.getMapServiceApi()
|
|
||||||
.getMapUIController()
|
|
||||||
.openVrMode( false );
|
.openVrMode( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.mogo.eagle.core.data.map.MogoLatLng;
|
|||||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||||
import com.mogo.eagle.core.function.v2x.events.utils.LocationUtils;
|
import com.mogo.eagle.core.function.v2x.events.utils.LocationUtils;
|
||||||
import com.mogo.eagle.core.utilcode.util.ColorUtils;
|
import com.mogo.eagle.core.utilcode.util.ColorUtils;
|
||||||
|
import com.mogo.map.MogoOverlayManager;
|
||||||
import com.mogo.map.overlay.IMogoOverlayManager;
|
import com.mogo.map.overlay.IMogoOverlayManager;
|
||||||
import com.mogo.map.overlay.IMogoPolyline;
|
import com.mogo.map.overlay.IMogoPolyline;
|
||||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||||
@@ -32,7 +33,7 @@ public class OCHTaxiOverlayManager {
|
|||||||
// 引导线颜色
|
// 引导线颜色
|
||||||
mPolylineColors = new ArrayList<>();
|
mPolylineColors = new ArrayList<>();
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mogoOverlayManager = MogoApisHandler.getInstance().getApis().getMapServiceApi().getOverlayManager(mContext);
|
mogoOverlayManager = MogoOverlayManager.getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.location.Location;
|
import android.location.Location;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.text.TextUtils;
|
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
@@ -14,7 +13,6 @@ import com.mogo.cloud.commons.utils.CoordinateUtils;
|
|||||||
import com.mogo.commons.debug.DebugConfig;
|
import com.mogo.commons.debug.DebugConfig;
|
||||||
import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo;
|
import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo;
|
||||||
import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo;
|
import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo;
|
||||||
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo;
|
|
||||||
import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo;
|
import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo;
|
||||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ public class TaxiPassengerServingOrderPresenter extends Presenter<TaxiPassengerS
|
|||||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||||
@Override
|
@Override
|
||||||
public void onCurrentOrderDistToEndChanged(int meters, int timeInSecond) {
|
public void onCurrentOrderDistToEndChanged(int meters, int timeInSecond) {
|
||||||
mView.onCurrentOrderDistToEndChanged(meters,timeInSecond);
|
mView.onCurrentOrderDistToEndChanged(meters,timeInSecond);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -92,14 +92,14 @@ public class TaxiPassengerServingOrderPresenter extends Presenter<TaxiPassengerS
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCarLocationChanged(Location location) {
|
public void onCarLocationChanged(Location location) {
|
||||||
if (location != null){
|
if (location != null){
|
||||||
mView.onCarLocationChanged(location);
|
mView.onCarLocationChanged(location);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLimitingVelocityChange(int limitingVelocity) {
|
public void onLimitingVelocityChange(int limitingVelocity) {
|
||||||
mView.onLimitingVelocityChange(limitingVelocity);
|
mView.onLimitingVelocityChange(limitingVelocity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
|||||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||||
import com.mogo.eagle.core.function.call.map.CallerSmpManager;
|
import com.mogo.eagle.core.function.call.map.CallerSmpManager;
|
||||||
|
import com.mogo.map.MogoMapUIController;
|
||||||
|
import com.mogo.map.MogoMarkerManager;
|
||||||
import com.mogo.map.listener.IMogoMapListener;
|
import com.mogo.map.listener.IMogoMapListener;
|
||||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||||
import com.mogo.module.common.MogoApisHandler;
|
import com.mogo.module.common.MogoApisHandler;
|
||||||
@@ -73,18 +75,13 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
//视角切换
|
//视角切换
|
||||||
if (MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController()
|
if (MogoMapUIController.getInstance()
|
||||||
.getCurrentMapVisualAngle().isLongSight()) {
|
.getCurrentMapVisualAngle().isLongSight()) {
|
||||||
MogoApisHandler.getInstance().getApis().getMapServiceApi()
|
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).visibleAllMarkers();
|
||||||
.getMarkerManager(AbsMogoApplication.getApp()).visibleAllMarkers();
|
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
|
||||||
MogoApisHandler.getInstance().getApis().getMapServiceApi()
|
} else if (MogoMapUIController.getInstance().getCurrentMapVisualAngle().isMediumSight()) {
|
||||||
.getMapUIController().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
|
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).inVisibleWithoutMarkers(DataTypes.TYPE_MARKER_ADAS);
|
||||||
} else if (MogoApisHandler.getInstance().getApis().getMapServiceApi()
|
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null);
|
||||||
.getMapUIController().getCurrentMapVisualAngle().isMediumSight()) {
|
|
||||||
MogoApisHandler.getInstance().getApis().getMapServiceApi()
|
|
||||||
.getMarkerManager(AbsMogoApplication.getApp()).inVisibleWithoutMarkers(DataTypes.TYPE_MARKER_ADAS);
|
|
||||||
MogoApisHandler.getInstance().getApis().getMapServiceApi()
|
|
||||||
.getMapUIController().changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import androidx.fragment.app.FragmentActivity;
|
|||||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||||
|
import com.mogo.map.MogoMapUIController;
|
||||||
import com.mogo.module.common.MogoApisHandler;
|
import com.mogo.module.common.MogoApisHandler;
|
||||||
import com.mogo.och.taxi.constant.OCHTaxiConst;
|
import com.mogo.och.taxi.constant.OCHTaxiConst;
|
||||||
import com.mogo.och.taxi.ui.OCHTaxiFragment;
|
import com.mogo.och.taxi.ui.OCHTaxiFragment;
|
||||||
@@ -44,10 +45,7 @@ class MogoOCHTaxi implements IMogoOCH , IMogoStatusChangedListener {
|
|||||||
*/
|
*/
|
||||||
private void stepIntoVrMode() {
|
private void stepIntoVrMode() {
|
||||||
Logger.d( TAG, "进入vr模式" );
|
Logger.d( TAG, "进入vr模式" );
|
||||||
MogoApisHandler.getInstance()
|
MogoMapUIController.getInstance()
|
||||||
.getApis()
|
|
||||||
.getMapServiceApi()
|
|
||||||
.getMapUIController()
|
|
||||||
.openVrMode( false );
|
.openVrMode( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.mogo.eagle.core.data.map.MogoLatLng;
|
|||||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||||
import com.mogo.eagle.core.function.v2x.events.utils.LocationUtils;
|
import com.mogo.eagle.core.function.v2x.events.utils.LocationUtils;
|
||||||
import com.mogo.eagle.core.utilcode.util.ColorUtils;
|
import com.mogo.eagle.core.utilcode.util.ColorUtils;
|
||||||
|
import com.mogo.map.MogoOverlayManager;
|
||||||
import com.mogo.map.overlay.IMogoOverlayManager;
|
import com.mogo.map.overlay.IMogoOverlayManager;
|
||||||
import com.mogo.map.overlay.IMogoPolyline;
|
import com.mogo.map.overlay.IMogoPolyline;
|
||||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||||
@@ -32,7 +33,7 @@ public class OCHTaxiOverlayManager {
|
|||||||
// 引导线颜色
|
// 引导线颜色
|
||||||
mPolylineColors = new ArrayList<>();
|
mPolylineColors = new ArrayList<>();
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mogoOverlayManager = MogoApisHandler.getInstance().getApis().getMapServiceApi().getOverlayManager(mContext);
|
mogoOverlayManager = MogoOverlayManager.getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
|
|||||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||||
import com.mogo.eagle.core.function.call.map.CallerSmpManager;
|
import com.mogo.eagle.core.function.call.map.CallerSmpManager;
|
||||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||||
|
import com.mogo.map.MogoMapUIController;
|
||||||
|
import com.mogo.map.MogoMarkerManager;
|
||||||
import com.mogo.map.listener.IMogoMapListener;
|
import com.mogo.map.listener.IMogoMapListener;
|
||||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||||
import com.mogo.module.common.MogoApisHandler;
|
import com.mogo.module.common.MogoApisHandler;
|
||||||
@@ -115,14 +117,12 @@ public abstract class BaseOchTaxiTabFragment<V extends IView, P extends Presente
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
//视角切换
|
//视角切换
|
||||||
if (MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getCurrentMapVisualAngle().isLongSight()) {
|
if (MogoMapUIController.getInstance().getCurrentMapVisualAngle().isLongSight()) {
|
||||||
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(AbsMogoApplication.getApp()).visibleAllMarkers();
|
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()) .visibleAllMarkers();
|
||||||
MogoApisHandler.getInstance().getApis().getMapServiceApi()
|
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
|
||||||
.getMapUIController().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
|
} else if (MogoMapUIController.getInstance().getCurrentMapVisualAngle().isMediumSight()) {
|
||||||
} else if (MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getCurrentMapVisualAngle().isMediumSight()) {
|
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()) .inVisibleWithoutMarkers(DataTypes.TYPE_MARKER_ADAS);
|
||||||
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(AbsMogoApplication.getApp()).inVisibleWithoutMarkers(DataTypes.TYPE_MARKER_ADAS);
|
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null);
|
||||||
MogoApisHandler.getInstance().getApis().getMapServiceApi()
|
|
||||||
.getMapUIController().changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
|||||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
|
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
|
||||||
import com.mogo.eagle.core.utilcode.util.DateTimeUtils;
|
import com.mogo.eagle.core.utilcode.util.DateTimeUtils;
|
||||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||||
|
import com.mogo.map.MogoMarkerManager;
|
||||||
import com.mogo.map.marker.MogoMarkerOptions;
|
import com.mogo.map.marker.MogoMarkerOptions;
|
||||||
import com.mogo.module.common.MogoApisHandler;
|
import com.mogo.module.common.MogoApisHandler;
|
||||||
import com.mogo.och.taxi.callback.IOCHTaxiNaviChangedCallback;
|
import com.mogo.och.taxi.callback.IOCHTaxiNaviChangedCallback;
|
||||||
@@ -534,10 +535,10 @@ public class OCHTaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implem
|
|||||||
options.icon(bitmap);
|
options.icon(bitmap);
|
||||||
options.latitude(station.get(1));
|
options.latitude(station.get(1));
|
||||||
options.longitude(station.get(0));
|
options.longitude(station.get(0));
|
||||||
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(AbsMogoApplication.getApp()).addMarker(uuid, options);
|
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()) .addMarker(uuid, options);
|
||||||
}else {
|
}else {
|
||||||
Log.d("RemoveMapMaker=",uuid+"=latitude="+station.get(1)+",longitude="+station.get(0));
|
Log.d("RemoveMapMaker=",uuid+"=latitude="+station.get(1)+",longitude="+station.get(0));
|
||||||
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(AbsMogoApplication.getApp()).removeMarkers(uuid);
|
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()) .removeMarkers(uuid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|||||||
1
app_ipc_monitoring/.gitignore
vendored
1
app_ipc_monitoring/.gitignore
vendored
@@ -1 +0,0 @@
|
|||||||
/build
|
|
||||||
21
app_ipc_monitoring/proguard-rules.pro
vendored
21
app_ipc_monitoring/proguard-rules.pro
vendored
@@ -1,21 +0,0 @@
|
|||||||
# Add project specific ProGuard rules here.
|
|
||||||
# You can control the set of applied configuration files using the
|
|
||||||
# proguardFiles setting in build.gradle.
|
|
||||||
#
|
|
||||||
# For more details, see
|
|
||||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
|
||||||
|
|
||||||
# If your project uses WebView with JS, uncomment the following
|
|
||||||
# and specify the fully qualified class name to the JavaScript interface
|
|
||||||
# class:
|
|
||||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
|
||||||
# public *;
|
|
||||||
#}
|
|
||||||
|
|
||||||
# Uncomment this to preserve the line number information for
|
|
||||||
# debugging stack traces.
|
|
||||||
#-keepattributes SourceFile,LineNumberTable
|
|
||||||
|
|
||||||
# If you keep the line number information, uncomment this to
|
|
||||||
# hide the original source file name.
|
|
||||||
#-renamesourcefileattribute SourceFile
|
|
||||||
@@ -31,6 +31,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListen
|
|||||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager
|
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager
|
||||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showAdUpgradeStatus
|
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showAdUpgradeStatus
|
||||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showDockerRebootResult
|
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showDockerRebootResult
|
||||||
|
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||||
import com.mogo.module.common.MogoApisHandler
|
import com.mogo.module.common.MogoApisHandler
|
||||||
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter
|
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter
|
||||||
@@ -127,7 +128,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
|||||||
MogoApisHandler.getInstance().apis.adasControllerApi.satelliteTime =
|
MogoApisHandler.getInstance().apis.adasControllerApi.satelliteTime =
|
||||||
java.lang.Double.valueOf(gnssInfo.satelliteTime).toLong()
|
java.lang.Double.valueOf(gnssInfo.satelliteTime).toLong()
|
||||||
if (1 == FunctionBuildConfig.gpsProvider) {
|
if (1 == FunctionBuildConfig.gpsProvider) {
|
||||||
MarkerServiceHandler.getApis().mapServiceApi.mapUIController.syncLocation2Map(
|
CallerMapUIServiceManager.getMapUIController()?.syncLocation2Map(
|
||||||
gnssInfo
|
gnssInfo
|
||||||
)
|
)
|
||||||
SnapshotLocationDataCenter.getInstance().syncAdasLocationInfo(gnssInfo)
|
SnapshotLocationDataCenter.getInstance().syncAdasLocationInfo(gnssInfo)
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import com.mogo.eagle.core.function.chat.facade.utils.log
|
|||||||
import com.mogo.eagle.core.function.chat.facade.voice.VoiceControlFacade
|
import com.mogo.eagle.core.function.chat.facade.voice.VoiceControlFacade
|
||||||
import com.mogo.eagle.core.utilcode.kotlin.safeCancel
|
import com.mogo.eagle.core.utilcode.kotlin.safeCancel
|
||||||
import com.mogo.eagle.core.utilcode.util.Utils
|
import com.mogo.eagle.core.utilcode.util.Utils
|
||||||
|
import com.mogo.map.MogoLocationClient
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
import kotlinx.coroutines.android.asCoroutineDispatcher
|
import kotlinx.coroutines.android.asCoroutineDispatcher
|
||||||
import kotlinx.coroutines.channels.Channel
|
import kotlinx.coroutines.channels.Channel
|
||||||
@@ -580,7 +581,7 @@ object MoGoChatFacade: IMoGoChatFacade {
|
|||||||
}
|
}
|
||||||
//告之服务器给发送方下发接收通话消息
|
//告之服务器给发送方下发接收通话消息
|
||||||
try {
|
try {
|
||||||
val location = BridgeApi.locationClient()?.lastKnowLocation
|
val location = MogoLocationClient.getInstance(context())?.lastKnowLocation
|
||||||
val response = serverApi.requestConnectStatus(ConnectStatusParam(MoGoAiCloudClientConfig.getInstance().sn, sn, roomId, PUSH_MSG_AGREE_ENTER, CALL_TYPE_VOICE.type).also {
|
val response = serverApi.requestConnectStatus(ConnectStatusParam(MoGoAiCloudClientConfig.getInstance().sn, sn, roomId, PUSH_MSG_AGREE_ENTER, CALL_TYPE_VOICE.type).also {
|
||||||
it.nickName = mySelf.get().name
|
it.nickName = mySelf.get().name
|
||||||
it.headImgUrl = mySelf.get().icon
|
it.headImgUrl = mySelf.get().icon
|
||||||
@@ -811,7 +812,7 @@ object MoGoChatFacade: IMoGoChatFacade {
|
|||||||
}
|
}
|
||||||
val response = serverApi.inviteJoinVehicleTeam(CallRequestParam().also {
|
val response = serverApi.inviteJoinVehicleTeam(CallRequestParam().also {
|
||||||
val user = mySelf.get()
|
val user = mySelf.get()
|
||||||
val location = BridgeApi.locationClient()?.lastKnowLocation
|
val location = MogoLocationClient.getInstance(context())?.lastKnowLocation
|
||||||
it.snSender = mySn
|
it.snSender = mySn
|
||||||
it.snReceiver = sn
|
it.snReceiver = sn
|
||||||
it.nickName = user.name
|
it.nickName = user.name
|
||||||
@@ -957,7 +958,7 @@ object MoGoChatFacade: IMoGoChatFacade {
|
|||||||
}
|
}
|
||||||
//告之服务器给发送方下发接收通话消息
|
//告之服务器给发送方下发接收通话消息
|
||||||
try {
|
try {
|
||||||
val location = BridgeApi.locationClient()?.lastKnowLocation
|
val location = MogoLocationClient.getInstance(context())?.lastKnowLocation
|
||||||
val response = serverApi.requestConnectStatus(ConnectStatusParam(MoGoAiCloudClientConfig.getInstance().sn, sn, roomId, PUSH_MSG_AGREE_ENTER, CALL_TYPE_VEHICLE_TEAM.type).also {
|
val response = serverApi.requestConnectStatus(ConnectStatusParam(MoGoAiCloudClientConfig.getInstance().sn, sn, roomId, PUSH_MSG_AGREE_ENTER, CALL_TYPE_VEHICLE_TEAM.type).also {
|
||||||
it.nickName = mySelf.get().name
|
it.nickName = mySelf.get().name
|
||||||
it.headImgUrl = mySelf.get().icon
|
it.headImgUrl = mySelf.get().icon
|
||||||
|
|||||||
@@ -21,8 +21,6 @@ internal object BridgeApi {
|
|||||||
|
|
||||||
internal fun context(): Context = contextHolder?.get() ?: Utils.getApp()
|
internal fun context(): Context = contextHolder?.get() ?: Utils.getApp()
|
||||||
|
|
||||||
internal fun locationClient() = apis?.mapServiceApi?.getSingletonLocationClient(context())
|
|
||||||
|
|
||||||
internal fun intentManager() = apis?.intentManagerApi
|
internal fun intentManager() = apis?.intentManagerApi
|
||||||
|
|
||||||
internal fun statusManager() = apis?.statusManagerApi
|
internal fun statusManager() = apis?.statusManagerApi
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.google.gson.Gson
|
|||||||
import com.google.gson.JsonElement
|
import com.google.gson.JsonElement
|
||||||
import com.google.gson.JsonObject
|
import com.google.gson.JsonObject
|
||||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||||
|
import com.mogo.commons.AbsMogoApplication
|
||||||
import com.mogo.eagle.core.data.BaseResponse
|
import com.mogo.eagle.core.data.BaseResponse
|
||||||
import com.mogo.eagle.core.data.chat.UserInfo
|
import com.mogo.eagle.core.data.chat.UserInfo
|
||||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||||
@@ -15,6 +16,7 @@ import com.mogo.eagle.core.function.chat.facade.consts.ChatHttp
|
|||||||
import com.mogo.eagle.core.function.chat.facade.consts.ChatHttp.Companion.getConfig
|
import com.mogo.eagle.core.function.chat.facade.consts.ChatHttp.Companion.getConfig
|
||||||
import com.mogo.eagle.core.function.chat.facade.net.bean.*
|
import com.mogo.eagle.core.function.chat.facade.net.bean.*
|
||||||
import com.mogo.eagle.core.function.chat.facade.utils.log
|
import com.mogo.eagle.core.function.chat.facade.utils.log
|
||||||
|
import com.mogo.map.MogoLocationClient
|
||||||
import com.mogo.service.IMogoServiceApis
|
import com.mogo.service.IMogoServiceApis
|
||||||
import retrofit2.http.*
|
import retrofit2.http.*
|
||||||
import java.lang.IllegalStateException
|
import java.lang.IllegalStateException
|
||||||
@@ -72,7 +74,7 @@ internal class ChatServiceModel {
|
|||||||
suspend fun requestConnectStatus(params: ConnectStatusParam): BaseResponse<Any> {
|
suspend fun requestConnectStatus(params: ConnectStatusParam): BaseResponse<Any> {
|
||||||
val map = hashMapOf<String, String>()
|
val map = hashMapOf<String, String>()
|
||||||
val sn = MoGoAiCloudClientConfig.getInstance().sn
|
val sn = MoGoAiCloudClientConfig.getInstance().sn
|
||||||
val location = BridgeApi.locationClient()?.lastKnowLocation
|
val location = MogoLocationClient.getInstance(AbsMogoApplication.getApp())?.lastKnowLocation
|
||||||
if (location != null) {
|
if (location != null) {
|
||||||
params.lon = location.longitude
|
params.lon = location.longitude
|
||||||
params.lat = location.latitude
|
params.lat = location.latitude
|
||||||
@@ -103,7 +105,7 @@ internal class ChatServiceModel {
|
|||||||
|
|
||||||
suspend fun requestRoomInfo(param: CallRequestParam): BaseResponse<RoomInfo> {
|
suspend fun requestRoomInfo(param: CallRequestParam): BaseResponse<RoomInfo> {
|
||||||
val map = hashMapOf<String, String>()
|
val map = hashMapOf<String, String>()
|
||||||
val location = BridgeApi.locationClient()?.lastKnowLocation
|
val location = MogoLocationClient.getInstance(AbsMogoApplication.getApp())?.lastKnowLocation
|
||||||
if (location != null) {
|
if (location != null) {
|
||||||
param.lat = location.latitude
|
param.lat = location.latitude
|
||||||
param.lon = location.longitude
|
param.lon = location.longitude
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
|
|||||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||||
import com.mogo.eagle.core.function.call.map.CallerHDMapManager
|
import com.mogo.eagle.core.function.call.map.CallerHDMapManager
|
||||||
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager
|
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager
|
||||||
|
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||||
import com.mogo.eagle.core.function.call.map.CallerSmpManager
|
import com.mogo.eagle.core.function.call.map.CallerSmpManager
|
||||||
import com.mogo.eagle.core.function.call.obu.CallerOBUManager
|
import com.mogo.eagle.core.function.call.obu.CallerOBUManager
|
||||||
import com.mogo.eagle.core.function.call.obu.CallerObuListenerManager
|
import com.mogo.eagle.core.function.call.obu.CallerObuListenerManager
|
||||||
@@ -89,7 +90,7 @@ class DebugSettingView @JvmOverloads constructor(
|
|||||||
private var mRouteInfoSize = 0
|
private var mRouteInfoSize = 0
|
||||||
|
|
||||||
private val mapUiController by lazy {
|
private val mapUiController by lazy {
|
||||||
MogoApisHandler.getInstance().apis?.mapServiceApi?.mapUIController
|
CallerMapUIServiceManager.getMapUIController()
|
||||||
}
|
}
|
||||||
|
|
||||||
private var lastVisualAngleMode: VisualAngleMode? = null
|
private var lastVisualAngleMode: VisualAngleMode? = null
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import android.view.View
|
|||||||
import android.widget.FrameLayout
|
import android.widget.FrameLayout
|
||||||
import com.mogo.commons.AbsMogoApplication
|
import com.mogo.commons.AbsMogoApplication
|
||||||
import com.mogo.eagle.core.function.hmi.R
|
import com.mogo.eagle.core.function.hmi.R
|
||||||
|
import com.mogo.map.MogoMapUIController
|
||||||
|
import com.mogo.map.MogoMarkerManager
|
||||||
import com.mogo.map.uicontroller.VisualAngleMode
|
import com.mogo.map.uicontroller.VisualAngleMode
|
||||||
import com.mogo.module.common.MogoApisHandler
|
import com.mogo.module.common.MogoApisHandler
|
||||||
import com.mogo.module.common.constants.DataTypes
|
import com.mogo.module.common.constants.DataTypes
|
||||||
@@ -31,19 +33,16 @@ class PerspectiveSwitchView @JvmOverloads constructor(
|
|||||||
|
|
||||||
override fun onClick(v: View?) {
|
override fun onClick(v: View?) {
|
||||||
//切换地图的远近视图
|
//切换地图的远近视图
|
||||||
if (MogoApisHandler.getInstance().apis.mapServiceApi.mapUIController.currentMapVisualAngle.isLongSight) {
|
if (MogoMapUIController.getInstance().currentMapVisualAngle.isLongSight) {
|
||||||
MogoApisHandler.getInstance().apis.mapServiceApi.getMarkerManager(AbsMogoApplication.getApp())
|
MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
|
||||||
.visibleAllMarkers()
|
.visibleAllMarkers()
|
||||||
MogoApisHandler.getInstance().apis.mapServiceApi
|
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null)
|
||||||
.mapUIController.changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null)
|
|
||||||
textSwitch.setText(R.string.module_map_model_normal)
|
textSwitch.setText(R.string.module_map_model_normal)
|
||||||
} else if (MogoApisHandler.getInstance().apis.mapServiceApi.mapUIController.currentMapVisualAngle.isMediumSight) {
|
} else if (MogoMapUIController.getInstance().currentMapVisualAngle.isMediumSight) {
|
||||||
MogoApisHandler.getInstance().apis.mapServiceApi.getMarkerManager(AbsMogoApplication.getApp())
|
MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
|
||||||
.inVisibleWithoutMarkers(DataTypes.TYPE_MARKER_ADAS)
|
.inVisibleWithoutMarkers(DataTypes.TYPE_MARKER_ADAS)
|
||||||
MogoApisHandler.getInstance().apis.mapServiceApi
|
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null)
|
||||||
.mapUIController.changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null)
|
|
||||||
textSwitch.setText(R.string.module_map_model_faster)
|
textSwitch.setText(R.string.module_map_model_faster)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -11,6 +11,7 @@ import com.mogo.eagle.core.data.constants.MogoServicePaths
|
|||||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||||
import com.mogo.eagle.core.function.hmi.R
|
import com.mogo.eagle.core.function.hmi.R
|
||||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||||
|
import com.mogo.map.MogoMapUIController
|
||||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2
|
import com.mogo.map.navi.IMogoCarLocationChangedListener2
|
||||||
import com.mogo.service.IMogoServiceApis
|
import com.mogo.service.IMogoServiceApis
|
||||||
import java.util.*
|
import java.util.*
|
||||||
@@ -63,18 +64,13 @@ class SpeedPanelView @JvmOverloads constructor(
|
|||||||
private val timerTask = object : TimerTask() {
|
private val timerTask = object : TimerTask() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
if (mLatLng != null) {
|
if (mLatLng != null) {
|
||||||
if (mMogoServiceApis.mapServiceApi != null && mMogoServiceApis.mapServiceApi.mapUIController != null) {
|
mSpeedLimmit = MogoMapUIController.getInstance()
|
||||||
mSpeedLimmit = mMogoServiceApis.mapServiceApi.mapUIController.getSpeedLimmit(
|
.getSpeedLimmit(mLatLng!!.longitude, mLatLng!!.latitude, mLatLng!!.bearing)
|
||||||
mLatLng!!.longitude,
|
UiThreadHandler.post {
|
||||||
mLatLng!!.latitude,
|
val speed = (mLatLng!!.speed * 3.6f).toInt()
|
||||||
mLatLng!!.bearing
|
mSpeedChartView.setArcColor(Color.parseColor(if (speed > mSpeedLimmit) "#DB3137" else "#3E77F6"))
|
||||||
)
|
mSpeedChartView.setValues(speed)
|
||||||
UiThreadHandler.post {
|
setBackgroundResource(if (speed > mSpeedLimmit) R.drawable.yi_biao_pan_bg_speeding else R.drawable.yi_biao_pan_bg_nor)
|
||||||
val speed = (mLatLng!!.speed * 3.6f).toInt()
|
|
||||||
mSpeedChartView.setArcColor(Color.parseColor(if (speed > mSpeedLimmit) "#DB3137" else "#3E77F6"))
|
|
||||||
mSpeedChartView.setValues(speed)
|
|
||||||
setBackgroundResource(if (speed > mSpeedLimmit) R.drawable.yi_biao_pan_bg_speeding else R.drawable.yi_biao_pan_bg_nor)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ dependencies {
|
|||||||
api rootProject.ext.dependencies.mogoserviceapi
|
api rootProject.ext.dependencies.mogoserviceapi
|
||||||
api rootProject.ext.dependencies.moduleservice
|
api rootProject.ext.dependencies.moduleservice
|
||||||
api rootProject.ext.dependencies.mogoservice
|
api rootProject.ext.dependencies.mogoservice
|
||||||
api rootProject.ext.dependencies.mapcustom
|
api rootProject.ext.dependencies.mogomap
|
||||||
api rootProject.ext.dependencies.crashreportupgrade
|
api rootProject.ext.dependencies.crashreportupgrade
|
||||||
// api rootProject.ext.dependencies.crashreportbugly
|
// api rootProject.ext.dependencies.crashreportbugly
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ dependencies {
|
|||||||
api project(':services:mogo-service')
|
api project(':services:mogo-service')
|
||||||
|
|
||||||
api project(':modules:mogo-module-service')
|
api project(':modules:mogo-module-service')
|
||||||
api project(':libraries:map-custom')
|
api project(':libraries:mogo-map')
|
||||||
api project(':test:crashreport-upgrade')
|
api project(':test:crashreport-upgrade')
|
||||||
// api project(':test:crashreport-bugly')
|
// api project(':test:crashreport-bugly')
|
||||||
api project(':test:crashreport-apmbyte')
|
api project(':test:crashreport-apmbyte')
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import com.mogo.commons.mvp.MvpFragment;
|
|||||||
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths;
|
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths;
|
||||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||||
|
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
|
||||||
import com.mogo.eagle.core.function.main.cards.MogoModulesManager;
|
import com.mogo.eagle.core.function.main.cards.MogoModulesManager;
|
||||||
import com.mogo.eagle.core.function.main.service.MogoMainService;
|
import com.mogo.eagle.core.function.main.service.MogoMainService;
|
||||||
import com.mogo.eagle.core.function.main.utils.DisplayEffectsHelper;
|
import com.mogo.eagle.core.function.main.utils.DisplayEffectsHelper;
|
||||||
@@ -34,9 +35,11 @@ import com.mogo.eagle.core.utilcode.mogo.permissions.PermissionsDialogUtils;
|
|||||||
import com.mogo.eagle.core.utilcode.mogo.toast.ResourcesHelper;
|
import com.mogo.eagle.core.utilcode.mogo.toast.ResourcesHelper;
|
||||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||||
import com.mogo.eagle.core.utilcode.util.ProcessUtils;
|
import com.mogo.eagle.core.utilcode.util.ProcessUtils;
|
||||||
|
import com.mogo.map.listener.IMogoHosListenerRegister;
|
||||||
import com.mogo.map.listener.MogoMapListenerHandler;
|
import com.mogo.map.listener.MogoMapListenerHandler;
|
||||||
import com.mogo.map.location.IMogoLocationListener;
|
import com.mogo.map.location.IMogoLocationListener;
|
||||||
import com.mogo.map.uicontroller.EnumMapUI;
|
import com.mogo.map.uicontroller.EnumMapUI;
|
||||||
|
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||||
import com.mogo.module.common.MogoApisHandler;
|
import com.mogo.module.common.MogoApisHandler;
|
||||||
import com.mogo.service.IMogoServiceApis;
|
import com.mogo.service.IMogoServiceApis;
|
||||||
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
|
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
|
||||||
@@ -104,14 +107,14 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
|||||||
// if (CallChatApi.getInstance().getApiProvider() != null) {
|
// if (CallChatApi.getInstance().getApiProvider() != null) {
|
||||||
// CallChatApi.getInstance().getApiProvider().initVehicleTeamContainer("init", R.id.module_main_id_message_history_fragment_container, this);
|
// CallChatApi.getInstance().getApiProvider().initVehicleTeamContainer("init", R.id.module_main_id_message_history_fragment_container, this);
|
||||||
// }
|
// }
|
||||||
//申请悬浮窗权限
|
// //申请悬浮窗权限
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
// 检查是否有悬浮窗权限
|
// // 检查是否有悬浮窗权限
|
||||||
if (Settings.canDrawOverlays(this)) {
|
// if (Settings.canDrawOverlays(this)) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
PermissionsDialogUtils.openAppDetails(this, "显示悬浮窗", REQUEST_CODE_DIALOG);
|
// PermissionsDialogUtils.openAppDetails(this, "显示悬浮窗", REQUEST_CODE_DIALOG);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
// 隐藏布局
|
// 隐藏布局
|
||||||
@@ -189,9 +192,10 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
|||||||
|
|
||||||
MogoModulesManager.getInstance().init(this);
|
MogoModulesManager.getInstance().init(this);
|
||||||
|
|
||||||
if (mServiceApis.getMapServiceApi() != null) {
|
IMogoHosListenerRegister listenerRegister = CallerMapUIServiceManager.INSTANCE.getHostListenerRegister();
|
||||||
mServiceApis.getMapServiceApi().getHostListenerRegister().registerHostMapListener(EventDispatchCenter.getInstance());
|
if (listenerRegister != null) {
|
||||||
mServiceApis.getMapServiceApi().getHostListenerRegister().registerMarkerClickListener(EventDispatchCenter.getInstance());
|
listenerRegister.registerHostMapListener(EventDispatchCenter.getInstance());
|
||||||
|
listenerRegister.registerMarkerClickListener(EventDispatchCenter.getInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
initAdasControlStatusListener();
|
initAdasControlStatusListener();
|
||||||
@@ -376,8 +380,11 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
|||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
mServiceApis.getMapServiceApi().getHostListenerRegister().unregisterMarkerClickListener();
|
IMogoHosListenerRegister listenerRegister = CallerMapUIServiceManager.INSTANCE.getHostListenerRegister();
|
||||||
mServiceApis.getMapServiceApi().getHostListenerRegister().unregisterHostMapListener();
|
if (listenerRegister != null) {
|
||||||
|
listenerRegister.unregisterMarkerClickListener();
|
||||||
|
listenerRegister.unregisterHostMapListener();
|
||||||
|
}
|
||||||
mServiceApis.getRegisterCenterApi().unregisterADASControlStatusChangedListener(TAG);
|
mServiceApis.getRegisterCenterApi().unregisterADASControlStatusChangedListener(TAG);
|
||||||
mMogoStatusManager.setMainPageLaunchedStatus(TAG, false);
|
mMogoStatusManager.setMainPageLaunchedStatus(TAG, false);
|
||||||
mMogoStatusManager.setMainPageIsBackgroundStatus(TAG, false);
|
mMogoStatusManager.setMainPageIsBackgroundStatus(TAG, false);
|
||||||
@@ -386,7 +393,8 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
|||||||
mMogoFragmentManager.destroy();
|
mMogoFragmentManager.destroy();
|
||||||
mMogoFragmentManager = null;
|
mMogoFragmentManager = null;
|
||||||
}
|
}
|
||||||
mServiceApis.getMapServiceApi().getMapUIController().destroy();
|
IMogoMapUIController mapUIController = CallerMapUIServiceManager.INSTANCE.getMapUIController();
|
||||||
|
if (mapUIController != null) mapUIController.destroy();
|
||||||
AdasConfigApiController.getInstance().release();
|
AdasConfigApiController.getInstance().release();
|
||||||
mServiceApis.getAdasControllerApi().release();
|
mServiceApis.getAdasControllerApi().release();
|
||||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "destroy.");
|
CallerLogger.INSTANCE.d(M_MAIN + TAG, "destroy.");
|
||||||
|
|||||||
@@ -21,13 +21,15 @@ import com.mogo.eagle.core.data.constants.MoGoConfig;
|
|||||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||||
import com.mogo.eagle.core.function.api.chat.biz.ChatConsts;
|
import com.mogo.eagle.core.function.api.chat.biz.ChatConsts;
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||||
|
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
|
||||||
import com.mogo.eagle.core.function.notice.PushUIConstants;
|
import com.mogo.eagle.core.function.notice.PushUIConstants;
|
||||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
|
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
|
||||||
import com.mogo.eagle.core.utilcode.mogo.AppLaunchTimeUtils;
|
import com.mogo.eagle.core.utilcode.mogo.AppLaunchTimeUtils;
|
||||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
|
||||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||||
import com.mogo.eagle.core.utilcode.util.ProcessUtils;
|
import com.mogo.eagle.core.utilcode.util.ProcessUtils;
|
||||||
import com.mogo.map.MapApiPath;
|
import com.mogo.map.MapApiPath;
|
||||||
|
import com.mogo.map.location.IMogoLocationClient;
|
||||||
import com.mogo.module.common.MogoApisHandler;
|
import com.mogo.module.common.MogoApisHandler;
|
||||||
import com.mogo.module.common.MogoModule;
|
import com.mogo.module.common.MogoModule;
|
||||||
import com.mogo.module.common.MogoModulePaths;
|
import com.mogo.module.common.MogoModulePaths;
|
||||||
@@ -186,11 +188,11 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
|||||||
// clientConfig.setUseOriginSocket(true);
|
// clientConfig.setUseOriginSocket(true);
|
||||||
|
|
||||||
clientConfig.setIHttpDnsCurrentLocation(() -> {
|
clientConfig.setIHttpDnsCurrentLocation(() -> {
|
||||||
MogoLocation mogoLocation =
|
MogoLocation mogoLocation = null;
|
||||||
MogoApisHandler.getInstance()
|
IMogoLocationClient locationClient = CallerMapUIServiceManager.INSTANCE.getSingletonLocationClient(getApp());
|
||||||
.getApis().getMapServiceApi()
|
if (locationClient != null) {
|
||||||
.getSingletonLocationClient(getApp())
|
mogoLocation = locationClient.getLastKnowLocation();
|
||||||
.getLastKnowLocation();
|
}
|
||||||
HttpDnsSimpleLocation httpDnsSimpleLocation;
|
HttpDnsSimpleLocation httpDnsSimpleLocation;
|
||||||
if (mogoLocation != null
|
if (mogoLocation != null
|
||||||
&& mogoLocation.getLatitude() != 0
|
&& mogoLocation.getLatitude() != 0
|
||||||
@@ -257,9 +259,12 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
|||||||
if (DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE) {
|
if (DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE) {
|
||||||
IMogoServiceApis apis = MogoApisHandler.getInstance().getApis();
|
IMogoServiceApis apis = MogoApisHandler.getInstance().getApis();
|
||||||
apis.getLocationInfoApi().start();
|
apis.getLocationInfoApi().start();
|
||||||
apis.getMapServiceApi().getSingletonLocationClient(getApplicationContext()).addLocationListener(location -> {
|
IMogoLocationClient locationClient = CallerMapUIServiceManager.INSTANCE.getSingletonLocationClient(getApplicationContext());
|
||||||
apis.getLocationInfoApi().provideLocation(location);
|
if (locationClient != null) {
|
||||||
});
|
locationClient.addLocationListener(location -> {
|
||||||
|
apis.getLocationInfoApi().provideLocation(location);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,12 +6,15 @@ import android.os.Message;
|
|||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
|
|
||||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||||
|
import com.mogo.commons.AbsMogoApplication;
|
||||||
import com.mogo.eagle.core.data.BaseData;
|
import com.mogo.eagle.core.data.BaseData;
|
||||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||||
|
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
|
||||||
import com.mogo.eagle.core.network.RequestOptions;
|
import com.mogo.eagle.core.network.RequestOptions;
|
||||||
import com.mogo.eagle.core.network.SubscribeImpl;
|
import com.mogo.eagle.core.network.SubscribeImpl;
|
||||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||||
|
import com.mogo.map.location.IMogoLocationClient;
|
||||||
import com.mogo.module.common.MogoApisHandler;
|
import com.mogo.module.common.MogoApisHandler;
|
||||||
|
|
||||||
import io.reactivex.schedulers.Schedulers;
|
import io.reactivex.schedulers.Schedulers;
|
||||||
@@ -103,7 +106,11 @@ public class DelayCheckUtil implements Handler.Callback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void startUpload() {
|
private void startUpload() {
|
||||||
MogoLocation lastLocation = MogoApisHandler.getInstance().getApis().getMapServiceApi().getSingletonLocationClient(context).getLastKnowLocation();
|
IMogoLocationClient locationClient = CallerMapUIServiceManager.INSTANCE.getSingletonLocationClient(AbsMogoApplication.getApp());
|
||||||
|
MogoLocation lastLocation = null;
|
||||||
|
if (locationClient != null) {
|
||||||
|
lastLocation = locationClient.getLastKnowLocation();
|
||||||
|
}
|
||||||
if (lastLocation == null) {
|
if (lastLocation == null) {
|
||||||
handler.sendEmptyMessageDelayed(MSG_START_DELAY_CHECK, DELAY_CHECK_DELAY);
|
handler.sendEmptyMessageDelayed(MSG_START_DELAY_CHECK, DELAY_CHECK_DELAY);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import com.mogo.eagle.core.function.main.EventDispatchCenter;
|
|||||||
import com.mogo.eagle.core.function.main.cards.MogoModulesManager;
|
import com.mogo.eagle.core.function.main.cards.MogoModulesManager;
|
||||||
import com.mogo.eagle.core.function.main.delaycheck.DelayCheckUtil;
|
import com.mogo.eagle.core.function.main.delaycheck.DelayCheckUtil;
|
||||||
import com.mogo.eagle.core.function.main.monitoring.VehicleMonitoring;
|
import com.mogo.eagle.core.function.main.monitoring.VehicleMonitoring;
|
||||||
|
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
|
||||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||||
import com.mogo.map.location.IMogoLocationClient;
|
import com.mogo.map.location.IMogoLocationClient;
|
||||||
import com.mogo.map.location.IMogoLocationListener;
|
import com.mogo.map.location.IMogoLocationListener;
|
||||||
@@ -76,8 +77,8 @@ class MogoMainService extends Service implements IMogoLocationListener {
|
|||||||
|
|
||||||
private void initAndStartLocation() {
|
private void initAndStartLocation() {
|
||||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "开始定位");
|
CallerLogger.INSTANCE.d(M_MAIN + TAG, "开始定位");
|
||||||
if (mServiceApis != null) {
|
mLocationClient = CallerMapUIServiceManager.INSTANCE.getSingletonLocationClient(AbsMogoApplication.getApp());
|
||||||
mLocationClient = mServiceApis.getMapServiceApi().getSingletonLocationClient(AbsMogoApplication.getApp());
|
if (mLocationClient != null) {
|
||||||
mLocationClient.addLocationListener(this);
|
mLocationClient.addLocationListener(this);
|
||||||
mLocationClient.start(2_000L);
|
mLocationClient.start(2_000L);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ dependencies {
|
|||||||
|
|
||||||
implementation rootProject.ext.dependencies.mogomap
|
implementation rootProject.ext.dependencies.mogomap
|
||||||
implementation rootProject.ext.dependencies.mogomapapi
|
implementation rootProject.ext.dependencies.mogomapapi
|
||||||
|
implementation rootProject.ext.dependencies.moduleservice
|
||||||
} else {
|
} else {
|
||||||
implementation project(':modules:mogo-module-common')
|
implementation project(':modules:mogo-module-common')
|
||||||
implementation project(':services:mogo-service-api')
|
implementation project(':services:mogo-service-api')
|
||||||
@@ -81,6 +82,7 @@ dependencies {
|
|||||||
implementation project(":libraries:mogo-map")
|
implementation project(":libraries:mogo-map")
|
||||||
implementation project(":libraries:mogo-map-api")
|
implementation project(":libraries:mogo-map-api")
|
||||||
implementation project(':libraries:mogo-adas')
|
implementation project(':libraries:mogo-adas')
|
||||||
|
implementation project(':modules:mogo-module-service')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
package com.mogo.service.impl.map;
|
package com.mogo.eagle.core.function.impl;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||||
|
import com.mogo.eagle.core.function.api.map.IMogoMapService;
|
||||||
import com.mogo.map.MogoGeoSearch;
|
import com.mogo.map.MogoGeoSearch;
|
||||||
import com.mogo.map.MogoLocationClient;
|
import com.mogo.map.MogoLocationClient;
|
||||||
import com.mogo.map.MogoMap;
|
import com.mogo.map.MogoMap;
|
||||||
@@ -22,7 +23,6 @@ import com.mogo.map.search.poisearch.IMogoPoiSearch;
|
|||||||
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
|
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
|
||||||
import com.mogo.map.search.traffic.IMogoTrafficSearch;
|
import com.mogo.map.search.traffic.IMogoTrafficSearch;
|
||||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||||
import com.mogo.service.map.IMogoMapService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author congtaowang
|
* @author congtaowang
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
package com.mogo.eagle.core.function.impl.map
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import com.alibaba.android.arouter.facade.annotation.Route
|
|
||||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
|
||||||
import com.mogo.eagle.core.function.api.map.location.IMoGoLocationUpdater4AutoPilot
|
|
||||||
import com.mogo.eagle.core.utilcode.util.Utils
|
|
||||||
import com.mogo.module.common.MogoApisHandler
|
|
||||||
import com.mogo.service.IMogoServiceApis
|
|
||||||
|
|
||||||
|
|
||||||
@Route(path = MogoServicePaths.PATH_MAP_LOCATION_UPDATE_4_AUTO_PILOT)
|
|
||||||
class MoGoLocationUpdater4AutoPilot: IMoGoLocationUpdater4AutoPilot {
|
|
||||||
|
|
||||||
private val TAG = "MoGoLocationUpdater4AutoPilot"
|
|
||||||
|
|
||||||
override val functionName = TAG;
|
|
||||||
|
|
||||||
private val api: IMogoServiceApis? by lazy {
|
|
||||||
MogoApisHandler.getInstance().apis
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun updateLocation(location: Any?) {
|
|
||||||
api?.mapServiceApi?.getSingletonLocationClient(Utils.getApp())?.updateLocation(location);
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun init(context: Context?) {
|
|
||||||
//DO NOTING
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDestroy() {
|
|
||||||
//DO NOTHING
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,16 +1,18 @@
|
|||||||
package com.mogo.module.service.marker;
|
package com.mogo.eagle.core.function.impl.marker;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||||
|
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||||
|
import com.mogo.eagle.core.function.api.map.marker.IMogoMarkerService;
|
||||||
|
import com.mogo.map.MogoMapUIController;
|
||||||
import com.mogo.map.marker.IMogoMarker;
|
import com.mogo.map.marker.IMogoMarker;
|
||||||
|
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||||
import com.mogo.module.common.drawer.MarkerDrawer;
|
import com.mogo.module.common.drawer.MarkerDrawer;
|
||||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||||
import com.mogo.module.service.MarkerServiceHandler;
|
import com.mogo.module.service.marker.MapMarkerManager;
|
||||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
|
||||||
import com.mogo.service.module.IMogoMarkerService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author congtaowang
|
* @author congtaowang
|
||||||
@@ -27,7 +29,7 @@ public class MogoMarkerServiceImpl implements IMogoMarkerService {
|
|||||||
@Override
|
@Override
|
||||||
public IMogoMarker drawMarker( Object object ) {
|
public IMogoMarker drawMarker( Object object ) {
|
||||||
if ( object instanceof MarkerShowEntity ) {
|
if ( object instanceof MarkerShowEntity ) {
|
||||||
return MarkerServiceHandler.getMapMarkerManager().drawMapMarker( ( ( MarkerShowEntity ) object ), MarkerDrawer.MARKER_Z_INDEX_HIGH );
|
return MapMarkerManager.getInstance().drawMapMarker( ( ( MarkerShowEntity ) object ), MarkerDrawer.MARKER_Z_INDEX_HIGH );
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -36,4 +38,9 @@ public class MogoMarkerServiceImpl implements IMogoMarkerService {
|
|||||||
public void init( Context context ) {
|
public void init( Context context ) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IMogoMapUIController getMapUIController() {
|
||||||
|
return MogoMapUIController.getInstance();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -9,14 +9,17 @@ import androidx.annotation.Nullable;
|
|||||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||||
import com.mogo.commons.mvp.MvpFragment;
|
import com.mogo.commons.mvp.MvpFragment;
|
||||||
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths;
|
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths;
|
||||||
|
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||||
|
import com.mogo.eagle.core.function.api.map.IMogoMapFrameController;
|
||||||
import com.mogo.eagle.core.function.api.map.hd.IMoGoMapFragmentProvider;
|
import com.mogo.eagle.core.function.api.map.hd.IMoGoMapFragmentProvider;
|
||||||
|
import com.mogo.eagle.core.function.call.base.CallerBase;
|
||||||
import com.mogo.map.IMogoMap;
|
import com.mogo.map.IMogoMap;
|
||||||
import com.mogo.map.IMogoUiSettings;
|
import com.mogo.map.IMogoUiSettings;
|
||||||
import com.mogo.map.MogoMapView;
|
import com.mogo.map.MogoMapView;
|
||||||
import com.mogo.map.uicontroller.EnumMapUI;
|
import com.mogo.map.uicontroller.EnumMapUI;
|
||||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||||
import com.mogo.module.common.MogoApisHandler;
|
import com.mogo.module.common.MogoApisHandler;
|
||||||
import com.mogo.service.map.IMogoMapFrameController;
|
import com.mogo.service.IMogoServiceApis;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author donghongyu
|
* @author donghongyu
|
||||||
@@ -48,7 +51,7 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter >
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initViews() {
|
protected void initViews() {
|
||||||
MogoApisHandler.getInstance().getApis().getMapFrameControllerApi().initDelegate( this );
|
CallerBase.getApiInstance(IMogoMapFrameController.class, MogoServicePaths.PATH_MAP_FRAME_CONTROLLER).initDelegate(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -173,7 +176,7 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter >
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
MogoApisHandler.getInstance().getApis().getMapFrameControllerApi().destroy();
|
CallerBase.getApiInstance(IMogoMapFrameController.class, MogoServicePaths.PATH_MAP_FRAME_CONTROLLER).destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import android.content.Context;
|
|||||||
|
|
||||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||||
import com.mogo.service.map.IMogoMapFrameController;
|
import com.mogo.eagle.core.function.api.map.IMogoMapFrameController;
|
||||||
|
|
||||||
public
|
public
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import android.text.TextUtils;
|
|||||||
|
|
||||||
import com.mogo.cloud.socket.entity.SocketDownData;
|
import com.mogo.cloud.socket.entity.SocketDownData;
|
||||||
import com.mogo.commons.AbsMogoApplication;
|
import com.mogo.commons.AbsMogoApplication;
|
||||||
|
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
|
||||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||||
import com.mogo.eagle.core.function.monitoring.R;
|
import com.mogo.eagle.core.function.monitoring.R;
|
||||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
|
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
|
||||||
@@ -77,7 +78,7 @@ public class CameraLiveNoticeHelper implements IMogoCloudOnMsgListener {
|
|||||||
|
|
||||||
Bitmap bitmap = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.icon_space, null);
|
Bitmap bitmap = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.icon_space, null);
|
||||||
options.icon(bitmap);
|
options.icon(bitmap);
|
||||||
mMogoMarker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext)
|
mMogoMarker = CallerMapUIServiceManager.INSTANCE.getMarkerManager(mContext)
|
||||||
.addMarker(PushDataType.TYPE_PUSH_CAMERA_DATA, options);
|
.addMarker(PushDataType.TYPE_PUSH_CAMERA_DATA, options);
|
||||||
if (mMogoMarker != null) {
|
if (mMogoMarker != null) {
|
||||||
mMogoMarker.setInfoWindowAdapter(new CameraWindow3DAdapter(AbsMogoApplication.getApp(), options));
|
mMogoMarker.setInfoWindowAdapter(new CameraWindow3DAdapter(AbsMogoApplication.getApp(), options));
|
||||||
@@ -107,7 +108,7 @@ public class CameraLiveNoticeHelper implements IMogoCloudOnMsgListener {
|
|||||||
|
|
||||||
Bitmap bitmap = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.module_camera_normal_traffic, null);
|
Bitmap bitmap = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.module_camera_normal_traffic, null);
|
||||||
options.icon(bitmap);
|
options.icon(bitmap);
|
||||||
mMogoMarker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext)
|
mMogoMarker = CallerMapUIServiceManager.INSTANCE.getMarkerManager(mContext)
|
||||||
.addMarker(PushDataType.TYPE_PUSH_CAMERA_DATA, options);
|
.addMarker(PushDataType.TYPE_PUSH_CAMERA_DATA, options);
|
||||||
if (mMogoMarker != null) {
|
if (mMogoMarker != null) {
|
||||||
mMogoMarker.setOwner(PushDataType.TYPE_PUSH_CAMERA_DATA);
|
mMogoMarker.setOwner(PushDataType.TYPE_PUSH_CAMERA_DATA);
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_
|
|||||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||||
import com.mogo.eagle.core.function.monitoring.net.CameraListServices
|
import com.mogo.eagle.core.function.monitoring.net.CameraListServices
|
||||||
|
import com.mogo.map.MogoLocationClient
|
||||||
import com.mogo.module.common.MogoApisHandler
|
import com.mogo.module.common.MogoApisHandler
|
||||||
import com.mogo.module.common.constants.HostConst
|
import com.mogo.module.common.constants.HostConst
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
@@ -86,7 +87,7 @@ class CronTaskManager(private var context: Context?) {
|
|||||||
* 请求路口一定范围内的设备信息(包含:摄像头、灯)
|
* 请求路口一定范围内的设备信息(包含:摄像头、灯)
|
||||||
*/
|
*/
|
||||||
private fun requestDeviceList() {
|
private fun requestDeviceList() {
|
||||||
MogoApisHandler.getInstance().apis.mapServiceApi.getSingletonLocationClient(context).lastKnowLocation?.let { location ->
|
MogoLocationClient.getInstance(context).lastKnowLocation?.let { location ->
|
||||||
disposable = netWork.create(CameraListServices::class.java, HostConst.CITY_HOST)
|
disposable = netWork.create(CameraListServices::class.java, HostConst.CITY_HOST)
|
||||||
.getDeviceList(location.longitude, location.latitude, 500)
|
.getDeviceList(location.longitude, location.latitude, 500)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
@@ -119,7 +120,7 @@ class CronTaskManager(private var context: Context?) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun requestCarCameraList() {
|
private fun requestCarCameraList() {
|
||||||
MogoApisHandler.getInstance().apis.mapServiceApi.getSingletonLocationClient(context).lastKnowLocation?.let { location ->
|
MogoLocationClient.getInstance(context).lastKnowLocation?.let { location ->
|
||||||
carDisposable =
|
carDisposable =
|
||||||
netWork.create(CameraListServices::class.java, HostConst.CITY_HOST)
|
netWork.create(CameraListServices::class.java, HostConst.CITY_HOST)
|
||||||
.getCarCameraList(ReqLiveCarBean(location.longitude, location.latitude))
|
.getCarCameraList(ReqLiveCarBean(location.longitude, location.latitude))
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import com.mogo.eagle.core.function.notice.model.PushBean
|
|||||||
import com.mogo.eagle.core.function.notice.utils.HandlerUtils
|
import com.mogo.eagle.core.function.notice.utils.HandlerUtils
|
||||||
import com.mogo.eagle.core.function.notice.view.getApis
|
import com.mogo.eagle.core.function.notice.view.getApis
|
||||||
import com.mogo.eagle.core.function.notice.viewmodel.PushViewModel
|
import com.mogo.eagle.core.function.notice.viewmodel.PushViewModel
|
||||||
|
import com.mogo.map.MogoLocationClient
|
||||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener
|
import com.mogo.service.statusmanager.IMogoStatusChangedListener
|
||||||
import com.mogo.service.statusmanager.StatusDescriptor
|
import com.mogo.service.statusmanager.StatusDescriptor
|
||||||
import java.util.*
|
import java.util.*
|
||||||
@@ -48,7 +49,7 @@ class PushRepository(mContext: Context) {
|
|||||||
.pushBeanDao()
|
.pushBeanDao()
|
||||||
}
|
}
|
||||||
private val locationClient =
|
private val locationClient =
|
||||||
getApis(mContext).mapServiceApi.getSingletonLocationClient(appContext)
|
MogoLocationClient.getInstance(appContext)
|
||||||
|
|
||||||
private val mHandler = Handler(Looper.getMainLooper())
|
private val mHandler = Handler(Looper.getMainLooper())
|
||||||
|
|
||||||
|
|||||||
@@ -12,11 +12,11 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
|||||||
import com.mogo.eagle.core.function.call.obu.CallerObuListenerManager
|
import com.mogo.eagle.core.function.call.obu.CallerObuListenerManager
|
||||||
import com.mogo.eagle.core.function.obu.mogo.utils.TrafficDataConvertUtils
|
import com.mogo.eagle.core.function.obu.mogo.utils.TrafficDataConvertUtils
|
||||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||||
|
import com.mogo.map.MogoMapUIController
|
||||||
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter
|
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter
|
||||||
import com.mogo.module.common.drawer.TrafficMarkerDrawer
|
import com.mogo.module.common.drawer.TrafficMarkerDrawer
|
||||||
import com.mogo.module.common.enums.EventTypeEnum
|
import com.mogo.module.common.enums.EventTypeEnum
|
||||||
import com.mogo.service.IMogoServiceApis
|
import com.mogo.service.IMogoServiceApis
|
||||||
import com.mogo.service.map.IMogoMapService
|
|
||||||
import com.zhidao.support.obu.MogoObuManager
|
import com.zhidao.support.obu.MogoObuManager
|
||||||
import com.zhidao.support.obu.OnMogoObuListener
|
import com.zhidao.support.obu.OnMogoObuListener
|
||||||
import com.zhidao.support.obu.constants.ObuConstants
|
import com.zhidao.support.obu.constants.ObuConstants
|
||||||
@@ -38,7 +38,6 @@ class MogoPrivateObuManager private constructor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private var mMogoServiceApis: IMogoServiceApis? = null
|
private var mMogoServiceApis: IMogoServiceApis? = null
|
||||||
private var mIMogoMapService: IMogoMapService? = null
|
|
||||||
private var mContext: Context? = null
|
private var mContext: Context? = null
|
||||||
private var mObuStatusInfo = CallerObuListenerManager.getObuStatusInfo()
|
private var mObuStatusInfo = CallerObuListenerManager.getObuStatusInfo()
|
||||||
|
|
||||||
@@ -47,8 +46,6 @@ class MogoPrivateObuManager private constructor() {
|
|||||||
mMogoServiceApis = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS)
|
mMogoServiceApis = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS)
|
||||||
.navigation(context) as IMogoServiceApis
|
.navigation(context) as IMogoServiceApis
|
||||||
mContext = context
|
mContext = context
|
||||||
mIMogoMapService = mMogoServiceApis!!.mapServiceApi
|
|
||||||
|
|
||||||
connectObu(context, ipAddress)
|
connectObu(context, ipAddress)
|
||||||
MogoObuManager.getInstance().registerListener(mogoObuListener)
|
MogoObuManager.getInstance().registerListener(mogoObuListener)
|
||||||
}
|
}
|
||||||
@@ -179,7 +176,7 @@ class MogoPrivateObuManager private constructor() {
|
|||||||
|
|
||||||
// 使用与渠道配置一样的gps提供者提供的数据,app/productFlavors/fPadLenovo.gradle GPS_PROVIDER 0-Android系统,1-工控机,2-OBU
|
// 使用与渠道配置一样的gps提供者提供的数据,app/productFlavors/fPadLenovo.gradle GPS_PROVIDER 0-Android系统,1-工控机,2-OBU
|
||||||
if (2 == FunctionBuildConfig.gpsProvider) {
|
if (2 == FunctionBuildConfig.gpsProvider) {
|
||||||
mIMogoMapService?.mapUIController?.syncLocation2Map(data)
|
MogoMapUIController.getInstance().syncLocation2Map(data)
|
||||||
SnapshotLocationDataCenter.getInstance().syncAdasLocationInfo(data)
|
SnapshotLocationDataCenter.getInstance().syncAdasLocationInfo(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener
|
|||||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||||
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager
|
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager
|
||||||
|
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||||
import com.mogo.eagle.core.function.v2x.events.alarm.V2XAlarmServer
|
import com.mogo.eagle.core.function.v2x.events.alarm.V2XAlarmServer
|
||||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi
|
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi
|
||||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi.context
|
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi.context
|
||||||
@@ -341,7 +342,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
|
|||||||
v2xPolyline.points = pointsOdl
|
v2xPolyline.points = pointsOdl
|
||||||
|
|
||||||
//CallerLogger.d("$M_V2X$TAG", "当前地图的缩放比例为:" + zoomLevel);
|
//CallerLogger.d("$M_V2X$TAG", "当前地图的缩放比例为:" + zoomLevel);
|
||||||
val zoomLevel: Float = BridgeApi.mapUiController()?.zoomLevel ?: 0.0f
|
val zoomLevel: Float = CallerMapUIServiceManager.getMapUIController()?.zoomLevel ?: 0.0f
|
||||||
//CallerLogger.d("$M_V2X$TAG", "当前地图的缩放比例为:" + zoomLevel);
|
//CallerLogger.d("$M_V2X$TAG", "当前地图的缩放比例为:" + zoomLevel);
|
||||||
if (zoomLevel > 0 && zoomLevel <= 17 && BridgeApi.v2xStatus()?.isRoadEventWindowShow == false) { // 缩放地图
|
if (zoomLevel > 0 && zoomLevel <= 17 && BridgeApi.v2xStatus()?.isRoadEventWindowShow == false) { // 缩放地图
|
||||||
val context: Context = context()
|
val context: Context = context()
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import com.mogo.eagle.core.function.v2x.events.consts.MoGoV2XServicePaths
|
|||||||
import com.mogo.eagle.core.function.v2x.events.manager.*
|
import com.mogo.eagle.core.function.v2x.events.manager.*
|
||||||
import com.mogo.eagle.core.function.v2x.events.network.V2XRefreshModel
|
import com.mogo.eagle.core.function.v2x.events.network.V2XRefreshModel
|
||||||
import com.mogo.eagle.core.utilcode.util.Utils
|
import com.mogo.eagle.core.utilcode.util.Utils
|
||||||
import com.mogo.map.uicontroller.IMogoMapUIController
|
|
||||||
import com.mogo.module.common.MogoApisHandler
|
import com.mogo.module.common.MogoApisHandler
|
||||||
import com.mogo.service.statusmanager.IMogoStatusManager
|
import com.mogo.service.statusmanager.IMogoStatusManager
|
||||||
import java.lang.ref.WeakReference
|
import java.lang.ref.WeakReference
|
||||||
@@ -61,18 +60,10 @@ internal object BridgeApi {
|
|||||||
|
|
||||||
fun context(): Context = this.context.get()?.get() ?: Utils.getApp()
|
fun context(): Context = this.context.get()?.get() ?: Utils.getApp()
|
||||||
|
|
||||||
fun mapUiController(): IMogoMapUIController? = apis?.mapServiceApi?.mapUIController
|
|
||||||
|
|
||||||
fun map() = apis?.mapServiceApi
|
|
||||||
|
|
||||||
fun statusManager(): IMogoStatusManager? = apis?.statusManagerApi
|
fun statusManager(): IMogoStatusManager? = apis?.statusManagerApi
|
||||||
|
|
||||||
fun analytics() = apis?.analyticsApi
|
fun analytics() = apis?.analyticsApi
|
||||||
|
|
||||||
fun overlay() = apis?.mapServiceApi?.getOverlayManager(context())
|
|
||||||
|
|
||||||
fun marker() = apis?.mapServiceApi?.getMarkerManager(context())
|
|
||||||
|
|
||||||
fun v2xMarker() = v2xMarker
|
fun v2xMarker() = v2xMarker
|
||||||
|
|
||||||
fun v2xPolyline() = v2xPolyline
|
fun v2xPolyline() = v2xPolyline
|
||||||
@@ -98,8 +89,4 @@ internal object BridgeApi {
|
|||||||
fun intentManager() = apis?.intentManagerApi
|
fun intentManager() = apis?.intentManagerApi
|
||||||
|
|
||||||
fun actionManager() = apis?.actionManagerApi
|
fun actionManager() = apis?.actionManagerApi
|
||||||
|
|
||||||
fun locationClient() = apis?.mapServiceApi?.getSingletonLocationClient(context())
|
|
||||||
|
|
||||||
fun markerService() = apis?.markerService
|
|
||||||
}
|
}
|
||||||
@@ -12,6 +12,7 @@ import com.mogo.eagle.core.function.v2x.events.consts.MoGoV2XServicePaths;
|
|||||||
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
|
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
|
||||||
import com.mogo.eagle.core.function.v2x.events.entity.model.DrawLineInfo;
|
import com.mogo.eagle.core.function.v2x.events.entity.model.DrawLineInfo;
|
||||||
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoPersonWarnPolylineManager;
|
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoPersonWarnPolylineManager;
|
||||||
|
import com.mogo.map.MogoOverlayManager;
|
||||||
import com.mogo.map.overlay.IMogoOverlayManager;
|
import com.mogo.map.overlay.IMogoOverlayManager;
|
||||||
import com.mogo.map.overlay.IMogoPolyline;
|
import com.mogo.map.overlay.IMogoPolyline;
|
||||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||||
@@ -54,7 +55,7 @@ public class MoGoPersonWarnPolylineManager implements IMoGoPersonWarnPolylineMan
|
|||||||
options.add(locations.get(i));
|
options.add(locations.get(i));
|
||||||
}
|
}
|
||||||
// 绘制线的对象
|
// 绘制线的对象
|
||||||
IMogoOverlayManager overlay = BridgeApi.INSTANCE.overlay();
|
IMogoOverlayManager overlay = MogoOverlayManager.getInstance();
|
||||||
if (overlay != null) {
|
if (overlay != null) {
|
||||||
mMogoPolyline = overlay.addPolyline(options);
|
mMogoPolyline = overlay.addPolyline(options);
|
||||||
mMogoPolyline.setTransparency(0.5f);
|
mMogoPolyline.setTransparency(0.5f);
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import com.mogo.eagle.core.function.v2x.events.consts.MoGoV2XServicePaths;
|
|||||||
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
|
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
|
||||||
import com.mogo.eagle.core.function.v2x.events.entity.model.DrawLineInfo;
|
import com.mogo.eagle.core.function.v2x.events.entity.model.DrawLineInfo;
|
||||||
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoStopPolylineManager;
|
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoStopPolylineManager;
|
||||||
|
import com.mogo.map.MogoOverlayManager;
|
||||||
import com.mogo.map.overlay.IMogoOverlayManager;
|
import com.mogo.map.overlay.IMogoOverlayManager;
|
||||||
import com.mogo.map.overlay.IMogoPolyline;
|
import com.mogo.map.overlay.IMogoPolyline;
|
||||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||||
@@ -53,7 +54,7 @@ public class MoGoStopPolylineManager implements IMoGoStopPolylineManager {
|
|||||||
options.add(locations.get(i));
|
options.add(locations.get(i));
|
||||||
}
|
}
|
||||||
// 绘制线的对象
|
// 绘制线的对象
|
||||||
IMogoOverlayManager overlay = BridgeApi.INSTANCE.overlay();
|
IMogoOverlayManager overlay = MogoOverlayManager.getInstance();
|
||||||
if (overlay != null) {
|
if (overlay != null) {
|
||||||
mMogoPolyline = overlay.addPolyline(options);
|
mMogoPolyline = overlay.addPolyline(options);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import android.content.Context;
|
|||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
|
||||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||||
|
import com.mogo.commons.AbsMogoApplication;
|
||||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||||
@@ -21,6 +22,8 @@ import com.mogo.eagle.core.function.v2x.events.marker.V2XMarkerAdapter;
|
|||||||
import com.mogo.eagle.core.function.v2x.events.utils.EntityUtilsKt;
|
import com.mogo.eagle.core.function.v2x.events.utils.EntityUtilsKt;
|
||||||
import com.mogo.eagle.core.function.v2x.events.utils.MapUtils;
|
import com.mogo.eagle.core.function.v2x.events.utils.MapUtils;
|
||||||
import com.mogo.eagle.core.utilcode.util.ViewUtils;
|
import com.mogo.eagle.core.utilcode.util.ViewUtils;
|
||||||
|
import com.mogo.map.MogoMapUIController;
|
||||||
|
import com.mogo.map.MogoMarkerManager;
|
||||||
import com.mogo.map.marker.IMogoMarker;
|
import com.mogo.map.marker.IMogoMarker;
|
||||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||||
import com.mogo.map.marker.IMogoMarkerManager;
|
import com.mogo.map.marker.IMogoMarkerManager;
|
||||||
@@ -74,7 +77,7 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
|
|||||||
}
|
}
|
||||||
clearAlarmPOI();
|
clearAlarmPOI();
|
||||||
// 锁车
|
// 锁车
|
||||||
IMogoMapUIController mapUiController = BridgeApi.INSTANCE.mapUiController();
|
IMogoMapUIController mapUiController = MogoMapUIController.getInstance();
|
||||||
if (mapUiController != null) {
|
if (mapUiController != null) {
|
||||||
mapUiController.recoverLockMode();
|
mapUiController.recoverLockMode();
|
||||||
}
|
}
|
||||||
@@ -231,7 +234,7 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
|
|||||||
@Override
|
@Override
|
||||||
public void drawableAlarmPOI(Context context, V2XRoadEventEntity roadEventEntity, IMogoMarkerClickListener clickListener) {
|
public void drawableAlarmPOI(Context context, V2XRoadEventEntity roadEventEntity, IMogoMarkerClickListener clickListener) {
|
||||||
try {
|
try {
|
||||||
IMogoMapUIController mapUiController = BridgeApi.INSTANCE.mapUiController();
|
IMogoMapUIController mapUiController = MogoMapUIController.getInstance();
|
||||||
if (mapUiController != null) {
|
if (mapUiController != null) {
|
||||||
mapUiController.changeMapMode(EnumMapUI.NorthUP_2D);
|
mapUiController.changeMapMode(EnumMapUI.NorthUP_2D);
|
||||||
}
|
}
|
||||||
@@ -273,7 +276,7 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
|
|||||||
mAlarmInfoMarker = MarkerDrawer.getInstance().drawMapMarkerImpl(markerShowEntity, MarkerDrawer.MARKER_Z_INDEX_HIGH, clickListener);
|
mAlarmInfoMarker = MarkerDrawer.getInstance().drawMapMarkerImpl(markerShowEntity, MarkerDrawer.MARKER_Z_INDEX_HIGH, clickListener);
|
||||||
} else {
|
} else {
|
||||||
optionsRipple.icon(V2XMarkerAdapter.getV2XRoadEventViewPng(context, roadEventEntity));
|
optionsRipple.icon(V2XMarkerAdapter.getV2XRoadEventViewPng(context, roadEventEntity));
|
||||||
IMogoMarkerManager marker = BridgeApi.INSTANCE.marker();
|
IMogoMarkerManager marker = MogoMarkerManager.getInstance(context);
|
||||||
if (marker != null) {
|
if (marker != null) {
|
||||||
mAlarmInfoMarker = marker.addMarker(V2X_EVENT_ALARM_POI, optionsRipple);
|
mAlarmInfoMarker = marker.addMarker(V2X_EVENT_ALARM_POI, optionsRipple);
|
||||||
}
|
}
|
||||||
@@ -319,7 +322,7 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
|
|||||||
@Override
|
@Override
|
||||||
public void clearALLPOI() {
|
public void clearALLPOI() {
|
||||||
try {
|
try {
|
||||||
IMogoMarkerManager markerManager = BridgeApi.INSTANCE.marker();
|
IMogoMarkerManager markerManager = MogoMarkerManager.getInstance(AbsMogoApplication.getApp());
|
||||||
if (markerManager != null) {
|
if (markerManager != null) {
|
||||||
markerManager.removeMarkers();
|
markerManager.removeMarkers();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.mogo.eagle.core.function.v2x.events.consts.MoGoV2XServicePaths;
|
|||||||
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XPolylineManager;
|
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XPolylineManager;
|
||||||
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager;
|
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager;
|
||||||
import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusManager;
|
import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusManager;
|
||||||
|
import com.mogo.map.MogoOverlayManager;
|
||||||
import com.mogo.map.overlay.IMogoOverlayManager;
|
import com.mogo.map.overlay.IMogoOverlayManager;
|
||||||
import com.mogo.map.overlay.IMogoPolyline;
|
import com.mogo.map.overlay.IMogoPolyline;
|
||||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||||
@@ -90,7 +91,7 @@ public class MoGoV2XPolylineManager implements IMoGoV2XPolylineManager {
|
|||||||
options.add(V2XStatusManager.getInstance().getTargetMoGoLatLng());
|
options.add(V2XStatusManager.getInstance().getTargetMoGoLatLng());
|
||||||
|
|
||||||
// 绘制线的对象
|
// 绘制线的对象
|
||||||
IMogoOverlayManager overlay = BridgeApi.INSTANCE.overlay();
|
IMogoOverlayManager overlay = MogoOverlayManager.getInstance();
|
||||||
if (overlay != null) {
|
if (overlay != null) {
|
||||||
mMogoPolyline = overlay.addPolyline(options);
|
mMogoPolyline = overlay.addPolyline(options);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
|||||||
import com.mogo.eagle.core.function.v2x.events.consts.MoGoV2XServicePaths;
|
import com.mogo.eagle.core.function.v2x.events.consts.MoGoV2XServicePaths;
|
||||||
import com.mogo.eagle.core.function.v2x.events.entity.model.DrawLineInfo;
|
import com.mogo.eagle.core.function.v2x.events.entity.model.DrawLineInfo;
|
||||||
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoWarnPolylineManager;
|
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoWarnPolylineManager;
|
||||||
|
import com.mogo.map.MogoOverlayManager;
|
||||||
import com.mogo.map.overlay.IMogoOverlayManager;
|
import com.mogo.map.overlay.IMogoOverlayManager;
|
||||||
import com.mogo.map.overlay.IMogoPolyline;
|
import com.mogo.map.overlay.IMogoPolyline;
|
||||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||||
@@ -61,7 +62,7 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager {
|
|||||||
}
|
}
|
||||||
// 绘制线的对象
|
// 绘制线的对象
|
||||||
|
|
||||||
IMogoOverlayManager overlay = BridgeApi.INSTANCE.overlay();
|
IMogoOverlayManager overlay = MogoOverlayManager.getInstance();
|
||||||
if (overlay != null) {
|
if (overlay != null) {
|
||||||
mMogoPolyline = overlay.addPolyline(options);
|
mMogoPolyline = overlay.addPolyline(options);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.mogo.eagle.core.data.map.MogoLocation;
|
|||||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||||
import com.mogo.eagle.core.function.v2x.events.utils.LocationUtils;
|
import com.mogo.eagle.core.function.v2x.events.utils.LocationUtils;
|
||||||
import com.mogo.eagle.core.utilcode.util.ColorUtils;
|
import com.mogo.eagle.core.utilcode.util.ColorUtils;
|
||||||
|
import com.mogo.map.MogoOverlayManager;
|
||||||
import com.mogo.map.overlay.IMogoOverlayManager;
|
import com.mogo.map.overlay.IMogoOverlayManager;
|
||||||
import com.mogo.map.overlay.IMogoPolyline;
|
import com.mogo.map.overlay.IMogoPolyline;
|
||||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||||
@@ -65,7 +66,7 @@ public class V2XOptimalRouteOverlay {
|
|||||||
// 线条粗细,渐变,渐变色值
|
// 线条粗细,渐变,渐变色值
|
||||||
mPolylineOptions.width(25).useGradient(true).colorValues(mPolylineColors);
|
mPolylineOptions.width(25).useGradient(true).colorValues(mPolylineColors);
|
||||||
// 绘制线
|
// 绘制线
|
||||||
IMogoOverlayManager overlay = BridgeApi.INSTANCE.overlay();
|
IMogoOverlayManager overlay = MogoOverlayManager.getInstance();
|
||||||
if (overlay != null) {
|
if (overlay != null) {
|
||||||
mMoGoPolyline = overlay.addPolyline(mPolylineOptions);
|
mMoGoPolyline = overlay.addPolyline(mPolylineOptions);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import com.mogo.eagle.core.function.v2x.events.scenario.scene.warning.V2XFrontWa
|
|||||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
|
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
|
||||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||||
import com.mogo.eagle.core.utilcode.util.Utils;
|
import com.mogo.eagle.core.utilcode.util.Utils;
|
||||||
|
import com.mogo.map.MogoMapUIController;
|
||||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||||
@@ -105,7 +106,7 @@ public class V2XScenarioManager implements IV2XScenarioManager {
|
|||||||
* 道路事件触发后,切换到中景
|
* 道路事件触发后,切换到中景
|
||||||
*/
|
*/
|
||||||
private void sceneChange() {
|
private void sceneChange() {
|
||||||
IMogoMapUIController mapUiController = BridgeApi.INSTANCE.mapUiController();
|
IMogoMapUIController mapUiController = MogoMapUIController.getInstance();
|
||||||
if (mapUiController != null && mapUiController.getCurrentMapVisualAngle() != VisualAngleMode.MODE_MEDIUM_SIGHT) {
|
if (mapUiController != null && mapUiController.getCurrentMapVisualAngle() != VisualAngleMode.MODE_MEDIUM_SIGHT) {
|
||||||
mapUiController.changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
|
mapUiController.changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
|||||||
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XMarkerManager;
|
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XMarkerManager;
|
||||||
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XPolylineManager;
|
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XPolylineManager;
|
||||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker;
|
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker;
|
||||||
|
import com.mogo.map.MogoMapUIController;
|
||||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||||
|
|
||||||
@@ -31,7 +32,7 @@ public class V2XRoadEventMarker implements IV2XMarker<V2XRoadEventEntity> {
|
|||||||
@Override
|
@Override
|
||||||
public void clearPOI() {
|
public void clearPOI() {
|
||||||
// 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随
|
// 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随
|
||||||
IMogoMapUIController mapUiController = BridgeApi.INSTANCE.mapUiController();
|
IMogoMapUIController mapUiController = MogoMapUIController.getInstance();
|
||||||
if (mapUiController != null) {
|
if (mapUiController != null) {
|
||||||
mapUiController.loseLockMode();
|
mapUiController.loseLockMode();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.mogo.eagle.core.function.v2x.events.entity.net.V2XOptimalRouteDataRes
|
|||||||
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XMarkerManager;
|
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XMarkerManager;
|
||||||
import com.mogo.eagle.core.function.v2x.events.observer.V2XOptimalRouteObserver;
|
import com.mogo.eagle.core.function.v2x.events.observer.V2XOptimalRouteObserver;
|
||||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker;
|
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker;
|
||||||
|
import com.mogo.map.MogoMapUIController;
|
||||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,7 +42,7 @@ public class V2XOptimalRouteVREventMarker implements IV2XMarker<V2XOptimalRouteD
|
|||||||
@Override
|
@Override
|
||||||
public void clearPOI() {
|
public void clearPOI() {
|
||||||
// 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随
|
// 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随
|
||||||
IMogoMapUIController mapUiController = BridgeApi.INSTANCE.mapUiController();
|
IMogoMapUIController mapUiController = MogoMapUIController.getInstance();
|
||||||
if (mapUiController != null) {
|
if (mapUiController != null) {
|
||||||
mapUiController.loseLockMode();
|
mapUiController.loseLockMode();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_STOP_
|
|||||||
import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_WARN_DATA;
|
import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_WARN_DATA;
|
||||||
|
|
||||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||||
|
import com.mogo.commons.AbsMogoApplication;
|
||||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||||
@@ -17,6 +18,7 @@ import com.mogo.eagle.core.function.v2x.events.manager.IMoGoWarnPolylineManager;
|
|||||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker;
|
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker;
|
||||||
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler;
|
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler;
|
||||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||||
|
import com.mogo.map.MogoMarkerManager;
|
||||||
import com.mogo.map.marker.IMogoMarkerManager;
|
import com.mogo.map.marker.IMogoMarkerManager;
|
||||||
import com.mogo.map.overlay.IMogoPolyline;
|
import com.mogo.map.overlay.IMogoPolyline;
|
||||||
import com.mogo.module.common.MogoApisHandler;
|
import com.mogo.module.common.MogoApisHandler;
|
||||||
@@ -92,7 +94,7 @@ public class V2XWarningMarker implements IV2XMarker {
|
|||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
//二轮车和行人的渲染和移动
|
//二轮车和行人的渲染和移动
|
||||||
IMogoMarkerManager marker = BridgeApi.INSTANCE.marker();
|
IMogoMarkerManager marker = MogoMarkerManager.getInstance(AbsMogoApplication.getApp());
|
||||||
if (marker != null) {
|
if (marker != null) {
|
||||||
marker.removeMarkers(TYPE_MARKER_CLOUD_WARN_DATA);
|
marker.removeMarkers(TYPE_MARKER_CLOUD_WARN_DATA);
|
||||||
}
|
}
|
||||||
@@ -208,7 +210,7 @@ public class V2XWarningMarker implements IV2XMarker {
|
|||||||
stopPolyLineManager.clearLine();
|
stopPolyLineManager.clearLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
IMogoMarkerManager marker = BridgeApi.INSTANCE.marker();
|
IMogoMarkerManager marker = MogoMarkerManager.getInstance(AbsMogoApplication.getApp());
|
||||||
if (marker != null) {
|
if (marker != null) {
|
||||||
//清除小箭头
|
//清除小箭头
|
||||||
marker.removeMarkers(WARNING_ARROWS);
|
marker.removeMarkers(WARNING_ARROWS);
|
||||||
@@ -257,7 +259,7 @@ public class V2XWarningMarker implements IV2XMarker {
|
|||||||
private void handleStopLine() {
|
private void handleStopLine() {
|
||||||
try {
|
try {
|
||||||
if (mCloundWarningInfo != null) {
|
if (mCloundWarningInfo != null) {
|
||||||
IMogoMarkerManager marker = BridgeApi.INSTANCE.marker();
|
IMogoMarkerManager marker = MogoMarkerManager.getInstance(AbsMogoApplication.getApp());
|
||||||
if (marker != null) {
|
if (marker != null) {
|
||||||
marker.removeMarkers(TYPE_MARKER_CLOUD_STOP_LINE_DATA);
|
marker.removeMarkers(TYPE_MARKER_CLOUD_STOP_LINE_DATA);
|
||||||
}
|
}
|
||||||
@@ -435,7 +437,7 @@ public class V2XWarningMarker implements IV2XMarker {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void clearPOI() {
|
public void clearPOI() {
|
||||||
IMogoMarkerManager marker = BridgeApi.INSTANCE.marker();
|
IMogoMarkerManager marker = MogoMarkerManager.getInstance(AbsMogoApplication.getApp());
|
||||||
if (marker != null) {
|
if (marker != null) {
|
||||||
marker.removeMarkers(V2X_FRONT_WARNING_MARKER);
|
marker.removeMarkers(V2X_FRONT_WARNING_MARKER);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,13 @@ package com.mogo.eagle.core.function.v2x.events.utils;
|
|||||||
|
|
||||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X;
|
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X;
|
||||||
|
|
||||||
|
import com.mogo.commons.AbsMogoApplication;
|
||||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||||
|
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
|
||||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||||
|
import com.mogo.eagle.core.utilcode.util.AppUtils;
|
||||||
import com.mogo.map.location.IMogoLocationClient;
|
import com.mogo.map.location.IMogoLocationClient;
|
||||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||||
import com.mogo.module.common.MogoApisHandler;
|
import com.mogo.module.common.MogoApisHandler;
|
||||||
@@ -31,14 +34,14 @@ public class LocationUtils {
|
|||||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat(),
|
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat(),
|
||||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon()
|
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon()
|
||||||
);
|
);
|
||||||
IMogoLocationClient locationClient = BridgeApi.INSTANCE.locationClient();
|
IMogoLocationClient locationClient = CallerMapUIServiceManager.INSTANCE.getSingletonLocationClient(AbsMogoApplication.getApp());
|
||||||
if (locationClient != null) {
|
if (locationClient != null) {
|
||||||
MogoLocation location = locationClient.getLastKnowLocation();
|
MogoLocation location = locationClient.getLastKnowLocation();
|
||||||
if (location != null) {
|
if (location != null) {
|
||||||
latLon = new MogoLatLng(location.getLatitude(), location.getLongitude());
|
latLon = new MogoLatLng(location.getLatitude(), location.getLongitude());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
IMogoMapUIController mapUiController = BridgeApi.INSTANCE.mapUiController();
|
IMogoMapUIController mapUiController = CallerMapUIServiceManager.INSTANCE.getMapUIController();
|
||||||
if (mapUiController != null) {
|
if (mapUiController != null) {
|
||||||
latLon = mapUiController.getWindowCenterLocation();
|
latLon = mapUiController.getWindowCenterLocation();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.mogo.eagle.core.function.v2x.events.utils
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Rect
|
import android.graphics.Rect
|
||||||
import com.mogo.eagle.core.data.map.MogoLatLng
|
import com.mogo.eagle.core.data.map.MogoLatLng
|
||||||
|
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi
|
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi
|
||||||
import com.mogo.eagle.core.utilcode.util.WindowUtils
|
import com.mogo.eagle.core.utilcode.util.WindowUtils
|
||||||
import com.mogo.module.common.MogoApisHandler
|
import com.mogo.module.common.MogoApisHandler
|
||||||
@@ -45,7 +46,9 @@ class MapUtils {
|
|||||||
MogoApisHandler.getInstance().apis.adasControllerApi.lastLon
|
MogoApisHandler.getInstance().apis.adasControllerApi.lastLon
|
||||||
)
|
)
|
||||||
// 调整自适应的地图镜头
|
// 调整自适应的地图镜头
|
||||||
BridgeApi.mapUiController()?.showBounds("MapUtils", carLocation, listOf(latLng), mBoundRect, true)
|
carLocation?.let {
|
||||||
|
CallerMapUIServiceManager.getMapUIController()?.showBounds("MapUtils", it, listOf(latLng), mBoundRect, true)
|
||||||
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants;
|
|||||||
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceManager;
|
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceManager;
|
||||||
import com.mogo.eagle.core.utilcode.util.Utils;
|
import com.mogo.eagle.core.utilcode.util.Utils;
|
||||||
import com.mogo.eagle.core.widget.RoundLayout;
|
import com.mogo.eagle.core.widget.RoundLayout;
|
||||||
|
import com.mogo.map.MogoLocationClient;
|
||||||
import com.mogo.map.location.IMogoLocationClient;
|
import com.mogo.map.location.IMogoLocationClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -98,7 +99,7 @@ public class CarZegoLiveVideoView extends RoundLayout {
|
|||||||
*/
|
*/
|
||||||
private void playLiveVideo() {
|
private void playLiveVideo() {
|
||||||
if (mSurfaceView != null) {
|
if (mSurfaceView != null) {
|
||||||
IMogoLocationClient locationClient = BridgeApi.INSTANCE.locationClient();
|
IMogoLocationClient locationClient = MogoLocationClient.getInstance(getContext());
|
||||||
MogoLocation mogoLocation = null;
|
MogoLocation mogoLocation = null;
|
||||||
if (locationClient != null) {
|
if (locationClient != null) {
|
||||||
mogoLocation = locationClient.getLastKnowLocation();
|
mogoLocation = locationClient.getLastKnowLocation();
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceManager;
|
|||||||
import com.mogo.eagle.core.utilcode.util.Utils;
|
import com.mogo.eagle.core.utilcode.util.Utils;
|
||||||
import com.mogo.eagle.core.widget.RoundLayout;
|
import com.mogo.eagle.core.widget.RoundLayout;
|
||||||
import com.mogo.eagle.core.widget.media.video.SimpleVideoPlayer;
|
import com.mogo.eagle.core.widget.media.video.SimpleVideoPlayer;
|
||||||
|
import com.mogo.map.MogoLocationClient;
|
||||||
import com.mogo.map.location.IMogoLocationClient;
|
import com.mogo.map.location.IMogoLocationClient;
|
||||||
import com.mogo.module.common.entity.MarkerCarInfo;
|
import com.mogo.module.common.entity.MarkerCarInfo;
|
||||||
import com.shuyu.gsyvideoplayer.GSYVideoManager;
|
import com.shuyu.gsyvideoplayer.GSYVideoManager;
|
||||||
@@ -163,7 +164,7 @@ public class V2XCrossRoadVideoView extends RoundLayout {
|
|||||||
}
|
}
|
||||||
//重新获取直播流地址
|
//重新获取直播流地址
|
||||||
else {
|
else {
|
||||||
IMogoLocationClient iMogoLocationClient = BridgeApi.INSTANCE.locationClient();
|
IMogoLocationClient iMogoLocationClient = MogoLocationClient.getInstance(getContext());
|
||||||
if (iMogoLocationClient != null) {
|
if (iMogoLocationClient != null) {
|
||||||
MogoLocation mogoLocation = iMogoLocationClient.getLastKnowLocation();
|
MogoLocation mogoLocation = iMogoLocationClient.getLastKnowLocation();
|
||||||
if (mogoLocation == null) {
|
if (mogoLocation == null) {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener
|
|||||||
import com.mogo.eagle.core.function.api.vip.IMoGoVipSetListener
|
import com.mogo.eagle.core.function.api.vip.IMoGoVipSetListener
|
||||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||||
|
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||||
import com.mogo.eagle.core.function.call.trafficlight.CallTrafficLightListenerManager
|
import com.mogo.eagle.core.function.call.trafficlight.CallTrafficLightListenerManager
|
||||||
import com.mogo.eagle.core.function.call.vip.CallVipSetListenerManager
|
import com.mogo.eagle.core.function.call.vip.CallVipSetListenerManager
|
||||||
import com.mogo.eagle.core.function.v2x.vip.VipCarManager
|
import com.mogo.eagle.core.function.v2x.vip.VipCarManager
|
||||||
@@ -97,11 +98,10 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener,
|
|||||||
CallerLogger.d("$M_V2X$TAG", "speed is:$speed")
|
CallerLogger.d("$M_V2X$TAG", "speed is:$speed")
|
||||||
if (speed <= 2.5f) return// 小于等于9km/h不处理
|
if (speed <= 2.5f) return// 小于等于9km/h不处理
|
||||||
// 由于到路口100m时回调不准,手动计算直线距离
|
// 由于到路口100m时回调不准,手动计算直线距离
|
||||||
val distance = MogoApisHandler.getInstance().apis.mapServiceApi
|
val distance = CallerMapUIServiceManager.getMapUIController()?.calculateLineDistance(
|
||||||
.mapUIController.calculateLineDistance(
|
MogoLatLng(it.latitude, it.longitude),
|
||||||
MogoLatLng(it.latitude, it.longitude),
|
MogoLatLng(trafficLightResult.lat, trafficLightResult.lon)
|
||||||
MogoLatLng(trafficLightResult.lat, trafficLightResult.lon)
|
) ?: 0f
|
||||||
)
|
|
||||||
CallerLogger.d(
|
CallerLogger.d(
|
||||||
"$M_V2X$TAG",
|
"$M_V2X$TAG",
|
||||||
"路口经度为:${trafficLightResult.lon},纬度为:${trafficLightResult.lat};车的经度为:${it.longitude},纬度为:${it.latitude};两点距离为:${distance}"
|
"路口经度为:${trafficLightResult.lon},纬度为:${trafficLightResult.lat};车的经度为:${it.longitude},纬度为:${it.latitude};两点距离为:${distance}"
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import android.location.Location;
|
|||||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||||
import com.mogo.eagle.core.function.call.v2x.CallLimitingVelocityListenerManager;
|
import com.mogo.eagle.core.function.call.v2x.CallLimitingVelocityListenerManager;
|
||||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||||
|
import com.mogo.map.MogoMapUIController;
|
||||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||||
import com.mogo.module.common.MogoApisHandler;
|
import com.mogo.module.common.MogoApisHandler;
|
||||||
|
|
||||||
@@ -33,8 +34,8 @@ public class SpeedLimitDataManager implements IMogoCarLocationChangedListener2 {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (mLocation != null){
|
if (mLocation != null){
|
||||||
if (MogoApisHandler.getInstance().getApis().getMapServiceApi() != null && MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController() != null) {
|
if (MogoMapUIController.getInstance() != null) {
|
||||||
int speedLimmit = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getSpeedLimmit(mLocation.getLongitude(), mLocation.getLatitude(), mLocation.getBearing());
|
int speedLimmit = MogoMapUIController.getInstance().getSpeedLimmit(mLocation.getLongitude(), mLocation.getLatitude(), mLocation.getBearing());
|
||||||
UiThreadHandler.post(new Runnable() {
|
UiThreadHandler.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.mogo.eagle.core.data.trafficlight.TrafficLightDetail
|
|||||||
import com.mogo.eagle.core.data.trafficlight.TrafficLightResult
|
import com.mogo.eagle.core.data.trafficlight.TrafficLightResult
|
||||||
import com.mogo.eagle.core.data.trafficlight.isInRange
|
import com.mogo.eagle.core.data.trafficlight.isInRange
|
||||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||||
|
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||||
import com.mogo.eagle.core.function.call.trafficlight.CallTrafficLightListenerManager
|
import com.mogo.eagle.core.function.call.trafficlight.CallTrafficLightListenerManager
|
||||||
import com.mogo.eagle.core.function.v2x.trafficlight.TrafficLightHMIManager
|
import com.mogo.eagle.core.function.v2x.trafficlight.TrafficLightHMIManager
|
||||||
import com.mogo.eagle.core.function.v2x.trafficlight.core.TrafficLightThreadHandler.Companion.MSG_WHAT_LOOP_SEARCH_CROSS_ROAD
|
import com.mogo.eagle.core.function.v2x.trafficlight.core.TrafficLightThreadHandler.Companion.MSG_WHAT_LOOP_SEARCH_CROSS_ROAD
|
||||||
@@ -53,8 +54,7 @@ class MogoTrafficLightManager : IMogoCarLocationChangedListener2 {
|
|||||||
CallTrafficLightListenerManager.resetTrafficLightData()
|
CallTrafficLightListenerManager.resetTrafficLightData()
|
||||||
}
|
}
|
||||||
mLocation?.let { it ->
|
mLocation?.let { it ->
|
||||||
val tileId = MogoApisHandler.getInstance().apis
|
val tileId = CallerMapUIServiceManager.getMapUIController()?.getTileId(it.longitude, it.latitude) ?: 0
|
||||||
.mapServiceApi.mapUIController.getTileId(it.longitude, it.latitude)
|
|
||||||
trafficLightNetWorkModel.requestRoadID(
|
trafficLightNetWorkModel.requestRoadID(
|
||||||
tileId, it.latitude, it.longitude, it.bearing.toDouble(),
|
tileId, it.latitude, it.longitude, it.bearing.toDouble(),
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import android.location.Location
|
|||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
import android.os.Message
|
import android.os.Message
|
||||||
|
import androidx.core.content.contentValuesOf
|
||||||
import com.mogo.cloud.commons.utils.CoordinateUtils
|
import com.mogo.cloud.commons.utils.CoordinateUtils
|
||||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_V2X
|
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_V2X
|
||||||
import com.mogo.eagle.core.data.trafficlight.*
|
import com.mogo.eagle.core.data.trafficlight.*
|
||||||
@@ -13,6 +14,7 @@ import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
|
|||||||
import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener
|
import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener
|
||||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||||
|
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||||
import com.mogo.eagle.core.function.call.trafficlight.CallTrafficLightListenerManager
|
import com.mogo.eagle.core.function.call.trafficlight.CallTrafficLightListenerManager
|
||||||
import com.mogo.eagle.core.function.call.vip.CallVipSetListenerManager
|
import com.mogo.eagle.core.function.call.vip.CallVipSetListenerManager
|
||||||
import com.mogo.eagle.core.function.v2x.trafficlight.core.MogoTrafficLightManager
|
import com.mogo.eagle.core.function.v2x.trafficlight.core.MogoTrafficLightManager
|
||||||
@@ -130,16 +132,24 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
|
|||||||
//如果上次结果和本次灯态结果变化比较大,则已变灯,控制HMI展示弹窗
|
//如果上次结果和本次灯态结果变化比较大,则已变灯,控制HMI展示弹窗
|
||||||
if (abs(currentResult!!.remain - it.remain) > 5 && currentResult.isGreen()) {
|
if (abs(currentResult!!.remain - it.remain) > 5 && currentResult.isGreen()) {
|
||||||
CallerLogger.d("$M_V2X$TAG", "调用showWarningV2X to show")
|
CallerLogger.d("$M_V2X$TAG", "调用showWarningV2X to show")
|
||||||
CallerHmiManager.showWarningV2X(EventTypeEnum.TYPE_VIP_IDENTIFICATION.poiType.toInt(), EventTypeEnum.TYPE_VIP_IDENTIFICATION.content, EventTypeEnum.TYPE_VIP_IDENTIFICATION.tts, EventTypeEnum.TYPE_VIP_IDENTIFICATION.poiType, object : IMoGoWarningStatusListener {
|
CallerHmiManager.showWarningV2X(
|
||||||
override fun onShow() {}
|
EventTypeEnum.TYPE_VIP_IDENTIFICATION.poiType.toInt(),
|
||||||
override fun onDismiss() {
|
EventTypeEnum.TYPE_VIP_IDENTIFICATION.content,
|
||||||
CallerLogger.d(
|
EventTypeEnum.TYPE_VIP_IDENTIFICATION.tts,
|
||||||
"$M_V2X$TAG",
|
EventTypeEnum.TYPE_VIP_IDENTIFICATION.poiType,
|
||||||
"showWarningV2X vip dismiss , resetConditions"
|
object : IMoGoWarningStatusListener {
|
||||||
)
|
override fun onShow() {}
|
||||||
resetConditions()
|
override fun onDismiss() {
|
||||||
}
|
CallerLogger.d(
|
||||||
}, true, 5000L)
|
"$M_V2X$TAG",
|
||||||
|
"showWarningV2X vip dismiss , resetConditions"
|
||||||
|
)
|
||||||
|
resetConditions()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
true,
|
||||||
|
5000L
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -234,12 +244,14 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun turnLight(controlTime: Int) {
|
private fun turnLight(controlTime: Int) {
|
||||||
result?.let {
|
if (result == null || mContext == null) return
|
||||||
val bearing =
|
val locationClient = CallerMapUIServiceManager.getSingletonLocationClient(mContext!!)
|
||||||
MogoApisHandler.getInstance().apis.mapServiceApi.getSingletonLocationClient(mContext).lastKnowLocation.bearing.toDouble()
|
if (locationClient != null) {
|
||||||
|
var bearing =
|
||||||
|
locationClient.lastKnowLocation.bearing.toDouble()
|
||||||
CallerLogger.d("$M_V2X$TAG", "turnLight -- bearing : $bearing")
|
CallerLogger.d("$M_V2X$TAG", "turnLight -- bearing : $bearing")
|
||||||
MogoTrafficLightManager.INSTANCE.turnLightToGreen(
|
MogoTrafficLightManager.INSTANCE.turnLightToGreen(
|
||||||
it.lightId, it.crossId, bearing, controlTime,
|
result!!.lightId, result!!.crossId, bearing, controlTime,
|
||||||
{
|
{
|
||||||
CallerLogger.d("$M_V2X$TAG", "变灯请求成功")
|
CallerLogger.d("$M_V2X$TAG", "变灯请求成功")
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -51,9 +51,11 @@ dependencies {
|
|||||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||||
implementation rootProject.ext.dependencies.mogo_core_data
|
implementation rootProject.ext.dependencies.mogo_core_data
|
||||||
compileOnly rootProject.ext.dependencies.adasHigh
|
compileOnly rootProject.ext.dependencies.adasHigh
|
||||||
|
compileOnly rootProject.ext.dependencies.mogomapapi
|
||||||
} else {
|
} else {
|
||||||
implementation project(':core:mogo-core-data')
|
implementation project(':core:mogo-core-data')
|
||||||
compileOnly project(':libraries:mogo-adas')
|
compileOnly project(':libraries:mogo-adas')
|
||||||
|
compileOnly project(':libraries:mogo-map-api')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.mogo.service.map;
|
package com.mogo.eagle.core.function.api.map;
|
||||||
|
|
||||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||||
import com.mogo.map.IDestroyable;
|
import com.mogo.map.IDestroyable;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.mogo.service.map;
|
package com.mogo.eagle.core.function.api.map;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package com.mogo.eagle.core.function.api.map.location
|
|
||||||
|
|
||||||
import com.mogo.eagle.core.function.api.base.IMoGoFunctionServerProvider
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author renwj
|
|
||||||
* @date 2021/11/04 16:10 下午
|
|
||||||
* 此类主要用来同步自动驾驶定位信息给各业务方
|
|
||||||
*/
|
|
||||||
interface IMoGoLocationUpdater4AutoPilot : IMoGoFunctionServerProvider {
|
|
||||||
|
|
||||||
fun updateLocation(location: Any?)
|
|
||||||
}
|
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
package com.mogo.service.module;
|
package com.mogo.eagle.core.function.api.map.marker;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||||
import com.mogo.map.marker.IMogoMarker;
|
import com.mogo.map.marker.IMogoMarker;
|
||||||
|
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author congtaowang
|
* @author congtaowang
|
||||||
@@ -19,4 +20,6 @@ public interface IMogoMarkerService extends IProvider {
|
|||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
IMogoMarker drawMarker( Object object );
|
IMogoMarker drawMarker( Object object );
|
||||||
|
|
||||||
|
IMogoMapUIController getMapUIController();
|
||||||
}
|
}
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package com.mogo.eagle.core.function.call.map
|
|
||||||
|
|
||||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
|
||||||
import com.mogo.eagle.core.function.api.map.location.IMoGoLocationUpdater4AutoPilot
|
|
||||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
|
||||||
|
|
||||||
object CallerLocationUpdaterManager {
|
|
||||||
|
|
||||||
private val updater : IMoGoLocationUpdater4AutoPilot? by lazy {
|
|
||||||
CallerBase.getApiInstance(
|
|
||||||
IMoGoLocationUpdater4AutoPilot::class.java,
|
|
||||||
MogoServicePaths.PATH_MAP_LOCATION_UPDATE_4_AUTO_PILOT)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun updateLocation(location: Any?) {
|
|
||||||
updater?.updateLocation(location);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.mogo.eagle.core.function.call.map
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||||
|
import com.mogo.eagle.core.function.api.map.IMogoMapService
|
||||||
|
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||||
|
import com.mogo.map.listener.IMogoHosListenerRegister
|
||||||
|
import com.mogo.map.location.IMogoLocationClient
|
||||||
|
import com.mogo.map.marker.IMogoMarkerManager
|
||||||
|
import com.mogo.map.search.geo.IMogoGeoSearch
|
||||||
|
import com.mogo.map.uicontroller.IMogoMapUIController
|
||||||
|
|
||||||
|
object CallerMapUIServiceManager {
|
||||||
|
private val serviceProvider : IMogoMapService? by lazy {
|
||||||
|
CallerBase.getApiInstance(
|
||||||
|
IMogoMapService::class.java,
|
||||||
|
MogoServicePaths.PATH_SERVICES_MAP)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getMapUIController(): IMogoMapUIController? {
|
||||||
|
return serviceProvider?.mapUIController
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getHostListenerRegister(): IMogoHosListenerRegister? {
|
||||||
|
return serviceProvider?.hostListenerRegister
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getSingletonLocationClient(context: Context): IMogoLocationClient? {
|
||||||
|
return serviceProvider?.getSingletonLocationClient(context)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getGeoSearch(context: Context): IMogoGeoSearch? {
|
||||||
|
return serviceProvider?.getGeoSearch(context)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getMarkerManager(context: Context): IMogoMarkerManager? {
|
||||||
|
return serviceProvider?.getMarkerManager(context)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -522,9 +522,9 @@ public final class ToastUtils {
|
|||||||
return new WindowManagerToast(toastUtils, WindowManager.LayoutParams.TYPE_TOAST);
|
return new WindowManagerToast(toastUtils, WindowManager.LayoutParams.TYPE_TOAST);
|
||||||
} else if (UtilsBridge.isGrantedDrawOverlays()) {
|
} else if (UtilsBridge.isGrantedDrawOverlays()) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
return new WindowManagerToast(toastUtils, WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY);
|
return new WindowManagerToast(toastUtils, WindowManager.LayoutParams.TYPE_APPLICATION_PANEL);
|
||||||
} else {
|
} else {
|
||||||
return new WindowManagerToast(toastUtils, WindowManager.LayoutParams.TYPE_PHONE);
|
return new WindowManagerToast(toastUtils, WindowManager.LayoutParams.TYPE_TOAST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new ActivityToast(toastUtils);
|
return new ActivityToast(toastUtils);
|
||||||
|
|||||||
@@ -33,6 +33,11 @@ android {
|
|||||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility 1.8
|
||||||
|
targetCompatibility 1.8
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -41,20 +46,21 @@ dependencies {
|
|||||||
|
|
||||||
implementation rootProject.ext.dependencies.arouter
|
implementation rootProject.ext.dependencies.arouter
|
||||||
kapt rootProject.ext.dependencies.aroutercompiler
|
kapt rootProject.ext.dependencies.aroutercompiler
|
||||||
|
implementation rootProject.ext.dependencies.mogocustommap
|
||||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||||
implementation rootProject.ext.dependencies.mogo_core_utils
|
implementation rootProject.ext.dependencies.mogo_core_utils
|
||||||
implementation rootProject.ext.dependencies.mogomapapi
|
implementation rootProject.ext.dependencies.mogomapapi
|
||||||
implementation rootProject.ext.dependencies.mogocommons
|
implementation rootProject.ext.dependencies.mogocommons
|
||||||
|
|
||||||
implementation rootProject.ext.dependencies.mogo_core_data
|
implementation rootProject.ext.dependencies.mogo_core_data
|
||||||
|
implementation rootProject.ext.dependencies.mogo_core_function_call
|
||||||
} else {
|
} else {
|
||||||
implementation project(':core:mogo-core-utils')
|
implementation project(':core:mogo-core-utils')
|
||||||
implementation project(':libraries:mogo-map-api')
|
implementation project(':libraries:mogo-map-api')
|
||||||
implementation project(':foudations:mogo-commons')
|
implementation project(':foudations:mogo-commons')
|
||||||
|
|
||||||
implementation project(':core:mogo-core-data')
|
implementation project(':core:mogo-core-data')
|
||||||
|
implementation project(':core:mogo-core-function-call')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,77 @@
|
|||||||
|
package com.mogo.map;
|
||||||
|
|
||||||
|
import static com.mogo.map.marker.MarkerType.MAP_STATIC;
|
||||||
|
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||||
|
import com.mogo.map.marker.AMapMarkerWrapper;
|
||||||
|
import com.mogo.map.marker.IMogoMarker;
|
||||||
|
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||||
|
import com.mogo.map.marker.MarkerWrapperClickHelper;
|
||||||
|
import com.mogo.map.marker.MogoMarkerOptions;
|
||||||
|
import com.mogo.map.marker.MogoMarkersHandler;
|
||||||
|
import com.zhidaoauto.map.sdk.open.marker.Marker;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author congtaowang
|
||||||
|
* @since 2019-12-24
|
||||||
|
* <p>
|
||||||
|
* marker 点击事件处理
|
||||||
|
*/
|
||||||
|
public class AMapMarkerClickHandler {
|
||||||
|
|
||||||
|
private static volatile AMapMarkerClickHandler sInstance;
|
||||||
|
|
||||||
|
private AMapMarkerClickHandler() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AMapMarkerClickHandler getInstance() {
|
||||||
|
if (sInstance == null) {
|
||||||
|
synchronized (AMapMarkerClickHandler.class) {
|
||||||
|
if (sInstance == null) {
|
||||||
|
sInstance = new AMapMarkerClickHandler();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void release() {
|
||||||
|
sInstance = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Object readResolve() {
|
||||||
|
// 阻止反序列化,必须实现 Serializable 接口
|
||||||
|
return sInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean handleMarkerClicked(Marker marker) {
|
||||||
|
if (marker == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//地图道路上静态数,暂时只过滤traffic类型下发点击事件
|
||||||
|
if (MarkerWrapperClickHelper.getInstance().isStaticMarker(marker.getId())){
|
||||||
|
IMogoMarker iMogoMarker = new AMapMarkerWrapper(marker,new MogoMarkerOptions());
|
||||||
|
iMogoMarker.setOwner(MAP_STATIC); //TODO 后续可能由于类型比较多,需要owner匹配机制,以及控制owner细粒度
|
||||||
|
Logger.d("AMapMarkerWrapper", "traffic marker 点击回调");
|
||||||
|
return MogoMarkersHandler.getInstance().onStaticMarkerClicked(iMogoMarker);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, IMogoMarker> mogoMarkerMap = MarkerWrapperClickHelper.getInstance().getMogoMarkerMap();
|
||||||
|
if (mogoMarkerMap.containsKey(marker.getId())) {
|
||||||
|
IMogoMarker mogoMarker = mogoMarkerMap.get(marker.getId());
|
||||||
|
final IMogoMarkerClickListener listener = mogoMarker.getOnMarkerClickListener();
|
||||||
|
Logger.d("AMapMarkerWrapper", "marker 点击回调:%s -> %s", mogoMarker, marker);
|
||||||
|
if (listener != null) {
|
||||||
|
boolean result = listener.onMarkerClicked(mogoMarker);
|
||||||
|
if (result) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return MogoMarkersHandler.getInstance().onMarkerClicked(mogoMarker);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,110 @@
|
|||||||
|
package com.mogo.map;
|
||||||
|
|
||||||
|
import com.zhidaoauto.map.sdk.open.view.MapAutoViewHelper;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author congtaowang
|
||||||
|
* @since 2019-12-18
|
||||||
|
* <p>
|
||||||
|
* 代理自研地图UiSettings
|
||||||
|
*/
|
||||||
|
public class AMapUiSettingsWrapper implements IMogoUiSettings {
|
||||||
|
|
||||||
|
private MapAutoViewHelper mUiSettings;
|
||||||
|
|
||||||
|
public AMapUiSettingsWrapper( MapAutoViewHelper mUiSettings ) {
|
||||||
|
this.mUiSettings = mUiSettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setScaleControlsEnabled( boolean enabled ) {
|
||||||
|
if ( mUiSettings != null ) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setZoomControlsEnabled( boolean enabled ) {
|
||||||
|
if ( mUiSettings != null ) {
|
||||||
|
mUiSettings.setZoomGesturesEnabled( enabled );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCompassEnabled( boolean enabled ) {
|
||||||
|
if ( mUiSettings != null ) {
|
||||||
|
if(enabled){
|
||||||
|
mUiSettings.showDirection();
|
||||||
|
}else{
|
||||||
|
mUiSettings.hiddenDirection();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMyLocationButtonEnabled( boolean enabled ) {
|
||||||
|
if ( mUiSettings != null ) {
|
||||||
|
if(enabled){
|
||||||
|
mUiSettings.showLocation();
|
||||||
|
}else{
|
||||||
|
mUiSettings.hiddenLocation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setScrollGesturesEnabled( boolean enabled ) {
|
||||||
|
if ( mUiSettings != null ) {
|
||||||
|
mUiSettings.setScrollGesturesEnabled( enabled );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setZoomGesturesEnabled( boolean enabled ) {
|
||||||
|
if ( mUiSettings != null ) {
|
||||||
|
mUiSettings.setZoomGesturesEnabled( enabled );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTiltGesturesEnabled( boolean enabled ) {
|
||||||
|
if ( mUiSettings != null ) {
|
||||||
|
mUiSettings.setTiltGesturesEnabled( enabled );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setRotateGesturesEnabled( boolean enabled ) {
|
||||||
|
if ( mUiSettings != null ) {
|
||||||
|
mUiSettings.setRotateGesturesEnabled( enabled );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setAllGesturesEnabled( boolean enabled ) {
|
||||||
|
if ( mUiSettings != null ) {
|
||||||
|
mUiSettings.setAllGesturesEnabled( enabled );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setIndoorSwitchEnabled( boolean enabled ) {
|
||||||
|
if ( mUiSettings != null ) {
|
||||||
|
// mUiSettings.setIndoorSwitchEnabled( enabled );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLogoEnable( boolean enabled ) {
|
||||||
|
if ( mUiSettings != null ) {
|
||||||
|
try {
|
||||||
|
Method method = mUiSettings.getClass().getMethod( "setLogoEnable", boolean.class );
|
||||||
|
method.setAccessible( true );
|
||||||
|
method.invoke( mUiSettings, enabled );
|
||||||
|
} catch ( Exception e ) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
1057
libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.java
Normal file
1057
libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.java
Normal file
File diff suppressed because it is too large
Load Diff
326
libraries/mogo-map/src/main/java/com/mogo/map/AMapWrapper.java
Normal file
326
libraries/mogo-map/src/main/java/com/mogo/map/AMapWrapper.java
Normal file
@@ -0,0 +1,326 @@
|
|||||||
|
package com.mogo.map;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Point;
|
||||||
|
|
||||||
|
import com.mogo.eagle.core.data.traffic.TrafficData;
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||||
|
import com.mogo.map.marker.AMapInfoWindowAdapter;
|
||||||
|
import com.mogo.map.marker.AMapMarkerWrapper;
|
||||||
|
import com.mogo.map.marker.IMogoMarker;
|
||||||
|
import com.mogo.map.marker.MogoMarkerOptions;
|
||||||
|
import com.mogo.map.marker.MogoMarkersHandler;
|
||||||
|
import com.mogo.map.overlay.AMapPolylineWrapper;
|
||||||
|
import com.mogo.map.overlay.IMogoPolyline;
|
||||||
|
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||||
|
import com.mogo.map.uicontroller.AMapUIController;
|
||||||
|
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||||
|
import com.mogo.map.utils.ObjectUtils;
|
||||||
|
import com.zhidaoauto.map.sdk.open.MapAutoApi;
|
||||||
|
import com.zhidaoauto.map.sdk.open.data.MapDataApi;
|
||||||
|
import com.zhidaoauto.map.sdk.open.data.SinglePointRoadInfo;
|
||||||
|
import com.zhidaoauto.map.sdk.open.marker.Marker;
|
||||||
|
import com.zhidaoauto.map.sdk.open.marker.MarkerHelper;
|
||||||
|
import com.zhidaoauto.map.sdk.open.marker.MarkerOptions;
|
||||||
|
import com.zhidaoauto.map.sdk.open.marker.MarkerSimpleData;
|
||||||
|
import com.zhidaoauto.map.sdk.open.marker.MultiPointOverlayOptions;
|
||||||
|
import com.zhidaoauto.map.sdk.open.poyline.Polyline;
|
||||||
|
import com.zhidaoauto.map.sdk.open.poyline.PolylineOptions;
|
||||||
|
import com.zhidaoauto.map.sdk.open.query.LonLatPoint;
|
||||||
|
import com.zhidaoauto.map.sdk.open.tools.MapTools;
|
||||||
|
import com.zhidaoauto.map.sdk.open.view.MapAutoView;
|
||||||
|
import com.zhidaoauto.map.sdk.open.view.MapAutoViewHelper;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import mogo.telematics.pad.MessagePad;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author congtaowang
|
||||||
|
* @since 2019-12-18
|
||||||
|
* <p>
|
||||||
|
* 代理自研AMap
|
||||||
|
*/
|
||||||
|
public class AMapWrapper implements IMogoMap {
|
||||||
|
|
||||||
|
private static final String TAG = "AMapWrapper";
|
||||||
|
|
||||||
|
private static MapAutoViewHelper sAMap;
|
||||||
|
private IMogoMapUIController mUIcontroller;
|
||||||
|
private MapAutoViewHelper mAMap;
|
||||||
|
private MapAutoView mMapView;
|
||||||
|
private IMogoUiSettings mUiSettings;
|
||||||
|
|
||||||
|
public AMapWrapper(MapAutoViewHelper map, MapAutoView mapView, IMogoMapUIController controller) {
|
||||||
|
Logger.i(TAG, "autoop--AMapWrapper: init" + this);
|
||||||
|
this.mAMap = map;
|
||||||
|
sAMap = map;
|
||||||
|
this.mMapView = mapView;
|
||||||
|
mUIcontroller = controller;
|
||||||
|
// 设置实现自定义 info window
|
||||||
|
MapAutoApi.INSTANCE.setInfoWindowAdapter(new AMapInfoWindowAdapter());
|
||||||
|
AMapUIController.getInstance().initClient(mUIcontroller);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MapAutoViewHelper getAMap() {
|
||||||
|
return sAMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IMogoUiSettings getUiSettings() {
|
||||||
|
if (!checkAMap()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (mUiSettings == null) {
|
||||||
|
mUiSettings = new AMapUiSettingsWrapper(mAMap);
|
||||||
|
}
|
||||||
|
return mUiSettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IMogoMapUIController getUIController() {
|
||||||
|
return mUIcontroller;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IMogoMarker addMarker(String tag, MogoMarkerOptions options) {
|
||||||
|
//Logger.i(TAG, "autoop-addMarker: " + tag + ",MogoMarkerOptions:" + options + ",AMap:" + (mAMap != null) + ",this:" + this);
|
||||||
|
if (!checkAMap()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
MarkerOptions markerOptions = ObjectUtils.fromMogo(options);
|
||||||
|
if (markerOptions == null) {
|
||||||
|
Logger.e(TAG, "marker参数为空");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
final IMogoMarker mogoMarker = new AMapMarkerWrapper(mAMap.addMarker(markerOptions), options);
|
||||||
|
if (options.isAutoManager()) {
|
||||||
|
MogoMarkersHandler.getInstance().add(tag, mogoMarker);
|
||||||
|
}
|
||||||
|
return mogoMarker;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateBatchMarkerPosition(ArrayList<MessagePad.TrackedObject> optionsArrayList) {
|
||||||
|
if (!checkAMap()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ArrayList<MarkerSimpleData> markerOptionsArrayList = new ArrayList<>();
|
||||||
|
for (MessagePad.TrackedObject mogoMarkerOptions : optionsArrayList) {
|
||||||
|
MarkerSimpleData markerOptions = ObjectUtils.fromTrafficData(mogoMarkerOptions);
|
||||||
|
if (markerOptions == null) {
|
||||||
|
Logger.e(TAG, "marker参数为空");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
markerOptionsArrayList.add(markerOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
MarkerHelper.INSTANCE.updateBatchMarkerPositon(markerOptionsArrayList,false,8.0f,0,100);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String addPreVehicleModel(int type, int modelRes) {
|
||||||
|
try {
|
||||||
|
return MarkerHelper.INSTANCE.addPreVehicleModel(type, modelRes);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeMarker(String uuidString) {
|
||||||
|
try {
|
||||||
|
MarkerHelper.INSTANCE.removeMarker(uuidString);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ArrayList<IMogoMarker> addMarkers(String tag, ArrayList<MogoMarkerOptions> options, boolean moveToCenter) {
|
||||||
|
if (!checkAMap()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options == null || options.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayList<Marker> markers = new ArrayList<>();
|
||||||
|
ArrayList<MarkerOptions> markerOptions = new ArrayList<>();
|
||||||
|
ArrayList<IMogoMarker> mogoMarkers = new ArrayList<>();
|
||||||
|
for (MogoMarkerOptions option : options) {
|
||||||
|
if (option == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
MarkerOptions mo = ObjectUtils.fromMogo(option);
|
||||||
|
if (mo == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
markerOptions.add(mo);
|
||||||
|
}
|
||||||
|
if (markerOptions.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
MultiPointOverlayOptions multiPointOverlayOptions = new MultiPointOverlayOptions();
|
||||||
|
multiPointOverlayOptions.setData(markerOptions);
|
||||||
|
multiPointOverlayOptions.setMarkerIcon(R.drawable.marker_blue);
|
||||||
|
List<MarkerOptions> data = mAMap.addMarkers(multiPointOverlayOptions).getOptions().getData();
|
||||||
|
for (int i = 0; i < data.size(); i++) {
|
||||||
|
markers.add(new Marker(data.get(i)));
|
||||||
|
}
|
||||||
|
if (markers == null || markers.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < markers.size(); i++) {
|
||||||
|
Marker marker = markers.get(i);
|
||||||
|
if (marker == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
mogoMarkers.add(new AMapMarkerWrapper(marker, options.get(i)));
|
||||||
|
}
|
||||||
|
MogoMarkersHandler.getInstance().add(tag, mogoMarkers);
|
||||||
|
return mogoMarkers;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clear() {
|
||||||
|
if (checkAMap()) {
|
||||||
|
mAMap.clearPanel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clear(boolean isKeepMyLocationOverlay) {
|
||||||
|
if (checkAMap()) {
|
||||||
|
mAMap.clearPanel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPointToCenter(int x, int y) {
|
||||||
|
if (checkAMap()) {
|
||||||
|
LonLatPoint lonLatPoint = MapTools.INSTANCE.fromScreenLocation(new Point(x, y));
|
||||||
|
mAMap.setCenter(lonLatPoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTouchPoiEnable(boolean touchPoiEnable) {
|
||||||
|
if (checkAMap()) {
|
||||||
|
mAMap.setTouchPoiEnable(touchPoiEnable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTrafficEnable(boolean enable) {
|
||||||
|
if (checkAMap()) {
|
||||||
|
mAMap.setTraffic(enable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showBuildings(boolean enabled) {
|
||||||
|
if (checkAMap()) {
|
||||||
|
mAMap.showBuildings(enabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showIndoorMap(boolean enable) {
|
||||||
|
if (checkAMap()) {
|
||||||
|
// mAMap.showIndoorMap( enable );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showMapText(boolean enable) {
|
||||||
|
if (checkAMap()) {
|
||||||
|
mAMap.showMapText(enable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stopAnimation() {
|
||||||
|
if (checkAMap()) {
|
||||||
|
// mAMap.stopAnimation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getScalePerPixel() {
|
||||||
|
if (checkAMap()) {
|
||||||
|
return mAMap.getScalePerPixel();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void changeZoom(float zoom) {
|
||||||
|
Logger.d(TAG, "changeZoom %s", zoom);
|
||||||
|
if (checkAMap()) {
|
||||||
|
mAMap.setZoom((int) zoom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getZoomLevel() {
|
||||||
|
if (checkAMap()) {
|
||||||
|
try {
|
||||||
|
return mAMap.getZoom();
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IMogoPolyline addPolyline(MogoPolylineOptions options) {
|
||||||
|
if (checkAMap()) {
|
||||||
|
PolylineOptions polylineOptions = ObjectUtils.fromMogo(options);
|
||||||
|
Logger.d(TAG, "addPolyline %s", polylineOptions.toString());
|
||||||
|
if (polylineOptions == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
Polyline polyline = null;
|
||||||
|
if (polylineOptions.getLineWidth() > 0) {
|
||||||
|
polyline = mAMap.drawThickLine(polylineOptions);
|
||||||
|
} else {
|
||||||
|
polyline = mAMap.drawLine(polylineOptions);
|
||||||
|
}
|
||||||
|
return new AMapPolylineWrapper(polyline, options);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMapVersion() {
|
||||||
|
return MapAutoApi.INSTANCE.getSDKVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean checkAMap() {
|
||||||
|
mAMap = mMapView.getMapAutoViewHelper();
|
||||||
|
sAMap = mAMap;
|
||||||
|
if (mAMap == null) {
|
||||||
|
Logger.e(TAG, "自研map实例为空,请检查");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK) {
|
||||||
|
SinglePointRoadInfo singlePointRoadInfo = MapDataApi.INSTANCE.getSinglePointMatchRoad(lon, lat, angle, isGpsLocation, isRTK);
|
||||||
|
|
||||||
|
return singlePointRoadInfo != null ? singlePointRoadInfo.getLaneWidth() : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Context getContext() {
|
||||||
|
return mMapView.getContext();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
package com.mogo.map;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||||
|
import com.mogo.map.location.ALocationClient;
|
||||||
|
import com.mogo.map.location.IMogoLocationClient;
|
||||||
|
import com.mogo.map.search.GeocodeSearchClient;
|
||||||
|
import com.mogo.map.search.PoiSearchClient;
|
||||||
|
import com.mogo.map.search.geo.IMogoGeoSearch;
|
||||||
|
import com.mogo.map.search.poisearch.IMogoPoiSearch;
|
||||||
|
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
|
||||||
|
import com.mogo.map.search.traffic.IMogoTrafficSearch;
|
||||||
|
import com.mogo.map.uicontroller.AMapUIController;
|
||||||
|
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||||
|
import com.zhidaoauto.map.sdk.open.MapAutoApi;
|
||||||
|
import com.zhidaoauto.map.sdk.open.MapParams;
|
||||||
|
import com.zhidaoauto.map.sdk.open.view.MapAutoView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author congtaowang
|
||||||
|
* @since 2020/12/9
|
||||||
|
* <p>
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
@Route(path = MapApiPath.PATH)
|
||||||
|
public class CustomMapApiBuilder implements IMogoMapApiBuilder {
|
||||||
|
|
||||||
|
private static final String TAG = "CustomMapApiBuilder";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IMogoGeoSearch getGeoSearch(Context context) {
|
||||||
|
return new GeocodeSearchClient(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IMogoLocationClient getLocationClient(Context context) {
|
||||||
|
return new ALocationClient(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IMogoMapUIController getMapUIController() {
|
||||||
|
return AMapUIController.getInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IMogoPoiSearch getPoiSearchClient(Context context, MogoPoiSearchQuery query) {
|
||||||
|
return new PoiSearchClient(context, query);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IMogoMapView getMapView(Context context) {
|
||||||
|
Log.d(TAG, "setDebugMode==true");
|
||||||
|
MapParams mapParams = MapParams.Companion.init();
|
||||||
|
mapParams.setDebugMode(false)
|
||||||
|
//todo 1-使用本地地图数据,0-使用在线地图数据
|
||||||
|
//.setDataFileSource(1)
|
||||||
|
.setCoordinateType(MapParams.COORDINATETYPE_GCJ02)
|
||||||
|
.setPerspectiveMode(MapParams.MAP_PERSPECTIVE_3D)
|
||||||
|
// .setZoom( 20 )
|
||||||
|
// .setPointToCenter( 0.734375f, 0.5f )
|
||||||
|
//todo 2D模式下需要注意ADAS部分遮挡
|
||||||
|
.setPointToCenter(0.5f, 0.5f)
|
||||||
|
.setStyleMode(MapParams.MAP_STYLE_VR);
|
||||||
|
|
||||||
|
MapAutoApi.INSTANCE.init(context, mapParams);
|
||||||
|
MapAutoView mapAutoView = new MapAutoView(context);
|
||||||
|
//mapAutoView.registerRenderListener(l -> Log.i(TAG, "renderTime: " + l));
|
||||||
|
IMogoMapView mapView = new AMapViewWrapper(mapAutoView);
|
||||||
|
return mapView;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IMogoTrafficSearch getTrafficSearch() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void destroy() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(Context context) {
|
||||||
|
Logger.d(TAG, "init");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.mogo.map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author congtaowang
|
||||||
|
* @since 2020-04-10
|
||||||
|
* <p>
|
||||||
|
* 拦截器
|
||||||
|
*/
|
||||||
|
public interface Interrupter {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否拦截
|
||||||
|
* @return true - 拦截, false - 不拦截
|
||||||
|
*/
|
||||||
|
boolean interrupt();
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.mogo.map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author congtaowang
|
||||||
|
* @since 2020-04-10
|
||||||
|
* <p>
|
||||||
|
* 地图视图中心点
|
||||||
|
*/
|
||||||
|
public class MapCenterPoint {
|
||||||
|
|
||||||
|
public final double x;
|
||||||
|
public final double y;
|
||||||
|
|
||||||
|
public MapCenterPoint( double x, double y ) {
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,187 @@
|
|||||||
|
package com.mogo.map;
|
||||||
|
|
||||||
|
|
||||||
|
import com.mogo.commons.debug.DebugConfig;
|
||||||
|
import com.zhidaoauto.map.sdk.open.location.MogoLocation;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public
|
||||||
|
/**
|
||||||
|
* @author congtaowang
|
||||||
|
* @since 2020/12/25
|
||||||
|
*
|
||||||
|
* 地图样式控制
|
||||||
|
*/
|
||||||
|
class MapStyleController {
|
||||||
|
|
||||||
|
|
||||||
|
private static volatile MapStyleController sInstance;
|
||||||
|
|
||||||
|
private boolean mIsInVrMode = false;
|
||||||
|
|
||||||
|
private List< VrAreaFilter > mVrAreaFilters = new ArrayList<>();
|
||||||
|
|
||||||
|
private MapStyleController() {
|
||||||
|
mVrAreaFilters.add( new ShunYiArea() );
|
||||||
|
mVrAreaFilters.add( new OCHArea() );
|
||||||
|
// mVrAreaFilters.add( new HuiXinXiJieArea() );
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MapStyleController getInstance() {
|
||||||
|
if ( sInstance == null ) {
|
||||||
|
synchronized ( MapStyleController.class ) {
|
||||||
|
if ( sInstance == null ) {
|
||||||
|
sInstance = new MapStyleController();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void release() {
|
||||||
|
sInstance = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Object readResolve() {
|
||||||
|
// 阻止反序列化,必须实现 Serializable 接口
|
||||||
|
return sInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onLocationChanged( MogoLocation location, IMapStyleAutoChangedListener listener ) {
|
||||||
|
if ( location == null ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 网约车不自动切换vr、2d模式
|
||||||
|
if ( DebugConfig.isOCHModule() ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean isInVrMode = false;
|
||||||
|
for ( VrAreaFilter vrAreaFilter : mVrAreaFilters ) {
|
||||||
|
if ( vrAreaFilter == null ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
isInVrMode |= vrAreaFilter.isVrArea( location );
|
||||||
|
if ( isInVrMode ) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( isInVrMode ) {
|
||||||
|
if ( !mIsInVrMode ) {
|
||||||
|
// 第一次进入 vr 区域,自动变为 vr 模式
|
||||||
|
mIsInVrMode = true;
|
||||||
|
if ( listener != null ) {
|
||||||
|
listener.onStyleAutoChanged( true );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ( mIsInVrMode ) {
|
||||||
|
// 驶出 vr 区域,自动变为 2d 模式
|
||||||
|
mIsInVrMode = false;
|
||||||
|
if ( listener != null ) {
|
||||||
|
listener.onStyleAutoChanged( false );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface IMapStyleAutoChangedListener {
|
||||||
|
void onStyleAutoChanged(boolean isVrMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface VrAreaFilter {
|
||||||
|
default boolean isVrArea(MogoLocation location) {
|
||||||
|
if ( location == null ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return location.getLat() > getLeftBottomLat() && location.getLon() > getLeftBottomLon()
|
||||||
|
&& location.getLat() < getRightTopLat() && location.getLon() < getRightTopLon();
|
||||||
|
}
|
||||||
|
|
||||||
|
double getLeftBottomLat();
|
||||||
|
|
||||||
|
double getLeftBottomLon();
|
||||||
|
|
||||||
|
double getRightTopLat();
|
||||||
|
|
||||||
|
double getRightTopLon();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ShunYiArea implements VrAreaFilter {
|
||||||
|
|
||||||
|
// 顺义一期高精地图范围(目前圈定了一个矩形区域,认为都是高精地图区域)
|
||||||
|
private final double leftBottomLat = 40.18728;
|
||||||
|
private final double leftBottomLon = 116.71194;
|
||||||
|
private final double rightTopLat = 40.20671;
|
||||||
|
private final double rightTopLon = 116.74804;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getLeftBottomLat() {
|
||||||
|
return leftBottomLat;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getLeftBottomLon() {
|
||||||
|
return leftBottomLon;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getRightTopLat() {
|
||||||
|
return rightTopLat;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getRightTopLon() {
|
||||||
|
return rightTopLon;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class OCHArea implements VrAreaFilter {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getLeftBottomLat() {
|
||||||
|
return 39.97645;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getLeftBottomLon() {
|
||||||
|
return 116.41673;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getRightTopLat() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getRightTopLon() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class HuiXinXiJieArea implements VrAreaFilter {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getLeftBottomLat() {
|
||||||
|
return 39.96741320378243;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getLeftBottomLon() {
|
||||||
|
return 116.41045709250723;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getRightTopLat() {
|
||||||
|
return 39.98232698552779;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getRightTopLon() {
|
||||||
|
return 116.41879656379113;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
package com.mogo.map;
|
||||||
|
|
||||||
|
import com.zhidaoauto.map.sdk.open.query.LonLatPoint;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 道路数据缓存
|
||||||
|
*
|
||||||
|
* @author tongchenfei
|
||||||
|
*/
|
||||||
|
public class RoadCacheWrapper {
|
||||||
|
private List<LonLatPoint> road;
|
||||||
|
private double lastDistanceDiff;
|
||||||
|
private int roadLength = -1;
|
||||||
|
|
||||||
|
private float laneWidth = -1;
|
||||||
|
|
||||||
|
public RoadCacheWrapper(List<LonLatPoint> road) {
|
||||||
|
setRoad(road);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<LonLatPoint> getRoad() {
|
||||||
|
return road;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoad(List<LonLatPoint> road) {
|
||||||
|
this.road = road;
|
||||||
|
if(road!=null) {
|
||||||
|
roadLength = road.size();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getLastDistanceDiff() {
|
||||||
|
return lastDistanceDiff;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastDistanceDiff(double lastDistanceDiff) {
|
||||||
|
this.lastDistanceDiff = lastDistanceDiff;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getLastLat(){
|
||||||
|
if (roadLength != -1) {
|
||||||
|
return road.get(roadLength - 1).getLatitude();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getLastLon(){
|
||||||
|
if (roadLength != -1) {
|
||||||
|
return road.get(roadLength - 1).getLongitude();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getLaneWidth() {
|
||||||
|
return laneWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLaneWidth(float laneWidth) {
|
||||||
|
this.laneWidth = laneWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean inCache(double lon, double lat) {
|
||||||
|
if (roadLength > 0) {
|
||||||
|
LonLatPoint start = road.get(0);
|
||||||
|
LonLatPoint end = road.get(roadLength - 1);
|
||||||
|
boolean latInRoad = false;
|
||||||
|
boolean lonInRoad = false;
|
||||||
|
if (start.getLatitude() > end.getLatitude()) {
|
||||||
|
latInRoad = lat <= start.getLatitude() && lat >= end.getLatitude();
|
||||||
|
}else{
|
||||||
|
latInRoad = lat >= start.getLatitude() && lat <= end.getLatitude();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (start.getLongitude() > end.getLongitude()) {
|
||||||
|
lonInRoad = lon <= start.getLongitude() && lon >= end.getLongitude();
|
||||||
|
}else{
|
||||||
|
lonInRoad = lon >= start.getLongitude() && lon <= end.getLongitude();
|
||||||
|
}
|
||||||
|
|
||||||
|
return latInRoad && lonInRoad;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
55
libraries/mogo-map/src/main/java/com/mogo/map/Scene.java
Normal file
55
libraries/mogo-map/src/main/java/com/mogo/map/Scene.java
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
package com.mogo.map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author congtaowang
|
||||||
|
* @since 2020-04-10
|
||||||
|
* <p>
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
public interface Scene {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 普通场景
|
||||||
|
*/
|
||||||
|
int COMMON = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选点
|
||||||
|
*/
|
||||||
|
int CHOOSE_POINT = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导航
|
||||||
|
*/
|
||||||
|
int NAVI = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导航 vs 道路事件
|
||||||
|
*/
|
||||||
|
int NAVI_WITH_ROAD_EVENT = 21;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 巡航
|
||||||
|
*/
|
||||||
|
int AIMLESS = 3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 巡航 vs 道路事件
|
||||||
|
*/
|
||||||
|
int AIMLESS_WITH_ROAD_EVENT = 31;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路线规划
|
||||||
|
*/
|
||||||
|
int CALCULATE_PATH = 4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分类搜索
|
||||||
|
*/
|
||||||
|
int CATEGORY_SEARCH = 5;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* V2X触发了预警场景
|
||||||
|
*/
|
||||||
|
int CATEGORY_V2X_EVENT = 6;
|
||||||
|
}
|
||||||
@@ -0,0 +1,150 @@
|
|||||||
|
package com.mogo.map.location;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Trace;
|
||||||
|
|
||||||
|
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||||
|
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager;
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||||
|
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||||
|
import com.mogo.map.utils.ObjectUtils;
|
||||||
|
import com.zhidaoauto.map.sdk.open.location.LocationClient;
|
||||||
|
import com.zhidaoauto.map.sdk.open.location.LocationListener;
|
||||||
|
import com.zhidaoauto.map.sdk.open.location.RTKAutopilotLocationBean;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author congtaowang
|
||||||
|
* @since 2019-12-19
|
||||||
|
* <p>
|
||||||
|
* 自研定位
|
||||||
|
*/
|
||||||
|
public class ALocationClient implements IMogoLocationClient {
|
||||||
|
|
||||||
|
private static final String TAG = "ALocationClient";
|
||||||
|
|
||||||
|
private MogoLocation mLastLocation;
|
||||||
|
private final LocationListener mListener = new InternalLocationListener();
|
||||||
|
|
||||||
|
private boolean mIsDestroyed = false;
|
||||||
|
|
||||||
|
public ALocationClient( Context context ) {
|
||||||
|
mClient = new LocationClient( context );
|
||||||
|
mClient.registerListener( mListener );
|
||||||
|
mLastLocation = ObjectUtils.fromLocation( mClient.getLastKnownMogoLocation() );
|
||||||
|
if ( mLastLocation == null ) {
|
||||||
|
mLastLocation = new MogoLocation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private LocationClient mClient;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start() {
|
||||||
|
start( 2_000L );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start( long interval ) {
|
||||||
|
if ( mIsDestroyed ) {
|
||||||
|
destroyWarming();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ( mClient != null ) {
|
||||||
|
mClient.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stop() {
|
||||||
|
if ( mIsDestroyed ) {
|
||||||
|
destroyWarming();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ( mClient != null && mClient.isAGpsStarted() ) {
|
||||||
|
mClient.stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addLocationListener( IMogoLocationListener listener ) {
|
||||||
|
// do not impl.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeLocationListener( IMogoLocationListener listener ) {
|
||||||
|
// do not impl.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MogoLocation getLastKnowLocation() {
|
||||||
|
if ( mIsDestroyed ) {
|
||||||
|
destroyWarming();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return mLastLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public synchronized void destroy() {
|
||||||
|
mIsDestroyed = true;
|
||||||
|
if ( mClient != null ) {
|
||||||
|
mClient.unRegisterListener( mListener );
|
||||||
|
mClient.destory();
|
||||||
|
}
|
||||||
|
mClient = null;
|
||||||
|
mLastLocation = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class InternalLocationListener implements LocationListener {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLocationChanged( @NotNull com.zhidaoauto.map.sdk.open.location.MogoLocation location ) {
|
||||||
|
if ( mIsDestroyed ) {
|
||||||
|
destroyWarming();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ( location == null ||
|
||||||
|
location.getLat() == 0.0D ||
|
||||||
|
location.getLon() == 0.0D ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Trace.beginSection( "timer.onLocationChanged" );
|
||||||
|
mLastLocation = ObjectUtils.fromLocation( location );
|
||||||
|
UiThreadHandler.post(() -> CallerMapLocationListenerManager.INSTANCE.invokeMapLocationChangeListener(mLastLocation));
|
||||||
|
|
||||||
|
Set< IMogoLocationListener > listeners = MogoLocationListenerRegister.getInstance().getListeners();
|
||||||
|
synchronized ( listeners ) {
|
||||||
|
Iterator< IMogoLocationListener > listenerIterator = listeners.iterator();
|
||||||
|
while ( listenerIterator.hasNext() ) {
|
||||||
|
listenerIterator.next().onLocationChanged( mLastLocation.clone() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Trace.endSection();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void destroyWarming() {
|
||||||
|
CallerLogger.INSTANCE.w( TAG, "location client has destroyed." );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateLocation(Object locationToUpdate) {
|
||||||
|
if (locationToUpdate == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (locationToUpdate instanceof MogoLocation) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (locationToUpdate instanceof RTKAutopilotLocationBean) {
|
||||||
|
RTKAutopilotLocationBean current = (RTKAutopilotLocationBean) locationToUpdate;
|
||||||
|
if (mClient != null) {
|
||||||
|
mClient.updateRTKAutoPilotLocation(current);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package com.mogo.map.marker;
|
||||||
|
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import com.mogo.map.AMapMarkerClickHandler;
|
||||||
|
import com.zhidaoauto.map.sdk.open.abs.marker.InfoWindowAdapter;
|
||||||
|
import com.zhidaoauto.map.sdk.open.marker.Marker;
|
||||||
|
import com.zhidaoauto.map.sdk.open.marker.OnInfoWindowClickListener;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author congtaowang
|
||||||
|
* @since 2019-12-24
|
||||||
|
* <p>
|
||||||
|
* 自定义infowindow
|
||||||
|
*/
|
||||||
|
public final class AMapInfoWindowAdapter implements InfoWindowAdapter, OnInfoWindowClickListener {
|
||||||
|
|
||||||
|
public View getInfoWindow( Marker marker ) {
|
||||||
|
if ( marker.getMObject() instanceof IMogoMarker ) {
|
||||||
|
IMogoMarker mogoMarker = ( ( IMogoMarker ) marker.getMObject() );
|
||||||
|
IMogoInfoWindowAdapter delegate = mogoMarker.getInfoWindowAdapter();
|
||||||
|
if ( delegate != null ) {
|
||||||
|
final View infoView = delegate.getInfoWindow( mogoMarker );
|
||||||
|
marker.setOnInfoWindowClickListener( this );
|
||||||
|
return infoView;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onInfoWindowClick( @NotNull Marker marker ) {
|
||||||
|
AMapMarkerClickHandler.getInstance().handleMarkerClicked( marker );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View getInfoContents( @Nullable Marker marker ) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,595 @@
|
|||||||
|
package com.mogo.map.marker;
|
||||||
|
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.Point;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.animation.Interpolator;
|
||||||
|
|
||||||
|
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||||
|
import com.mogo.map.marker.anim.OnMarkerAnimationListener;
|
||||||
|
import com.mogo.map.utils.ObjectUtils;
|
||||||
|
import com.zhidaoauto.map.sdk.open.abs.marker.MarkerAnimationListener;
|
||||||
|
import com.zhidaoauto.map.sdk.open.marker.Animation;
|
||||||
|
import com.zhidaoauto.map.sdk.open.marker.BitmapDescriptor;
|
||||||
|
import com.zhidaoauto.map.sdk.open.marker.BitmapDescriptorFactory;
|
||||||
|
import com.zhidaoauto.map.sdk.open.marker.Marker;
|
||||||
|
import com.zhidaoauto.map.sdk.open.marker.MarkerOptions;
|
||||||
|
import com.zhidaoauto.map.sdk.open.marker.MarkerScaleAnimation;
|
||||||
|
import com.zhidaoauto.map.sdk.open.marker.MarkerTranslateAnimation;
|
||||||
|
import com.zhidaoauto.map.sdk.open.query.LonLatPoint;
|
||||||
|
import com.zhidaoauto.map.sdk.open.tools.MapTools;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Observable;
|
||||||
|
import java.util.Observer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author congtaowang
|
||||||
|
* @since 2019-12-18
|
||||||
|
* <p>
|
||||||
|
* 自研marker
|
||||||
|
*/
|
||||||
|
public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||||
|
|
||||||
|
private final String TAG = AMapMarkerWrapper.class.getName();
|
||||||
|
|
||||||
|
private Marker mMarker;
|
||||||
|
private Object mObject;
|
||||||
|
private IMogoMarkerClickListener mMogoMarkerClickListener;
|
||||||
|
private IMogoInfoWindowAdapter mMogoInfoWindowAdapter;
|
||||||
|
|
||||||
|
private boolean mIsDestroy = false;
|
||||||
|
|
||||||
|
private MogoMarkerOptions mMogoMarkerOptions;
|
||||||
|
private String mOwner;
|
||||||
|
|
||||||
|
public AMapMarkerWrapper( Marker marker, MogoMarkerOptions mogoMarkerOptions ) {
|
||||||
|
this.mMarker = marker;
|
||||||
|
if ( marker != null ) {
|
||||||
|
// 设置自研 marker 的object对象为 IMogoMarker 实例。!!!!
|
||||||
|
marker.setMObject( this );
|
||||||
|
if ( !TextUtils.isEmpty( mogoMarkerOptions.getAnchorColor() ) ) {
|
||||||
|
marker.setAnchorColor( mogoMarkerOptions.getAnchorColor() );
|
||||||
|
}
|
||||||
|
MarkerWrapperClickHelper.getInstance().setMogoMarkerMap( marker.getId(), this );
|
||||||
|
}
|
||||||
|
setObject( mogoMarkerOptions.getObject() );
|
||||||
|
this.mMogoMarkerOptions = mogoMarkerOptions;
|
||||||
|
mMogoMarkerOptions.addObserver( this );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update( Observable o, Object arg ) {
|
||||||
|
if ( isDestroyed() ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setMarkerOptions( mMogoMarkerOptions );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void destroy() {
|
||||||
|
if ( mMogoMarkerOptions != null ) {
|
||||||
|
mMogoMarkerOptions.deleteObservers();
|
||||||
|
mMogoMarkerOptions = null;
|
||||||
|
}
|
||||||
|
if ( mMarker != null ) {
|
||||||
|
mMarker.remove();
|
||||||
|
mMarker.setMObject( null );
|
||||||
|
mMarker.setOnInfoWindowClickListener( null );
|
||||||
|
mMarker = null;
|
||||||
|
}
|
||||||
|
mMogoInfoWindowAdapter = null;
|
||||||
|
mMogoMarkerClickListener = null;
|
||||||
|
mObject = null;
|
||||||
|
mIsDestroy = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remove() {
|
||||||
|
destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void hideInfoWindow() {
|
||||||
|
if ( mMarker != null ) {
|
||||||
|
mMarker.hideInfoWindow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setAlpha( float alpha ) {
|
||||||
|
if ( mMarker != null ) {
|
||||||
|
mMarker.setAlpha( alpha );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setAnchor( float anchorU, float anchorV ) {
|
||||||
|
if ( mMarker != null ) {
|
||||||
|
mMarker.setAnchor( anchorU, anchorV );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setDraggable( boolean paramBoolean ) {
|
||||||
|
if ( mMarker != null ) {
|
||||||
|
mMarker.setDraggable( paramBoolean );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setIcon( Bitmap icon ) {
|
||||||
|
if ( icon == null || icon.isRecycled() ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ( mMarker != null ) {
|
||||||
|
mMarker.setIcon( icon );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setIcons( ArrayList< Bitmap > icons ) {
|
||||||
|
if ( icons == null || icons.isEmpty() ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ArrayList< BitmapDescriptor > descriptors = new ArrayList<>();
|
||||||
|
for ( Bitmap icon : icons ) {
|
||||||
|
if ( icon == null || icon.isRecycled() ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
descriptors.add( BitmapDescriptorFactory.INSTANCE.fromBitmap( icon ) );
|
||||||
|
}
|
||||||
|
if ( descriptors.isEmpty() ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ( mMarker != null ) {
|
||||||
|
mMarker.setIcons( descriptors );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setInfoWindowEnable( boolean enabled ) {
|
||||||
|
if ( mMarker != null ) {
|
||||||
|
if ( enabled ) {
|
||||||
|
mMarker.showInfoWindow();
|
||||||
|
} else {
|
||||||
|
mMarker.hideInfoWindow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMarkerOptions( MogoMarkerOptions opt ) {
|
||||||
|
|
||||||
|
final MarkerOptions options = ObjectUtils.fromMogo( opt );
|
||||||
|
if ( options == null ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ( mMarker != null ) {
|
||||||
|
mMarker.setMarkerOptions( options );
|
||||||
|
setObject( opt.getObject() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setObject( Object object ) {
|
||||||
|
mObject = object;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getObject() {
|
||||||
|
return mObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPeriod( int period ) {
|
||||||
|
if ( mMarker != null ) {
|
||||||
|
mMarker.setPeriod( period );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPosition( double lat, double lng ) {
|
||||||
|
if ( mMarker != null ) {
|
||||||
|
mMarker.setPosition( new LonLatPoint( lng, lat ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MogoLatLng getPosition() {
|
||||||
|
if ( mMarker != null ) {
|
||||||
|
final LonLatPoint latLng = mMarker.getPosition();
|
||||||
|
return ObjectUtils.fromAMap( latLng );
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setRotateAngle( float rotate ) {
|
||||||
|
if ( mMarker != null ) {
|
||||||
|
mMarker.setRotateAngle( rotate );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSnippet( String snippet ) {
|
||||||
|
if ( mMarker != null ) {
|
||||||
|
mMarker.setSnippet( snippet );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTitle( String title ) {
|
||||||
|
if ( mMarker != null ) {
|
||||||
|
mMarker.setTitle( title );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setToTop() {
|
||||||
|
if ( mMarker != null ) {
|
||||||
|
mMarker.setToTop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setVisible( boolean visible ) {
|
||||||
|
if ( mMarker != null ) {
|
||||||
|
mMarker.setVisible( visible );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setZIndex( int zIndex ) {
|
||||||
|
if ( mMarker != null ) {
|
||||||
|
mMarker.setZIndex( zIndex );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showInfoWindow() {
|
||||||
|
if ( mMarker != null ) {
|
||||||
|
mMarker.showInfoWindow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMarkerAssInfo() {
|
||||||
|
if ( mMarker != null ) {
|
||||||
|
return mMarker.getMarkeOptions().getAssInfo();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setOnMarkerClickListener( IMogoMarkerClickListener listener ) {
|
||||||
|
mMogoMarkerClickListener = listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IMogoMarkerClickListener getOnMarkerClickListener() {
|
||||||
|
return mMogoMarkerClickListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setInfoWindowAdapter( IMogoInfoWindowAdapter adapter ) {
|
||||||
|
mMogoInfoWindowAdapter = adapter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IMogoInfoWindowAdapter getInfoWindowAdapter() {
|
||||||
|
return mMogoInfoWindowAdapter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMarkerIconView( IMogoMarkerIconViewCreator creator ) {
|
||||||
|
if ( creator != null ) {
|
||||||
|
View iconView = creator.createView( this );
|
||||||
|
if ( iconView != null ) {
|
||||||
|
mMarker.setIcon( iconView );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDestroyed() {
|
||||||
|
return mIsDestroy;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setOwner( String mOwner ) {
|
||||||
|
this.mOwner = mOwner;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getOwner() {
|
||||||
|
if ( mOwner != null ) {
|
||||||
|
return mOwner;
|
||||||
|
}
|
||||||
|
if ( mMogoMarkerOptions != null ) {
|
||||||
|
return mMogoMarkerOptions.getOwner();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPositionByPixels( Point position ) {
|
||||||
|
if ( mMarker != null ) {
|
||||||
|
mMarker.setPosition( MapTools.INSTANCE.fromScreenLocation( position ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Marker getMarker() {
|
||||||
|
return mMarker;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MogoMarkerOptions getMogoMarkerOptions() {
|
||||||
|
return mMogoMarkerOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void startScaleAnimation( float fromX, float toX, float fromY, float toY, int duration, Interpolator interpolator ) {
|
||||||
|
if ( isDestroyed() ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
startScaleAnimation( fromX, toX, fromY, toY, duration, interpolator, null );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void startScaleAnimation(float fromX, float toX, float fromY, float toY, int duration, Interpolator interpolator, final OnMarkerAnimationListener listener ) {
|
||||||
|
if ( isDestroyed() ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MarkerScaleAnimation animationScale = new MarkerScaleAnimation( fromX, toX );
|
||||||
|
animationScale.setDuration( duration );
|
||||||
|
// animationScale.setFillMode(Animation.FILL_MODE_FORWARDS);
|
||||||
|
// animationScale.setInterpolator(interpolator);
|
||||||
|
animationScale.setAnimationListener( new MarkerAnimationListener() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationEnd( @NotNull Animation animation ) {
|
||||||
|
if ( isDestroyed() ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ( listener != null ) {
|
||||||
|
listener.onAnimEnd();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationRepeat( @NotNull Animation animation ) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationStart( @NotNull Animation animation ) {
|
||||||
|
if ( isDestroyed() ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ( listener != null ) {
|
||||||
|
listener.onAnimStart();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
mMarker.setMarkerScaleAnimation( animationScale );
|
||||||
|
mMarker.startAnimation();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void startJumpAnimation(float high, long duration, Interpolator interpolator, final OnMarkerAnimationListener listener ) {
|
||||||
|
if ( isDestroyed() || high <= 0.0f || interpolator == null || duration < 0 ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
final LonLatPoint latLng = ObjectUtils.fromMogo( getPosition() );
|
||||||
|
// Point point = AMapWrapper.getAMap().getProjection().toScreenLocation(latLng);
|
||||||
|
// point.y -= WindowUtils.dip2px(AbsMogoApplication.getApp(), high);
|
||||||
|
// LatLng target = AMapWrapper.getAMap().getProjection().fromScreenLocation(point);
|
||||||
|
//使用TranslateAnimation,填写一个需要移动的目标点
|
||||||
|
MarkerTranslateAnimation animation = new MarkerTranslateAnimation( latLng );
|
||||||
|
// animation.setInterpolator(interpolator);
|
||||||
|
animation.setAnimationListener( new MarkerAnimationListener() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationEnd( @NotNull Animation animation ) {
|
||||||
|
if ( isDestroyed() ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ( listener != null ) {
|
||||||
|
listener.onAnimEnd();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationRepeat( @NotNull Animation animation ) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationStart( @NotNull Animation animation ) {
|
||||||
|
if ( isDestroyed() ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ( listener != null ) {
|
||||||
|
listener.onAnimStart();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
//整个移动所需要的时间
|
||||||
|
animation.setDuration( duration * 1000 );
|
||||||
|
//设置动画
|
||||||
|
mMarker.setTranslateAnimation( animation );
|
||||||
|
mMarker.startAnimation();
|
||||||
|
} catch ( Exception e ) {
|
||||||
|
Logger.e( TAG, e, "error." );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setClickable( boolean clickable ) {
|
||||||
|
if ( mMarker != null ) {
|
||||||
|
mMarker.setClickable( clickable );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void startSmooth( List< MogoLatLng > points, int duration ) {
|
||||||
|
startSmoothInMs( points, duration * 1000 );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void startSmoothInMs( List< MogoLatLng > points, long duration ) {
|
||||||
|
if ( isDestroyed() ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( mMarker == null ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( points == null || points.isEmpty() ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayList< LonLatPoint > newPoints = new ArrayList<>();
|
||||||
|
for ( int i = 0; i < points.size(); i++ ) {
|
||||||
|
LonLatPoint point = ObjectUtils.fromMogo( points.get( i ) );
|
||||||
|
if ( point == null ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
newPoints.add( point );
|
||||||
|
}
|
||||||
|
if ( newPoints.isEmpty() ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mMarker.startSmooth( newPoints, ( int ) duration );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void startScaleAnimationWithAlpha( float fromX, float toX, float fromY, float toY, float fromAlpha, float toAlpha, int duration, Interpolator interpolator, OnMarkerAnimationListener listener ) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isInfoWindowShowing() {
|
||||||
|
return mMarker.isInfoWindowShown();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setGps( boolean isGps ) {
|
||||||
|
if ( mMarker != null ) {
|
||||||
|
mMarker.setGps( isGps );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String use3DResource( int model3D ) {
|
||||||
|
try {
|
||||||
|
mMarker.marker3DIcon( model3D );
|
||||||
|
return mMarker.getMarkeOptions().getMarkerIconName();
|
||||||
|
} catch ( Exception e ) {
|
||||||
|
Logger.e( TAG, e, "use3DResource" );
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void use3DResource( String resName ) {
|
||||||
|
try {
|
||||||
|
mMarker.getMarkeOptions().setVrIcon( true );
|
||||||
|
mMarker.setMarkerOptions( mMarker.getMarkeOptions().setMarkerIconName( resName ) );
|
||||||
|
} catch ( Exception e ) {
|
||||||
|
Logger.e( TAG, e, "use3DResource" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void use2DResource( String resName ) {
|
||||||
|
try {
|
||||||
|
mMarker.getMarkeOptions().setVrIcon( false );
|
||||||
|
mMarker.setMarkerOptions( mMarker.getMarkeOptions().setMarkerIconName( resName ) );
|
||||||
|
} catch ( Exception e ) {
|
||||||
|
Logger.e( TAG, e, "use3DResource" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String mLastAnchorColor = "";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setAnchorColor( String anchorColor ) {
|
||||||
|
if ( TextUtils.equals( mLastAnchorColor, anchorColor ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (mMogoMarkerOptions != null) {
|
||||||
|
mMogoMarkerOptions.anchorColor( anchorColor );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mMarker != null) {
|
||||||
|
mMarker.setAnchorColor( anchorColor );
|
||||||
|
}
|
||||||
|
mLastAnchorColor = anchorColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateInfoWindowView( View view ) {
|
||||||
|
try {
|
||||||
|
mMarker.setInfoWindowView( view );
|
||||||
|
} catch ( Exception e ) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateInfoWindowView( String viewResName ) {
|
||||||
|
try {
|
||||||
|
mMarker.setMarkerInfoName( viewResName );
|
||||||
|
} catch ( Exception e ) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setInfoWindowOffset( int offsetX, int offsetY ) {
|
||||||
|
try {
|
||||||
|
mMarker.setInfoWindowOffset( offsetX, offsetY );
|
||||||
|
} catch ( Exception e ) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addDynamicAnchorPosition( MogoLatLng latLng, float angle, long duration ) {
|
||||||
|
mMarker.addDynamicAnchorPostion( new LonLatPoint( latLng.lon, latLng.lat, angle ), System.currentTimeMillis(), ( int ) duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMarkerResName() {
|
||||||
|
if ( mMarker != null ) {
|
||||||
|
try {
|
||||||
|
return mMarker.getMarkeOptions().getMarkerIconName();
|
||||||
|
} catch ( Exception e ) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMarkerInfoResName() {
|
||||||
|
if ( mMarker != null ) {
|
||||||
|
try {
|
||||||
|
return mMarker.getMarkeOptions().getMarkerInfoName();
|
||||||
|
} catch ( Exception e ) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.mogo.map.marker;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class MarkerWrapperClickHelper {
|
||||||
|
|
||||||
|
private volatile static MarkerWrapperClickHelper markerWrapperClickHelper;
|
||||||
|
|
||||||
|
private final Map<String, IMogoMarker> mogoMarkerMap = new HashMap<>();
|
||||||
|
|
||||||
|
private MarkerWrapperClickHelper(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMogoMarkerMap(String id,IMogoMarker iMogoMarker){
|
||||||
|
if(isStaticMarker(id)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.mogoMarkerMap.put(id,iMogoMarker);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, IMogoMarker> getMogoMarkerMap() {
|
||||||
|
return mogoMarkerMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MarkerWrapperClickHelper getInstance(){
|
||||||
|
if (markerWrapperClickHelper == null) {
|
||||||
|
synchronized (MarkerWrapperClickHelper.class) {
|
||||||
|
if (markerWrapperClickHelper == null) {
|
||||||
|
markerWrapperClickHelper = new MarkerWrapperClickHelper();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return markerWrapperClickHelper;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isStaticMarker(String id){
|
||||||
|
return id.contains("traffic");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,195 @@
|
|||||||
|
package com.mogo.map.overlay;
|
||||||
|
|
||||||
|
|
||||||
|
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||||
|
import com.mogo.map.utils.ObjectUtils;
|
||||||
|
import com.zhidaoauto.map.sdk.open.poyline.Polyline;
|
||||||
|
import com.zhidaoauto.map.sdk.open.poyline.PolylineOptions;
|
||||||
|
import com.zhidaoauto.map.sdk.open.query.LonLatPoint;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author congtaowang
|
||||||
|
* @since 2020-03-10
|
||||||
|
* <p>
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
public class AMapPolylineWrapper implements IMogoPolyline {
|
||||||
|
|
||||||
|
private Polyline mPolyline;
|
||||||
|
private MogoPolylineOptions mOptions;
|
||||||
|
private boolean mIsDestroyed = false;
|
||||||
|
|
||||||
|
public AMapPolylineWrapper( Polyline mPolyline,
|
||||||
|
MogoPolylineOptions mOptions ) {
|
||||||
|
this.mPolyline = mPolyline;
|
||||||
|
this.mOptions = mOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void destroy() {
|
||||||
|
remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remove() {
|
||||||
|
if ( mPolyline != null ) {
|
||||||
|
mPolyline.remove();
|
||||||
|
}
|
||||||
|
mIsDestroyed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getId() {
|
||||||
|
if ( mPolyline != null ) {
|
||||||
|
return mPolyline.getId();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPoints( List< MogoLatLng > lonLats ) {
|
||||||
|
if ( lonLats == null || lonLats.isEmpty() ) {
|
||||||
|
mPolyline.setPoints( new ArrayList<LonLatPoint>() );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ArrayList< LonLatPoint > points = new ArrayList<>();
|
||||||
|
for ( MogoLatLng lonLat : lonLats ) {
|
||||||
|
LonLatPoint latLng = ObjectUtils.fromMogo( lonLat );
|
||||||
|
if ( latLng == null ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
points.add( latLng );
|
||||||
|
}
|
||||||
|
mPolyline.setPoints( points );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List< MogoLatLng > getPoints() {
|
||||||
|
if ( mPolyline == null ) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
ArrayList< MogoLatLng > lonLats = new ArrayList<>();
|
||||||
|
List<LonLatPoint> points = mPolyline.getPoints();
|
||||||
|
if ( points != null ) {
|
||||||
|
for ( LonLatPoint latLng : points ) {
|
||||||
|
MogoLatLng lonLat = ObjectUtils.fromAMap( latLng );
|
||||||
|
if ( lonLat == null ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
lonLats.add( lonLat );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return lonLats;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setGeodesic( boolean draw ) {
|
||||||
|
if ( mPolyline != null ) {
|
||||||
|
mPolyline.setGeodesic( draw );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isGeodesic() {
|
||||||
|
return mPolyline == null ? false : mPolyline.isGeodesic();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setDottedLine( boolean dottedLine ) {
|
||||||
|
if ( mPolyline != null ) {
|
||||||
|
mPolyline.setDottedLine( dottedLine );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDottedLine() {
|
||||||
|
return mPolyline == null ? false : mPolyline.isDottedLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setWidth( float width ) {
|
||||||
|
if ( mPolyline != null ) {
|
||||||
|
mPolyline.setWidth( width );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getWidth() {
|
||||||
|
if ( mPolyline != null ) {
|
||||||
|
return mPolyline.getWidth();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setColor( int color ) {
|
||||||
|
if ( mPolyline != null ) {
|
||||||
|
mPolyline.setColor( color );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getColor() {
|
||||||
|
if ( mPolyline != null ) {
|
||||||
|
return mPolyline.getColor();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setZIndex( float zIndex ) {
|
||||||
|
if ( mPolyline != null ) {
|
||||||
|
mPolyline.setZIndex( zIndex );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getZIndex() {
|
||||||
|
if ( mPolyline != null ) {
|
||||||
|
return mPolyline.getZIndex();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setVisible( boolean visible ) {
|
||||||
|
if ( mPolyline != null ) {
|
||||||
|
mPolyline.setVisible( visible );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isVisible() {
|
||||||
|
if ( mPolyline != null ) {
|
||||||
|
return mPolyline.isVisible();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTransparency( float transparency ) {
|
||||||
|
if ( mPolyline != null ) {
|
||||||
|
mPolyline.setTransparency( transparency );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setOption( MogoPolylineOptions option ) {
|
||||||
|
PolylineOptions target = ObjectUtils.fromMogo( option );
|
||||||
|
if ( target == null ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mOptions = option;
|
||||||
|
if ( mPolyline != null ) {
|
||||||
|
mPolyline.setOption( target );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDestroyed() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,109 @@
|
|||||||
|
package com.mogo.map.search;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.mogo.map.exception.MogoMapException;
|
||||||
|
import com.mogo.map.search.geo.IMogoGeoSearch;
|
||||||
|
import com.mogo.map.search.geo.IMogoGeoSearchListener;
|
||||||
|
import com.mogo.map.search.geo.MogoGeocodeAddress;
|
||||||
|
import com.mogo.map.search.geo.MogoRegeocodeAddress;
|
||||||
|
import com.mogo.map.search.geo.query.MogoGeocodeQuery;
|
||||||
|
import com.mogo.map.search.geo.query.MogoRegeocodeQuery;
|
||||||
|
import com.mogo.map.utils.ObjectUtils;
|
||||||
|
import com.zhidaoauto.map.sdk.open.query.GeocodeAddress;
|
||||||
|
import com.zhidaoauto.map.sdk.open.query.GeocodeResult;
|
||||||
|
import com.zhidaoauto.map.sdk.open.query.GeocodeSearch;
|
||||||
|
import com.zhidaoauto.map.sdk.open.query.OnGeocodeSearchListener;
|
||||||
|
import com.zhidaoauto.map.sdk.open.query.RegeocodeAddress;
|
||||||
|
import com.zhidaoauto.map.sdk.open.query.RegeocodeResult;
|
||||||
|
import com.zhidaoauto.map.sdk.open.query.RegeocodeQuery;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author congtaowang
|
||||||
|
* @since 2019-12-19
|
||||||
|
* <p>
|
||||||
|
* 地理编码/逆地理编码自研实现
|
||||||
|
*/
|
||||||
|
public class GeocodeSearchClient implements IMogoGeoSearch, OnGeocodeSearchListener {
|
||||||
|
|
||||||
|
private GeocodeSearch mClient;
|
||||||
|
private IMogoGeoSearchListener mListener;
|
||||||
|
|
||||||
|
public GeocodeSearchClient( Context context ) {
|
||||||
|
mClient = new GeocodeSearch( context );
|
||||||
|
mClient.setOnGeocodeSearchListener( this );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setGeoSearchListener( IMogoGeoSearchListener listener ) {
|
||||||
|
mListener = listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MogoRegeocodeAddress getFromLocation( MogoRegeocodeQuery query ) throws MogoMapException {
|
||||||
|
try {
|
||||||
|
RegeocodeQuery regeocodeQuery = ObjectUtils.fromMogo(query);
|
||||||
|
RegeocodeAddress regeocodeAddress = mClient.getFromLocation(regeocodeQuery);
|
||||||
|
return ObjectUtils.fromAMap( regeocodeAddress );
|
||||||
|
} catch ( Exception e ) {
|
||||||
|
throw new MogoMapException( e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List< MogoGeocodeAddress > getFromLocationName( MogoGeocodeQuery query ) throws MogoMapException {
|
||||||
|
try {
|
||||||
|
List<GeocodeAddress> geocodeAddress = mClient.getFromLocationName( ObjectUtils.fromMogo( query ) );
|
||||||
|
if ( geocodeAddress != null ) {
|
||||||
|
List< MogoGeocodeAddress > mogoGeocodeAddresses = new ArrayList<>();
|
||||||
|
for ( GeocodeAddress address : geocodeAddress ) {
|
||||||
|
MogoGeocodeAddress mogoGeocodeAddress = ObjectUtils.fromAMap( address );
|
||||||
|
if ( mogoGeocodeAddress != null ) {
|
||||||
|
mogoGeocodeAddresses.add( mogoGeocodeAddress );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return mogoGeocodeAddresses;
|
||||||
|
}
|
||||||
|
return new ArrayList<>();
|
||||||
|
} catch ( Exception e ) {
|
||||||
|
throw new MogoMapException( e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getFromLocationAsyn( MogoRegeocodeQuery query ) {
|
||||||
|
if ( mClient != null ) {
|
||||||
|
mClient.getFromLocationAsyn( ObjectUtils.fromMogo( query ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getFromLocationNameAsyn( MogoGeocodeQuery query ) {
|
||||||
|
if ( mClient != null ) {
|
||||||
|
mClient.getFromLocationNameAsyn( ObjectUtils.fromMogo( query ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRegeocodeSearched(RegeocodeResult regeocodeResult, int i ) {
|
||||||
|
if ( mListener != null ) {
|
||||||
|
mListener.onRegeocodeSearched( ObjectUtils.fromAMap( regeocodeResult ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onGeocodeSearched(GeocodeResult geocodeResult, int i ) {
|
||||||
|
if ( mListener != null ) {
|
||||||
|
mListener.onGeocodeSearched( ObjectUtils.fromAMap( geocodeResult ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void destroy() {
|
||||||
|
mClient = null;
|
||||||
|
mListener = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
package com.mogo.map.search;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||||
|
import com.mogo.map.search.inputtips.IMogoInputtipsListener;
|
||||||
|
import com.mogo.map.search.inputtips.IMogoInputtipsSearch;
|
||||||
|
import com.mogo.map.search.inputtips.MogoTip;
|
||||||
|
import com.mogo.map.search.inputtips.query.MogoInputtipsQuery;
|
||||||
|
import com.mogo.map.utils.ObjectUtils;
|
||||||
|
import com.zhidaoauto.map.sdk.open.query.Inputtips;
|
||||||
|
import com.zhidaoauto.map.sdk.open.query.InputtipsListener;
|
||||||
|
import com.zhidaoauto.map.sdk.open.query.InputtipsQuery;
|
||||||
|
import com.zhidaoauto.map.sdk.open.query.Tip;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author congtaowang
|
||||||
|
* @since 2019-12-20
|
||||||
|
* <p>
|
||||||
|
* 自研地图 inputtips搜索实现
|
||||||
|
*/
|
||||||
|
public class InputtipsSearch implements IMogoInputtipsSearch, InputtipsListener {
|
||||||
|
|
||||||
|
private static final String TAG = "InputtipsSearch";
|
||||||
|
|
||||||
|
private Inputtips mClient;
|
||||||
|
private InputtipsQuery mQuery;
|
||||||
|
private IMogoInputtipsListener mListener;
|
||||||
|
|
||||||
|
public InputtipsSearch(Context context, MogoInputtipsQuery query) {
|
||||||
|
mQuery = ObjectUtils.fromMogo(query);
|
||||||
|
mClient = new Inputtips(context, mQuery);
|
||||||
|
mClient.setInputtipsListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setQuery(MogoInputtipsQuery query) {
|
||||||
|
this.mQuery = ObjectUtils.fromMogo(query);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setInputtipsListener(IMogoInputtipsListener listener) {
|
||||||
|
this.mListener = listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void requestInputtipsAsyn() {
|
||||||
|
if (mClient != null) {
|
||||||
|
mClient.requestInputtipsAsyn();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onGetInputtips(List list, int i) {
|
||||||
|
if (i == 0) {
|
||||||
|
if (mListener != null) {
|
||||||
|
mListener.onGetInputtips(getResult(list));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Logger.e(TAG, "errorcode = " + i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<MogoTip> getResult(List<Tip> tips) {
|
||||||
|
List<MogoTip> mogoTips = new ArrayList<>();
|
||||||
|
if (tips != null) {
|
||||||
|
//只添加有坐标的结果
|
||||||
|
for (Tip tip : tips) {
|
||||||
|
MogoTip mogoTip = ObjectUtils.fromAMap(tip);
|
||||||
|
if (mogoTip != null && mogoTip.getPoint() != null) {
|
||||||
|
mogoTips.add(mogoTip);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return mogoTips;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void destroy() {
|
||||||
|
mClient = null;
|
||||||
|
mListener = null;
|
||||||
|
mQuery = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,142 @@
|
|||||||
|
package com.mogo.map.search;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||||
|
import com.mogo.map.exception.MogoMapException;
|
||||||
|
import com.mogo.map.search.geo.MogoPoiItem;
|
||||||
|
import com.mogo.map.search.poisearch.IMogoPoiSearch;
|
||||||
|
import com.mogo.map.search.poisearch.IMogoPoiSearchListener;
|
||||||
|
import com.mogo.map.search.poisearch.MogoPoiResult;
|
||||||
|
import com.mogo.map.search.poisearch.MogoSearchBound;
|
||||||
|
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
|
||||||
|
import com.mogo.map.utils.ObjectUtils;
|
||||||
|
import com.zhidaoauto.map.sdk.open.query.OnPoiSearchListener;
|
||||||
|
import com.zhidaoauto.map.sdk.open.query.PoiItem;
|
||||||
|
import com.zhidaoauto.map.sdk.open.query.PoiSearch;
|
||||||
|
import com.zhidaoauto.map.sdk.open.query.PoiSearchResult;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author congtaowang
|
||||||
|
* @since 2019-12-24
|
||||||
|
* <p>
|
||||||
|
* poi搜索自研实现
|
||||||
|
* <p>
|
||||||
|
* 错误码对照表:https://lbs.amap.com/api/android-sdk/guide/map-tools/error-code
|
||||||
|
*/
|
||||||
|
public class PoiSearchClient implements IMogoPoiSearch, OnPoiSearchListener {
|
||||||
|
|
||||||
|
private static final String TAG = "PoiSearchClient";
|
||||||
|
|
||||||
|
private MogoPoiSearchQuery mQuery;
|
||||||
|
private PoiSearch mClient;
|
||||||
|
private IMogoPoiSearchListener mListener;
|
||||||
|
private MogoSearchBound mBound;
|
||||||
|
|
||||||
|
public PoiSearchClient( Context context, MogoPoiSearchQuery query ) {
|
||||||
|
try {
|
||||||
|
mQuery = query;
|
||||||
|
mClient = new PoiSearch( context, ObjectUtils.fromMogo( mQuery ) );
|
||||||
|
mClient.setOnPoiSearchListener( this );
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPoiSearchListener( IMogoPoiSearchListener listener ) {
|
||||||
|
mListener = listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void searchPOIAsyn() {
|
||||||
|
if ( mClient != null ) {
|
||||||
|
mClient.searchPOIAsyn();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MogoPoiResult searchPOI() throws MogoMapException {
|
||||||
|
if ( mClient != null ) {
|
||||||
|
try {
|
||||||
|
PoiSearchResult search = mClient.searchPOI();
|
||||||
|
return ObjectUtils.fromAMap( search );
|
||||||
|
} catch ( Exception e ) {
|
||||||
|
throw new MogoMapException( e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setQuery( MogoPoiSearchQuery query ) {
|
||||||
|
mQuery = query;
|
||||||
|
if ( mClient != null ) {
|
||||||
|
mClient.setQuery( ObjectUtils.fromMogo( mQuery ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MogoPoiItem searchPOIId( String poiId ) throws MogoMapException {
|
||||||
|
if ( mClient != null ) {
|
||||||
|
try {
|
||||||
|
PoiItem poiItem = mClient.searchPOIId( poiId );
|
||||||
|
return ObjectUtils.fromAMap( poiItem );
|
||||||
|
} catch ( Exception e ) {
|
||||||
|
throw new MogoMapException( e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void searchPOIIdAsyn( String poiId ) {
|
||||||
|
if ( mClient != null ) {
|
||||||
|
mClient.searchPOIIdAsyn( poiId );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setBound( MogoSearchBound bound ) {
|
||||||
|
mBound = bound;
|
||||||
|
if ( mClient != null ) {
|
||||||
|
mClient.setBound( ObjectUtils.fromMogo( mBound ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPoiSearched( PoiSearchResult poiResult, int errorCode ) {
|
||||||
|
if ( errorCode != 0 ) {
|
||||||
|
Logger.e( TAG, "errorcode is %d", errorCode );
|
||||||
|
}
|
||||||
|
if ( mListener != null ) {
|
||||||
|
mListener.onPoiSearched( ObjectUtils.fromAMap( poiResult ), errorCode );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPoiItemSearched( PoiItem poiItem, int errorCode ) {
|
||||||
|
if ( errorCode != 0 ) {
|
||||||
|
Logger.e( TAG, "errorcode is %d", errorCode );
|
||||||
|
}
|
||||||
|
if ( mListener != null ) {
|
||||||
|
mListener.onPoiItemSearched( ObjectUtils.fromAMap( poiItem ), errorCode );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void destroy() {
|
||||||
|
mQuery = null;
|
||||||
|
mClient = null;
|
||||||
|
mListener = null;
|
||||||
|
mBound = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPoiCategorySearched(@Nullable List list, int errorCode) {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,386 @@
|
|||||||
|
package com.mogo.map.uicontroller;
|
||||||
|
|
||||||
|
import android.graphics.Point;
|
||||||
|
import android.graphics.Rect;
|
||||||
|
import android.location.Location;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||||
|
import com.zhidaoauto.map.sdk.open.MapAutoApi;
|
||||||
|
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import mogo.telematics.pad.MessagePad;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author congtaowang
|
||||||
|
* @since 2019-12-26
|
||||||
|
* <p>
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
public class AMapUIController implements IMogoMapUIController {
|
||||||
|
|
||||||
|
private static final String TAG = "AMapUIController";
|
||||||
|
|
||||||
|
private static volatile AMapUIController sInstance;
|
||||||
|
|
||||||
|
private IMogoMapUIController mClient;
|
||||||
|
|
||||||
|
private AMapUIController() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AMapUIController getInstance() {
|
||||||
|
if (sInstance == null) {
|
||||||
|
synchronized (AMapUIController.class) {
|
||||||
|
if (sInstance == null) {
|
||||||
|
sInstance = new AMapUIController();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initClient(IMogoMapUIController client) {
|
||||||
|
this.mClient = client;
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void release() {
|
||||||
|
sInstance = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTrafficEnabled(boolean visible) {
|
||||||
|
if (mClient != null) {
|
||||||
|
mClient.setTrafficEnabled(visible);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
return MapControlResult.ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void changeMapMode(EnumMapUI mode) {
|
||||||
|
if (mClient != null) {
|
||||||
|
mClient.changeMapMode(mode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void changeMapVisualAngle(VisualAngleMode angelMode, MogoLatLng mogoLatLng) {
|
||||||
|
if (mClient != null) {
|
||||||
|
mClient.changeMapVisualAngle(angelMode, mogoLatLng);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
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(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) {
|
||||||
|
mClient.recoverLockMode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loseLockMode() {
|
||||||
|
if (mClient != null) {
|
||||||
|
mClient.loseLockMode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLockZoom(int var1) {
|
||||||
|
if (mClient != null) {
|
||||||
|
mClient.setLockZoom(var1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void displayOverview(Rect bounds) {
|
||||||
|
if (mClient != null) {
|
||||||
|
mClient.displayOverview(bounds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getScalePerPixel() {
|
||||||
|
if (mClient != null) {
|
||||||
|
return mClient.getScalePerPixel();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getZoomLevel() {
|
||||||
|
if (mClient != null) {
|
||||||
|
return mClient.getZoomLevel();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@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);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MogoLatLng getCameraNorthEastPosition() {
|
||||||
|
if (mClient != null) {
|
||||||
|
return mClient.getCameraNorthEastPosition();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MogoLatLng getCameraSouthWestPosition() {
|
||||||
|
if (mClient != null) {
|
||||||
|
return mClient.getCameraSouthWestPosition();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MogoLatLng getWindowCenterLocation() {
|
||||||
|
if (mClient != null) {
|
||||||
|
return mClient.getWindowCenterLocation();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MogoLatLng getLocationMogoLatLngInScreen(Point point) {
|
||||||
|
if (mClient != null) {
|
||||||
|
return mClient.getLocationMogoLatLngInScreen(point);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void forceRender() {
|
||||||
|
if (mClient != null) {
|
||||||
|
mClient.forceRender();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
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) {
|
||||||
|
return mClient.getCurrentUiMode();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void changeMyLocation(Location location) {
|
||||||
|
if (mClient != null) {
|
||||||
|
mClient.changeMyLocation(location);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCarLocked() {
|
||||||
|
if (mClient != null) {
|
||||||
|
return mClient.isCarLocked();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCarCursorOption(CarCursorOption option) {
|
||||||
|
if (mClient != null) {
|
||||||
|
mClient.setCarCursorOption(option);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MapCameraPosition getMapCameraPosition() {
|
||||||
|
if (mClient != null) {
|
||||||
|
return mClient.getMapCameraPosition();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void changeBearing(float bearing) {
|
||||||
|
if (mClient != null) {
|
||||||
|
mClient.changeBearing(bearing);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void changeMapViewAngle(int type) {
|
||||||
|
if (mClient != null) {
|
||||||
|
mClient.changeMapViewAngle(type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void changeCurrentIcon(int iconId) {
|
||||||
|
if (mClient != null) {
|
||||||
|
mClient.changeCurrentIcon(iconId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getTileId(double lon, double lat) {
|
||||||
|
return MapAutoApi.INSTANCE.getTileID(lon, lat, 13); // 13为默认获取瓦片层级级别
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSpeedLimmit(double lon, double lat, float angle) {
|
||||||
|
return mClient.getSpeedLimmit(lon, lat, angle);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void emphasizeMyLocation() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void rtkEnable(boolean enable) {
|
||||||
|
if (mClient != null) {
|
||||||
|
mClient.rtkEnable(enable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void syncLocation2Map(JSONObject data) {
|
||||||
|
if (mClient != null) {
|
||||||
|
mClient.syncLocation2Map(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void syncLocation2Map(MessagePad.GnssInfo gnssInfo) {
|
||||||
|
if (mClient != null) {
|
||||||
|
mClient.syncLocation2Map(gnssInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clearRoadCacheById(String id) {
|
||||||
|
if (mClient != null) {
|
||||||
|
mClient.clearRoadCacheById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMapDAngle(float angle) {
|
||||||
|
if (mClient != null) {
|
||||||
|
mClient.setMapDAngle(angle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,135 @@
|
|||||||
|
package com.mogo.map.utils;
|
||||||
|
|
||||||
|
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||||
|
import com.mogo.map.exception.MogoMapException;
|
||||||
|
import com.zhidaoauto.map.sdk.open.camera.LatLngBounds;
|
||||||
|
import com.zhidaoauto.map.sdk.open.query.LonLatPoint;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author congtaowang
|
||||||
|
* @since 2020-03-04
|
||||||
|
* <p>
|
||||||
|
* 地图工具类
|
||||||
|
*/
|
||||||
|
public class MogoMapUtils {
|
||||||
|
|
||||||
|
private static final String TAG = "MogoMapUtils";
|
||||||
|
|
||||||
|
public static LatLngBounds getLatLngBounds(MogoLatLng carPosition, List< MogoLatLng > lonLats, boolean lockCarPosition ) throws Exception {
|
||||||
|
|
||||||
|
if ( lonLats == null || lonLats.isEmpty() ) {
|
||||||
|
throw new MogoMapException( "经纬度不能为null或空集合" );
|
||||||
|
}
|
||||||
|
LatLngBounds.Builder builder = new LatLngBounds.Builder();
|
||||||
|
for ( MogoLatLng lonLat : lonLats ) {
|
||||||
|
builder.include( ObjectUtils.fromMogo( lonLat ) );
|
||||||
|
}
|
||||||
|
if ( carPosition != null && !lockCarPosition ) {
|
||||||
|
builder.include( ObjectUtils.fromMogo( carPosition ) );
|
||||||
|
}
|
||||||
|
LatLngBounds latLngBounds = builder.build();
|
||||||
|
if ( !lockCarPosition ) {
|
||||||
|
return latLngBounds;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( carPosition == null ) {
|
||||||
|
throw new MogoMapException( "自车位置经纬度信息不能为空" );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( latLngBounds.getNortheast() == null && latLngBounds.getSouthwest() == null ) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
double south = 0.0;
|
||||||
|
double west = 0.0;
|
||||||
|
|
||||||
|
double east = 0.0;
|
||||||
|
double north = 0.0;
|
||||||
|
|
||||||
|
double dLat = 0.0;
|
||||||
|
double dLon = 0.0;
|
||||||
|
|
||||||
|
if ( latLngBounds.getNortheast() == null ) {
|
||||||
|
dLat = Math.abs( carPosition.lat - latLngBounds.getSouthwest().getLatitude() );
|
||||||
|
dLon = Math.abs( carPosition.lon - latLngBounds.getSouthwest().getLongitude() );
|
||||||
|
} else if ( latLngBounds.getSouthwest() == null ) {
|
||||||
|
dLat = Math.abs( carPosition.lat - latLngBounds.getNortheast().getLatitude() );
|
||||||
|
dLon = Math.abs( carPosition.lon - latLngBounds.getNortheast().getLongitude() );
|
||||||
|
} else {
|
||||||
|
final double dLat1 = Math.abs( carPosition.lat - latLngBounds.getSouthwest().getLatitude() );
|
||||||
|
final double dLon1 = Math.abs( carPosition.lon - latLngBounds.getSouthwest().getLongitude() );
|
||||||
|
final double dLat2 = Math.abs( carPosition.lat - latLngBounds.getNortheast().getLatitude() );
|
||||||
|
final double dLon2 = Math.abs( carPosition.lon - latLngBounds.getNortheast().getLongitude() );
|
||||||
|
dLat = dLat1 > dLat2 ? dLat1 : dLat2;
|
||||||
|
dLon = dLon1 > dLon2 ? dLon1 : dLon2;
|
||||||
|
}
|
||||||
|
|
||||||
|
west = carPosition.lat - dLat;
|
||||||
|
south = carPosition.lon + dLon;
|
||||||
|
|
||||||
|
east = carPosition.lat + dLat;
|
||||||
|
north = carPosition.lon - dLon;
|
||||||
|
|
||||||
|
if ( south == 0.0 || west == 0.0 || east == 0.0 || north == 0.0 ) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( east < west ) {
|
||||||
|
double tmp = east;
|
||||||
|
east = west;
|
||||||
|
west = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( north < south ){
|
||||||
|
double tmp = north;
|
||||||
|
north = south;
|
||||||
|
south = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new LatLngBounds.Builder().include( new LonLatPoint( east, north ) ).include( new LonLatPoint( west, south ) ).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float calculateLineDistance(LonLatPoint var0, LonLatPoint var1) {
|
||||||
|
if (var0 != null && var1 != null) {
|
||||||
|
try {
|
||||||
|
double var2 = var0.getLongitude();
|
||||||
|
double var4 = var0.getLatitude();
|
||||||
|
double var6 = var1.getLongitude();
|
||||||
|
double var8 = var1.getLatitude();
|
||||||
|
var2 *= 0.01745329251994329D;
|
||||||
|
var4 *= 0.01745329251994329D;
|
||||||
|
var6 *= 0.01745329251994329D;
|
||||||
|
var8 *= 0.01745329251994329D;
|
||||||
|
double var10 = Math.sin(var2);
|
||||||
|
double var12 = Math.sin(var4);
|
||||||
|
double var14 = Math.cos(var2);
|
||||||
|
double var16 = Math.cos(var4);
|
||||||
|
double var18 = Math.sin(var6);
|
||||||
|
double var20 = Math.sin(var8);
|
||||||
|
double var22 = Math.cos(var6);
|
||||||
|
double var24 = Math.cos(var8);
|
||||||
|
double[] var28 = new double[3];
|
||||||
|
double[] var29 = new double[3];
|
||||||
|
var28[0] = var16 * var14;
|
||||||
|
var28[1] = var16 * var10;
|
||||||
|
var28[2] = var12;
|
||||||
|
var29[0] = var24 * var22;
|
||||||
|
var29[1] = var24 * var18;
|
||||||
|
var29[2] = var20;
|
||||||
|
return (float)(Math.asin(Math.sqrt((var28[0] - var29[0]) * (var28[0] - var29[0]) + (var28[1] - var29[1]) * (var28[1] - var29[1]) + (var28[2] - var29[2]) * (var28[2] - var29[2])) / 2.0D) * 1.27420015798544E7D);
|
||||||
|
} catch (Throwable var26) {
|
||||||
|
var26.printStackTrace();
|
||||||
|
return 0.0F;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
throw new Exception("非法坐标值");
|
||||||
|
} catch (Exception var27) {
|
||||||
|
var27.printStackTrace();
|
||||||
|
return 0.0F;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,707 @@
|
|||||||
|
package com.mogo.map.utils;
|
||||||
|
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||||
|
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||||
|
import com.mogo.eagle.core.data.traffic.TrafficData;
|
||||||
|
import com.mogo.map.marker.MogoMarkerOptions;
|
||||||
|
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||||
|
import com.mogo.map.search.geo.MogoGeocodeAddress;
|
||||||
|
import com.mogo.map.search.geo.MogoGeocodeResult;
|
||||||
|
import com.mogo.map.search.geo.MogoPoiItem;
|
||||||
|
import com.mogo.map.search.geo.MogoRegeocodeAddress;
|
||||||
|
import com.mogo.map.search.geo.MogoRegeocodeResult;
|
||||||
|
import com.mogo.map.search.geo.query.MogoGeocodeQuery;
|
||||||
|
import com.mogo.map.search.geo.query.MogoRegeocodeQuery;
|
||||||
|
import com.mogo.map.search.inputtips.MogoTip;
|
||||||
|
import com.mogo.map.search.inputtips.query.MogoInputtipsQuery;
|
||||||
|
import com.mogo.map.search.poisearch.MogoPoiResult;
|
||||||
|
import com.mogo.map.search.poisearch.MogoSearchBound;
|
||||||
|
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
|
||||||
|
import com.mogo.map.uicontroller.MapCameraPosition;
|
||||||
|
import com.zhidaoauto.map.sdk.open.camera.CameraPosition;
|
||||||
|
import com.zhidaoauto.map.sdk.open.marker.BitmapDescriptor;
|
||||||
|
import com.zhidaoauto.map.sdk.open.marker.BitmapDescriptorFactory;
|
||||||
|
import com.zhidaoauto.map.sdk.open.marker.MarkerOptions;
|
||||||
|
import com.zhidaoauto.map.sdk.open.marker.MarkerSimpleData;
|
||||||
|
import com.zhidaoauto.map.sdk.open.poyline.PolylineOptions;
|
||||||
|
import com.zhidaoauto.map.sdk.open.query.GeocodeAddress;
|
||||||
|
import com.zhidaoauto.map.sdk.open.query.GeocodeQuery;
|
||||||
|
import com.zhidaoauto.map.sdk.open.query.GeocodeResult;
|
||||||
|
import com.zhidaoauto.map.sdk.open.query.InputtipsQuery;
|
||||||
|
import com.zhidaoauto.map.sdk.open.query.LonLatPoint;
|
||||||
|
import com.zhidaoauto.map.sdk.open.query.PoiItem;
|
||||||
|
import com.zhidaoauto.map.sdk.open.query.PoiSearchItem;
|
||||||
|
import com.zhidaoauto.map.sdk.open.query.PoiSearchResult;
|
||||||
|
import com.zhidaoauto.map.sdk.open.query.Query;
|
||||||
|
import com.zhidaoauto.map.sdk.open.query.RegeocodeAddress;
|
||||||
|
import com.zhidaoauto.map.sdk.open.query.RegeocodeQuery;
|
||||||
|
import com.zhidaoauto.map.sdk.open.query.RegeocodeResult;
|
||||||
|
import com.zhidaoauto.map.sdk.open.query.SearchBound;
|
||||||
|
import com.zhidaoauto.map.sdk.open.query.Tip;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import mogo.telematics.pad.MessagePad;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author congtaowang
|
||||||
|
* @since 2019-12-18
|
||||||
|
* <p>
|
||||||
|
* 业务对象和实际对象转换
|
||||||
|
*/
|
||||||
|
public class ObjectUtils {
|
||||||
|
|
||||||
|
public static MarkerOptions fromMogo(MogoMarkerOptions opt) {
|
||||||
|
|
||||||
|
if (opt == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
ArrayList<BitmapDescriptor> descriptors = new ArrayList<>();
|
||||||
|
final ArrayList<Bitmap> icons = opt.getIcons();
|
||||||
|
if (icons != null && !icons.isEmpty()) {
|
||||||
|
for (Bitmap icon : icons) {
|
||||||
|
if (icon == null || icon.isRecycled()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
descriptors.add(new BitmapDescriptor(icon));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MarkerOptions markerOptions = new MarkerOptions()
|
||||||
|
.setGps(opt.isGps())
|
||||||
|
.position(new LonLatPoint(opt.getLongitude(), opt.getLatitude()))
|
||||||
|
.anchor(opt.getU(), opt.getV())
|
||||||
|
.icons(descriptors)
|
||||||
|
.period(opt.getPeriod())
|
||||||
|
.controlAngle(opt.isControlAngle())
|
||||||
|
.rotateAngle(opt.getRotate())
|
||||||
|
.setFlat(opt.isFlat())
|
||||||
|
.visible(opt.isVisible())
|
||||||
|
.infoWindowEnable(opt.isInifoWindowEnable())
|
||||||
|
.scale(opt.getScale())
|
||||||
|
.alpha(opt.getAlpha())
|
||||||
|
.setInfoWindowOffset(opt.getOffsetX(), opt.getOffsetY())
|
||||||
|
.zIndex(opt.getzIndex());
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (!TextUtils.isEmpty(opt.getAnchorColor())) {
|
||||||
|
Color.parseColor(opt.getAnchorColor());
|
||||||
|
markerOptions.anchorColor(opt.getAnchorColor());
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
//e.printStackTrace();
|
||||||
|
}
|
||||||
|
markerOptions.vrEnable(opt.is3DMode());
|
||||||
|
if (!TextUtils.isEmpty(opt.getResName())) {
|
||||||
|
markerOptions.setMarkerIconName(opt.getResName());
|
||||||
|
} else {
|
||||||
|
BitmapDescriptor descriptor = getBitmapDescriptorFromMogo(opt);
|
||||||
|
if (descriptor != null) {
|
||||||
|
markerOptions.markerIcon(descriptor);
|
||||||
|
}
|
||||||
|
if (opt.getIcon3DRes() != 0) {
|
||||||
|
markerOptions.marker3DIcon(opt.getIcon3DRes());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!TextUtils.isEmpty(opt.getTitle())) {
|
||||||
|
markerOptions.title(opt.getTitle());
|
||||||
|
}
|
||||||
|
if (!TextUtils.isEmpty(opt.getSnippet())) {
|
||||||
|
markerOptions.snippet(opt.getSnippet());
|
||||||
|
}
|
||||||
|
return markerOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MarkerSimpleData fromTrafficData(MessagePad.TrackedObject trafficData) {
|
||||||
|
if (trafficData == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
MarkerSimpleData markerOptions = null;
|
||||||
|
try {
|
||||||
|
markerOptions = new MarkerSimpleData();
|
||||||
|
markerOptions.setId(trafficData.getUuid());
|
||||||
|
markerOptions.setMarkerType(trafficData.getType());
|
||||||
|
markerOptions.setRotateAngle((float) trafficData.getHeading());
|
||||||
|
markerOptions.setLat(trafficData.getLatitude());
|
||||||
|
markerOptions.setLon(trafficData.getLongitude());
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return markerOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static BitmapDescriptor getBitmapDescriptorFromMogo(MogoMarkerOptions options) {
|
||||||
|
if (options == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
Bitmap icon = options.getIcon();
|
||||||
|
if (icon != null) {
|
||||||
|
return BitmapDescriptorFactory.INSTANCE.fromBitmap(icon);
|
||||||
|
}
|
||||||
|
View view = options.getIconView();
|
||||||
|
if (view != null) {
|
||||||
|
return BitmapDescriptorFactory.INSTANCE.fromView(view);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static MogoLocation fromLocation(com.zhidaoauto.map.sdk.open.location.MogoLocation aLocation) {
|
||||||
|
if (aLocation == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
MogoLocation location = new MogoLocation();
|
||||||
|
location.setLocType(1); // 定位类型
|
||||||
|
location.setSatellite(4);
|
||||||
|
location.setSpeed(aLocation.getSpeed());
|
||||||
|
location.setLatitude(aLocation.getLat());
|
||||||
|
location.setLongitude(aLocation.getLon());
|
||||||
|
location.setAltitude(aLocation.getAltitude());
|
||||||
|
location.setBearing((float) aLocation.getHeading());
|
||||||
|
location.setCityCode(aLocation.getCityCode());
|
||||||
|
location.setCityName(aLocation.getCity());
|
||||||
|
location.setProvider(aLocation.getProvider());
|
||||||
|
location.setAddress(aLocation.getAddress());
|
||||||
|
location.setDistrict(aLocation.getDistrict());
|
||||||
|
location.setProvince(aLocation.getProvince());
|
||||||
|
location.setAdCode(aLocation.getAdCode());
|
||||||
|
// location.setAccuracy( aLocation.getAccuracy() );
|
||||||
|
// location.setTime( aLocation.getTime() );
|
||||||
|
// location.setLocationDetail( aLocation.getLocationDetail() );
|
||||||
|
// location.setPoiName( aLocation.getPoiName() );
|
||||||
|
// location.setAoiName( aLocation.getAoiName() );
|
||||||
|
// location.setErrCode( aLocation.getErrorCode() );
|
||||||
|
// location.setErrInfo( aLocation.getErrorInfo() );
|
||||||
|
// location.setStreetNum( aLocation.getStreetNum() );
|
||||||
|
// location.setDescription( aLocation.getDescription() );
|
||||||
|
// location.setBuildingId( aLocation.getBuildingId() );
|
||||||
|
// location.setFloor( aLocation.getFloor() );
|
||||||
|
// location.setGpsAccuracyStatus( aLocation.getGpsAccuracyStatus() );
|
||||||
|
return location;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static LonLatPoint fromMogo(MogoLatLng latLng) {
|
||||||
|
if (latLng == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new LonLatPoint(latLng.lon, latLng.lat);
|
||||||
|
}
|
||||||
|
|
||||||
|
// public static NaviLatLng fromMogoAsNavi( MogoLatLng latLng ) {
|
||||||
|
// if ( latLng == null ) {
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// return new NaviLatLng( latLng.lat, latLng.lng );
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public static LatLng fromMogo2( MogoLatLng latLng ) {
|
||||||
|
// if ( latLng == null ) {
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// return new LatLng( latLng.lat, latLng.lng );
|
||||||
|
// }
|
||||||
|
|
||||||
|
public static MogoLatLng fromAMap(LonLatPoint point) {
|
||||||
|
if (point == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new MogoLatLng(point.getLatitude(), point.getLongitude());
|
||||||
|
}
|
||||||
|
|
||||||
|
// public static MogoLatLng CameraPositionfromAMap( LatLng point ) {
|
||||||
|
// if ( point == null ) {
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// return new MogoLatLng( point.latitude, point.longitude );
|
||||||
|
// }
|
||||||
|
|
||||||
|
public static GeocodeQuery fromMogo(MogoGeocodeQuery query) {
|
||||||
|
if (query == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
GeocodeQuery q = new GeocodeQuery(query.getLocationName(), query.getCity());
|
||||||
|
return q;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static RegeocodeQuery fromMogo(MogoRegeocodeQuery query) {
|
||||||
|
if (query == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
RegeocodeQuery q = new RegeocodeQuery(fromMogo(query.getPoint()), 1000);
|
||||||
|
return q;
|
||||||
|
}
|
||||||
|
|
||||||
|
// public static MogoAoiItem fromAMap( AoiItem amapItem ) {
|
||||||
|
// if ( amapItem == null ) {
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// MogoAoiItem mogoAoiItem = new MogoAoiItem();
|
||||||
|
// mogoAoiItem.setAdCode( amapItem.getAdCode() );
|
||||||
|
// mogoAoiItem.setAoiArea( amapItem.getAoiArea() );
|
||||||
|
// mogoAoiItem.setAoiCenterPoint( fromAMap( amapItem.getAoiCenterPoint() ) );
|
||||||
|
// mogoAoiItem.setAoiId( amapItem.getAoiId() );
|
||||||
|
// mogoAoiItem.setAoiName( amapItem.getAoiName() );
|
||||||
|
// return mogoAoiItem;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public static MogoBusinessArea fromAMap( BusinessArea amapItem ) {
|
||||||
|
// if ( amapItem == null ) {
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// MogoBusinessArea mogoBusinessArea = new MogoBusinessArea();
|
||||||
|
// mogoBusinessArea.setCenterPoint( fromAMap( amapItem.getCenterPoint() ) );
|
||||||
|
// mogoBusinessArea.setName( amapItem.getName() );
|
||||||
|
// return mogoBusinessArea;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// public static MogoCrossroad fromAMap( Crossroad amapItem ) {
|
||||||
|
// if ( amapItem == null ) {
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// MogoCrossroad mogoCrossroad = new MogoCrossroad();
|
||||||
|
// mogoCrossroad.setDirection( amapItem.getDirection() );
|
||||||
|
// mogoCrossroad.setDistance( amapItem.getDistance() );
|
||||||
|
// mogoCrossroad.setFirstRoadId( amapItem.getFirstRoadId() );
|
||||||
|
// mogoCrossroad.setFirstRoadName( amapItem.getFirstRoadName() );
|
||||||
|
// mogoCrossroad.setSecondRoadId( amapItem.getSecondRoadId() );
|
||||||
|
// mogoCrossroad.setSecondRoadName( amapItem.getSecondRoadName() );
|
||||||
|
// return mogoCrossroad;
|
||||||
|
// }
|
||||||
|
|
||||||
|
public static MogoGeocodeAddress fromAMap(GeocodeAddress address) {
|
||||||
|
if (address == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
MogoGeocodeAddress mogoGeocodeAddress = new MogoGeocodeAddress();
|
||||||
|
mogoGeocodeAddress.setAdcode(address.getAdcode());
|
||||||
|
mogoGeocodeAddress.setBuilding(address.getBuilding());
|
||||||
|
mogoGeocodeAddress.setCity(address.getCity());
|
||||||
|
mogoGeocodeAddress.setDistrict(address.getDistrict());
|
||||||
|
mogoGeocodeAddress.setFormatAddress(address.getFormatAddress());
|
||||||
|
mogoGeocodeAddress.setLatlng(fromAMap(address.getLonlat()));
|
||||||
|
mogoGeocodeAddress.setLevel(address.getLevel());
|
||||||
|
mogoGeocodeAddress.setNeighborhood(address.getNeighborhood());
|
||||||
|
mogoGeocodeAddress.setProvince(address.getProvince());
|
||||||
|
mogoGeocodeAddress.setTownship(address.getTownship());
|
||||||
|
return mogoGeocodeAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MogoGeocodeResult fromAMap(GeocodeResult result) {
|
||||||
|
if (result == null || result.getGeocodeAddressList() == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
MogoGeocodeResult mogoGeocodeResult = new MogoGeocodeResult();
|
||||||
|
final List<MogoGeocodeAddress> addresses = new ArrayList<>();
|
||||||
|
List<GeocodeAddress> list = result.getGeocodeAddressList();
|
||||||
|
for (GeocodeAddress geocodeAddress : list) {
|
||||||
|
final MogoGeocodeAddress mogoGeocodeAddress = fromAMap(geocodeAddress);
|
||||||
|
if (mogoGeocodeAddress != null) {
|
||||||
|
addresses.add(mogoGeocodeAddress);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mogoGeocodeResult.setAddresses(addresses);
|
||||||
|
return mogoGeocodeResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
// public static MogoIndoorData fromAMap( IndoorData data ) {
|
||||||
|
// if ( data == null ) {
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// MogoIndoorData mogoIndoorData = new MogoIndoorData();
|
||||||
|
// mogoIndoorData.setFloor( data.getFloor() );
|
||||||
|
// mogoIndoorData.setFloorName( data.getFloorName() );
|
||||||
|
// mogoIndoorData.setPoiId( data.getPoiId() );
|
||||||
|
// return mogoIndoorData;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public static MogoPhoto fromAMap( Photo photo ) {
|
||||||
|
// if ( photo == null ) {f
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// MogoPhoto mogoPhoto = new MogoPhoto();
|
||||||
|
// mogoPhoto.setTitle( photo.getTitle() );
|
||||||
|
// mogoPhoto.setUrl( photo.getUrl() );
|
||||||
|
// return mogoPhoto;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public static MogoPoiItemExtension fromAMap( PoiItemExtension poiItemExtension ) {
|
||||||
|
// if ( poiItemExtension == null ) {
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// MogoPoiItemExtension mogoPoiItemExtension = new MogoPoiItemExtension();
|
||||||
|
// mogoPoiItemExtension.setOpentime( poiItemExtension.getOpentime() );
|
||||||
|
// mogoPoiItemExtension.setRating( poiItemExtension.getmRating() );
|
||||||
|
// return mogoPoiItemExtension;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public static MogoRegeocodeRoad fromAMap( RegeocodeRoad regeocodeRoad ) {
|
||||||
|
// if ( regeocodeRoad == null ) {
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// MogoRegeocodeRoad mogoRegeocodeRoad = new MogoRegeocodeRoad();
|
||||||
|
// mogoRegeocodeRoad.setDirection( regeocodeRoad.getDirection() );
|
||||||
|
// mogoRegeocodeRoad.setDistance( regeocodeRoad.getDistance() );
|
||||||
|
// mogoRegeocodeRoad.setId( regeocodeRoad.getId() );
|
||||||
|
// mogoRegeocodeRoad.setName( regeocodeRoad.getName() );
|
||||||
|
// mogoRegeocodeRoad.setPoint( fromAMap( regeocodeRoad.getLatLngPoint() ) );
|
||||||
|
// return mogoRegeocodeRoad;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public static MogoStreetNumber fromAMap( StreetNumber streetNumber ) {
|
||||||
|
// if ( streetNumber == null ) {
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// MogoStreetNumber mogoStreetNumber = new MogoStreetNumber();
|
||||||
|
// mogoStreetNumber.setDirection( streetNumber.getDirection() );
|
||||||
|
// mogoStreetNumber.setDistance( streetNumber.getDistance() );
|
||||||
|
// mogoStreetNumber.setLatLonPoint( fromAMap( streetNumber.getLatLonPoint() ) );
|
||||||
|
// mogoStreetNumber.setNumber( streetNumber.getNumber() );
|
||||||
|
// mogoStreetNumber.setStreet( streetNumber.getStreet() );
|
||||||
|
// return mogoStreetNumber;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public static MogoSubPoiItem fromAMap( SubPoiItem subPoiItem ) {
|
||||||
|
// if ( subPoiItem == null ) {
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// MogoSubPoiItem mogoSubPoiItem = new MogoSubPoiItem();
|
||||||
|
// mogoSubPoiItem.setDistance( subPoiItem.getDistance() );
|
||||||
|
// mogoSubPoiItem.setPoiId( subPoiItem.getPoiId() );
|
||||||
|
// mogoSubPoiItem.setPoint( fromAMap( subPoiItem.getLatLonPoint() ) );
|
||||||
|
// mogoSubPoiItem.setSnippet( subPoiItem.getSnippet() );
|
||||||
|
// mogoSubPoiItem.setSubName( mogoSubPoiItem.getSubName() );
|
||||||
|
// mogoSubPoiItem.setSubTypeDes( mogoSubPoiItem.getSubTypeDes() );
|
||||||
|
// mogoSubPoiItem.setTitle( mogoSubPoiItem.getTitle() );
|
||||||
|
// return mogoSubPoiItem;
|
||||||
|
// }
|
||||||
|
|
||||||
|
public static MogoPoiItem fromAMap(PoiItem poiItem) {
|
||||||
|
if (poiItem == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
MogoPoiItem mogoPoiItem = new MogoPoiItem();
|
||||||
|
mogoPoiItem.setAdCode(poiItem.getAdCode());
|
||||||
|
mogoPoiItem.setAdName(poiItem.getAdName());
|
||||||
|
mogoPoiItem.setBusinessArea(poiItem.getBusinessArea());
|
||||||
|
mogoPoiItem.setCityCode(poiItem.getCityCode());
|
||||||
|
mogoPoiItem.setCityName(poiItem.getCityName());
|
||||||
|
mogoPoiItem.setDirection(poiItem.getDirection());
|
||||||
|
mogoPoiItem.setDistance(poiItem.getDistance());
|
||||||
|
mogoPoiItem.setEmail(poiItem.getEmail());
|
||||||
|
mogoPoiItem.setEnter(fromAMap(poiItem.getEnter()));
|
||||||
|
mogoPoiItem.setExit(fromAMap(poiItem.getExit()));
|
||||||
|
// mogoPoiItem.setIndoorData( fromAMap( poiItem.getIndoorData() ) );
|
||||||
|
mogoPoiItem.setParkingType(poiItem.getParkingType());
|
||||||
|
// mogoPoiItem.setIndoorMap( poiItem.isIndoorMap() );
|
||||||
|
// if ( poiItem.getPhotos() != null ) {
|
||||||
|
// List< MogoPhoto > mogoPhotos = new ArrayList<>();
|
||||||
|
// for ( Photo photo : poiItem.getPhotos() ) {
|
||||||
|
// MogoPhoto mogoPhoto = fromAMap( photo );
|
||||||
|
// if ( mogoPhoto != null ) {
|
||||||
|
// mogoPhotos.add( mogoPhoto );
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// mogoPoiItem.setPhotos( mogoPhotos );
|
||||||
|
// }
|
||||||
|
// mogoPoiItem.setPoiExtension( fromAMap( poiItem.getPoiExtension() ) );
|
||||||
|
mogoPoiItem.setPoiId(poiItem.getPoiId());
|
||||||
|
mogoPoiItem.setPoint(fromAMap(poiItem.getLonLatPoint()));
|
||||||
|
mogoPoiItem.setPostcode(poiItem.getPostcode());
|
||||||
|
mogoPoiItem.setProvinceCode(poiItem.getProvinceCode());
|
||||||
|
mogoPoiItem.setProvinceName(poiItem.getProvinceName());
|
||||||
|
mogoPoiItem.setShopID(poiItem.getShopID());
|
||||||
|
mogoPoiItem.setSnippet(poiItem.getSnippet());
|
||||||
|
// if ( poiItem.getSubPois() != null ) {
|
||||||
|
// List< MogoSubPoiItem > mogoSubPoiItems = new ArrayList<>();
|
||||||
|
// for ( SubPoiItem subPois : poiItem.getSubPois() ) {
|
||||||
|
// MogoSubPoiItem mogoSubPoiItem = fromAMap( subPois );
|
||||||
|
// if ( mogoPoiItem != null ) {
|
||||||
|
// mogoSubPoiItems.add( mogoSubPoiItem );
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// mogoPoiItem.setSubPois( mogoSubPoiItems );
|
||||||
|
// }
|
||||||
|
mogoPoiItem.setTel(poiItem.getTel());
|
||||||
|
mogoPoiItem.setTypeCode(poiItem.getTypeCode());
|
||||||
|
mogoPoiItem.setTitle(poiItem.getTitle());
|
||||||
|
mogoPoiItem.setTypeDes(poiItem.getTypeDes());
|
||||||
|
mogoPoiItem.setWebsite(poiItem.getWebsite());
|
||||||
|
return mogoPoiItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MogoRegeocodeAddress fromAMap(RegeocodeAddress regeocodeAddress) {
|
||||||
|
if (regeocodeAddress == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
MogoRegeocodeAddress mogoRegeocodeAddress = new MogoRegeocodeAddress();
|
||||||
|
mogoRegeocodeAddress.setAdCode(regeocodeAddress.getAdCode());
|
||||||
|
// if ( regeocodeAddress.getAois() != null ) {
|
||||||
|
// List< MogoAoiItem > items = new ArrayList<>();
|
||||||
|
// for ( AoiItem aois : regeocodeAddress.getAois() ) {
|
||||||
|
// final MogoAoiItem mogoAoiItem = fromAMap( aois );
|
||||||
|
// if ( mogoAoiItem != null ) {
|
||||||
|
// items.add( mogoAoiItem );
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// mogoRegeocodeAddress.setAois( items );
|
||||||
|
// }
|
||||||
|
|
||||||
|
mogoRegeocodeAddress.setBuilding(regeocodeAddress.getBuilding());
|
||||||
|
// if ( regeocodeAddress.getBusinessAreas() != null ) {
|
||||||
|
// List< MogoBusinessArea > mogoBusinessAreas = new ArrayList<>();
|
||||||
|
// for ( BusinessArea businessArea : regeocodeAddress.getBusinessAreas() ) {
|
||||||
|
// MogoBusinessArea mogoBusinessArea = fromAMap( businessArea );
|
||||||
|
// if ( mogoBusinessArea != null ) {
|
||||||
|
// mogoBusinessAreas.add( mogoBusinessArea );
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// mogoRegeocodeAddress.setBusinessAreas( mogoBusinessAreas );
|
||||||
|
// }
|
||||||
|
|
||||||
|
mogoRegeocodeAddress.setCity(regeocodeAddress.getCity());
|
||||||
|
mogoRegeocodeAddress.setCityCode(regeocodeAddress.getCityCode());
|
||||||
|
mogoRegeocodeAddress.setCountry(regeocodeAddress.getCountry());
|
||||||
|
// if ( regeocodeAddress.getCrossroads() != null ) {
|
||||||
|
// List< MogoCrossroad > mogoCrossroads = new ArrayList<>();
|
||||||
|
// for ( Crossroad crossroad : regeocodeAddress.getCrossroads() ) {
|
||||||
|
//
|
||||||
|
// MogoCrossroad mogoCrossroad = fromAMap( crossroad );
|
||||||
|
// if ( mogoCrossroad != null ) {
|
||||||
|
// mogoCrossroads.add( mogoCrossroad );
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// mogoRegeocodeAddress.setCrossroads( mogoCrossroads );
|
||||||
|
// }
|
||||||
|
mogoRegeocodeAddress.setDistrict(regeocodeAddress.getDistrict());
|
||||||
|
mogoRegeocodeAddress.setFormatAddress(regeocodeAddress.getFormatAddress());
|
||||||
|
mogoRegeocodeAddress.setNeighborhood(regeocodeAddress.getNeighborhood());
|
||||||
|
if (regeocodeAddress.getPoiList() != null) {
|
||||||
|
List<MogoPoiItem> mogoPoiItems = new ArrayList<>();
|
||||||
|
List<PoiItem> list = regeocodeAddress.getPoiList();
|
||||||
|
for (PoiItem pois : list) {
|
||||||
|
MogoPoiItem mogoPoiItem = fromAMap(pois);
|
||||||
|
mogoPoiItems.add(mogoPoiItem);
|
||||||
|
}
|
||||||
|
mogoRegeocodeAddress.setPois(mogoPoiItems);
|
||||||
|
}
|
||||||
|
mogoRegeocodeAddress.setProvince(regeocodeAddress.getProvince());
|
||||||
|
// if ( regeocodeAddress.getRoads() != null ) {
|
||||||
|
// List< MogoRegeocodeRoad > mogoRegeocodeRoads = new ArrayList<>();
|
||||||
|
// for ( RegeocodeRoad road : regeocodeAddress.getRoads() ) {
|
||||||
|
// MogoRegeocodeRoad mogoRegeocodeRoad = fromAMap( road );
|
||||||
|
// if ( mogoRegeocodeRoad != null ) {
|
||||||
|
// mogoRegeocodeRoads.add( mogoRegeocodeRoad );
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// mogoRegeocodeAddress.setRoads( mogoRegeocodeRoads );
|
||||||
|
// }
|
||||||
|
// mogoRegeocodeAddress.setStreetNumber( fromAMap( regeocodeAddress.getStreetNumber() ) );
|
||||||
|
mogoRegeocodeAddress.setTowncode(regeocodeAddress.getTowncode());
|
||||||
|
mogoRegeocodeAddress.setTownship(regeocodeAddress.getTownship());
|
||||||
|
return mogoRegeocodeAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MogoRegeocodeResult fromAMap(RegeocodeResult regeocodeResult) {
|
||||||
|
if (regeocodeResult == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
MogoRegeocodeResult mogoRegeocodeResult = new MogoRegeocodeResult();
|
||||||
|
mogoRegeocodeResult.setRegeocodeAddress(fromAMap(regeocodeResult.getRegeocodeAddress()));
|
||||||
|
return mogoRegeocodeResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static InputtipsQuery fromMogo(MogoInputtipsQuery query) {
|
||||||
|
if (query == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
InputtipsQuery inputtipsQuery = new InputtipsQuery(query.getKeyword(), query.getCity());
|
||||||
|
inputtipsQuery.setCityLimit(query.isCityLimit());
|
||||||
|
inputtipsQuery.setLocation(fromMogo(query.getLocation()));
|
||||||
|
inputtipsQuery.setType(query.getType());
|
||||||
|
return inputtipsQuery;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MogoTip fromAMap(Tip tip) {
|
||||||
|
if (tip == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
MogoTip mogoTip = new MogoTip();
|
||||||
|
mogoTip.setAdCode(tip.getAdcode());
|
||||||
|
mogoTip.setAddress(tip.getAddress());
|
||||||
|
mogoTip.setDistrict(tip.getDistrict());
|
||||||
|
mogoTip.setName(tip.getName());
|
||||||
|
mogoTip.setPoiID(tip.getPoiID());
|
||||||
|
mogoTip.setPoint(fromAMap(tip.getLatPoint()));
|
||||||
|
mogoTip.setTypeCode(tip.getTypeCode());
|
||||||
|
return mogoTip;
|
||||||
|
}
|
||||||
|
|
||||||
|
// public static MogoPoi fromAMap( Poi poi ) {
|
||||||
|
// if ( poi == null ) {
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// MogoPoi mogoPoi = new MogoPoi();
|
||||||
|
// mogoPoi.setCoordinate( fromAMap( poi.getCoordinate() ) );
|
||||||
|
// mogoPoi.setName( poi.getName() );
|
||||||
|
// mogoPoi.setPoiId( poi.getPoiId() );
|
||||||
|
// return mogoPoi;
|
||||||
|
// }
|
||||||
|
|
||||||
|
public static MogoPoiSearchQuery fromAMap(Query query) {
|
||||||
|
if (query == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
MogoPoiSearchQuery mogoPoiSearchQuery = new MogoPoiSearchQuery(query.getKeyword(), query.getCategory(), query.getCity());
|
||||||
|
// mogoPoiSearchQuery.setBuilding( query.getBuilding() );
|
||||||
|
mogoPoiSearchQuery.setCityLimit(query.getCityLimit());
|
||||||
|
mogoPoiSearchQuery.setDistanceSort(query.getDistanceSort());
|
||||||
|
mogoPoiSearchQuery.setLocation(fromAMap(query.getLocation()));
|
||||||
|
mogoPoiSearchQuery.setPageNum(query.getPageNum());
|
||||||
|
mogoPoiSearchQuery.setPageSize(query.getPageSize());
|
||||||
|
return mogoPoiSearchQuery;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Query fromMogo(MogoPoiSearchQuery query) {
|
||||||
|
if (query == null || query.getQuery() == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
Query psq = new Query(query.getQuery(), "", "");
|
||||||
|
String category = getCategory(query.getQuery());
|
||||||
|
if (!category.equals(""))
|
||||||
|
psq = new Query("", "", getCategory(query.getQuery()));
|
||||||
|
// psq.setBuilding( query.getBuilding() );
|
||||||
|
psq.setCityLimit(query.isCityLimit());
|
||||||
|
psq.setDistanceSort(query.isDistanceSort());
|
||||||
|
psq.setLocation(fromMogo(query.getLocation()));
|
||||||
|
psq.setPageNum(query.getPageNum());
|
||||||
|
psq.setPageSize(query.getPageSize());
|
||||||
|
return psq;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MogoSearchBound fromAMap(SearchBound bound) {
|
||||||
|
if (bound == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (bound.getShape() == SearchBound.BOUND_SHAPE) {
|
||||||
|
return new MogoSearchBound(fromAMap(bound.getCenter()), bound.getRange(), bound.isDistanceSort());
|
||||||
|
} else if (bound.getShape() == SearchBound.POLYGON_SHAPE) {
|
||||||
|
return new MogoSearchBound(fromAMap(bound.getPolyGonList()));
|
||||||
|
} else if (bound.getShape() == SearchBound.RECTANGLE_SHAPE) {
|
||||||
|
return new MogoSearchBound(fromAMap(bound.getLowerLeft()), fromAMap(bound.getUpperRight()));
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<MogoLatLng> fromAMap(List<LonLatPoint> latLngs) {
|
||||||
|
if (latLngs == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
List<MogoLatLng> result = new ArrayList<>(latLngs.size());
|
||||||
|
for (LonLatPoint latLng : latLngs) {
|
||||||
|
result.add(fromAMap(latLng));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<LonLatPoint> fromMogo(List<MogoLatLng> latLngs) {
|
||||||
|
if (latLngs == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
List<LonLatPoint> result = new ArrayList<>(latLngs.size());
|
||||||
|
for (MogoLatLng latLng : latLngs) {
|
||||||
|
result.add(fromMogo(latLng));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static SearchBound fromMogo(MogoSearchBound bound) {
|
||||||
|
if (bound == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (bound.getShape() == MogoSearchBound.SHAPE_BOUND) {
|
||||||
|
return new SearchBound(fromMogo(bound.getCenterPoint()), bound.getRadiusInMeters(), bound.isDistanceSort());
|
||||||
|
} else if (bound.getShape() == MogoSearchBound.SHAPE_POLYGON) {
|
||||||
|
return new SearchBound(fromMogo(bound.getPolyGonList()));
|
||||||
|
} else if (bound.getShape() == MogoSearchBound.SHAPE_RECTANGLE) {
|
||||||
|
return new SearchBound(fromMogo(bound.getLowerLeft()), fromMogo(bound.getUpperRight()));
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MogoPoiResult fromAMap(PoiSearchResult result) {
|
||||||
|
if (result == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
MogoPoiResult mogoPoiResult = new MogoPoiResult();
|
||||||
|
if (result.getItems() != null) {
|
||||||
|
final List<PoiSearchItem> poiItems = result.getItems();
|
||||||
|
final ArrayList<MogoPoiItem> mogoPoiItems = new ArrayList<>(poiItems.size());
|
||||||
|
for (PoiSearchItem poiItem : poiItems) {
|
||||||
|
mogoPoiItems.add(fromAMap(poiItem.getPoi()));
|
||||||
|
}
|
||||||
|
mogoPoiResult.setPois(mogoPoiItems);
|
||||||
|
}
|
||||||
|
return mogoPoiResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PolylineOptions fromMogo(MogoPolylineOptions options) {
|
||||||
|
if (options == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
PolylineOptions target = new PolylineOptions();
|
||||||
|
target.setGps(options.gps());
|
||||||
|
if (options.getPoints() != null) {
|
||||||
|
List<LonLatPoint> points = new ArrayList<>();
|
||||||
|
for (MogoLatLng point : options.getPoints()) {
|
||||||
|
points.add(fromMogo(point));
|
||||||
|
}
|
||||||
|
target.lonLatPoints(points);
|
||||||
|
}
|
||||||
|
target.setLineWidth(options.getWidth());
|
||||||
|
target.zIndex(options.getZIndex());
|
||||||
|
target.setColor(options.getColor());
|
||||||
|
target.useGradient(options.isGradient());
|
||||||
|
if (options.getColorValues() != null) {
|
||||||
|
target.colorValues(options.getColorValues());
|
||||||
|
}
|
||||||
|
// target.transparency( options.getTransparency() );
|
||||||
|
// target.aboveMaskLayer( options.isAboveMaskLayer() );
|
||||||
|
// target.lineCapType( PolylineOptions.LineCapType.LineCapRound );
|
||||||
|
// target.lineJoinType( PolylineOptions.LineJoinType.LineJoinRound );
|
||||||
|
// target.setDottedLineType( PolylineOptions.DOTTEDLINE_TYPE_CIRCLE );
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static MapCameraPosition fromAMap(CameraPosition position) {
|
||||||
|
if (position == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new MapCameraPosition(fromAMap(position.getTarget()), position.getBearing(), position.getTilt(), position.getZoom());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getCategory(String key) {
|
||||||
|
String category = "";
|
||||||
|
if (key.equals("加油站")) {
|
||||||
|
category = "6";
|
||||||
|
} else if (key.equals("停车场")) {
|
||||||
|
category = "12";
|
||||||
|
} else if (key.equals("餐馆")) {
|
||||||
|
category = "22";
|
||||||
|
} else if (key.equals("洗车")) {
|
||||||
|
category = "8";
|
||||||
|
} else if (key.equals("厕所")) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return category;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,138 @@
|
|||||||
|
package com.mogo.map.utils;
|
||||||
|
|
||||||
|
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||||
|
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||||
|
import com.zhidaoauto.map.sdk.open.query.LonLatPoint;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点之间插值工具类
|
||||||
|
*
|
||||||
|
* @author tongchenfei
|
||||||
|
*/
|
||||||
|
public class PointInterpolatorUtil {
|
||||||
|
private static final String TAG = "PointInterpolatorUtil";
|
||||||
|
private static final int DISTANCE_THRESHOLD = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在(x1,y1) (x2,y2)中间插入一些点,使每两个点之间距离<={@link #DISTANCE_THRESHOLD},利用如下公式进行计算
|
||||||
|
* xn = x1 + (x2 - x1)*n/a
|
||||||
|
* yn = y1 + (y2 - y1)*n/a
|
||||||
|
* a = (distance/{@link #DISTANCE_THRESHOLD}) +1
|
||||||
|
* n in 1 .. a-1
|
||||||
|
* n == 0 时,xn = x1
|
||||||
|
* n == a 时,xn = x2
|
||||||
|
* <p>
|
||||||
|
* 将xn依次插入x1到x2之间
|
||||||
|
*
|
||||||
|
* @param points 待插值点集
|
||||||
|
* @deprecated 这个方法有问题,并不能算出来想要的值
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static void interpolate(List<MogoLatLng> points) {
|
||||||
|
if (points.size() >= 2) {
|
||||||
|
// 插值
|
||||||
|
for (int i = 0; i < points.size() - 1; i++) {
|
||||||
|
MogoLatLng current = points.get(i);
|
||||||
|
MogoLatLng next = points.get(i + 1);
|
||||||
|
float distance = CoordinateUtils.calculateLineDistance(current.lon, current.lat, next.lon, next.lat);
|
||||||
|
Logger.d(TAG, i + ": " + distance);
|
||||||
|
if (distance > DISTANCE_THRESHOLD) {
|
||||||
|
int inter = (int) (distance / DISTANCE_THRESHOLD) + 1;
|
||||||
|
for (int j = 1; j < inter; j++) {
|
||||||
|
double newLat = current.lat + (next.lat - current.lat) * j / inter;
|
||||||
|
double newLon = current.lon + (next.lon - current.lon) * j / inter;
|
||||||
|
Logger.d(TAG, "distance: " + distance + ", j: " + j + ", nextLat: " + next.lat + ", nextLon: " + next.lon + ", newLat: " + newLat + ", newLon: " + newLon);
|
||||||
|
points.add(i + 1, new MogoLatLng(newLat, newLon));
|
||||||
|
current = points.get(++i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 道路吸附算法
|
||||||
|
* <p>
|
||||||
|
* 所谓的道路数据,实际就是道路对应的点集,每两个点之间是直线,但是两点间距并不固定,点集内点的数量也不固定,点集是有序的,按道路方向排序,road[0]是起点。
|
||||||
|
* 为了避免拐弯道路的问题,先使用{@link #getCloseTwoPoint(int, int, double, double, List)}从道路数据里面找出距离目标点最近的两个点,记为A、B,最近的两个点就在目标点一前一后排列,
|
||||||
|
* 这样的话,求一下目标点到AB的垂直映射以及距离{@link #getFootAndMinDistance(double, double, double, double, double, double)},就是吸附后的经纬度和距离
|
||||||
|
*
|
||||||
|
* @param lon 目标经度
|
||||||
|
* @param lat 目标纬度
|
||||||
|
* @param road 目标道路数据
|
||||||
|
* @return double[]{吸附后的经度,吸附后的纬度,目标经纬度距离道路的垂直距离}
|
||||||
|
*/
|
||||||
|
public static double[] mergeToRoad(double lon, double lat, List<LonLatPoint> road) {
|
||||||
|
int closeStart = 0;
|
||||||
|
int closeEnd = road.size() - 1;
|
||||||
|
int[] result = getCloseTwoPoint(closeStart, closeEnd, lon, lat, road);
|
||||||
|
LonLatPoint start = road.get(result[0]);
|
||||||
|
LonLatPoint end = road.get(result[1]);
|
||||||
|
return getFootAndMinDistance(lon, lat, start.getLongitude(), start.getLatitude(), end.getLongitude(), end.getLatitude());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取距离目标点经纬度最近的道路点index
|
||||||
|
* <p>
|
||||||
|
* 采用二分查找思想,先用道路数据的起点和终点分别计算距离目标点的距离:
|
||||||
|
* 若起点距离较远,则说明目标点在整条道路的后半段,则将起点后移至原起点和终点的中间,继续递归计算;
|
||||||
|
* 同理,若终点距离较远,则目标点在前半段,则终点前移,继续递归计算;
|
||||||
|
* 递归结束条件是起点index和终点index间隔是1;
|
||||||
|
*
|
||||||
|
* @param closeStart 距离目标点最近的起始点index
|
||||||
|
* @param closeEnd 距离目标点最近的终点index
|
||||||
|
* @param lon 目标点经度
|
||||||
|
* @param lat 目标点纬度
|
||||||
|
* @param road 目标道路
|
||||||
|
* @return int[]{距离目标点最近的起始点index,距离目标点最近的终点index}
|
||||||
|
*/
|
||||||
|
private static int[] getCloseTwoPoint(int closeStart, int closeEnd, double lon, double lat, List<LonLatPoint> road) {
|
||||||
|
if (closeEnd - closeStart == 1) {
|
||||||
|
return new int[]{closeStart, closeEnd};
|
||||||
|
}
|
||||||
|
LonLatPoint start = road.get(closeStart);
|
||||||
|
LonLatPoint end = road.get(closeEnd);
|
||||||
|
float startDistance = CoordinateUtils.calculateLineDistance(start.getLongitude(), start.getLatitude(), lon, lat);
|
||||||
|
float endDistance = CoordinateUtils.calculateLineDistance(end.getLongitude(), end.getLatitude(), lon, lat);
|
||||||
|
if (startDistance > endDistance) {
|
||||||
|
closeStart += (closeEnd - closeStart) / 2;
|
||||||
|
} else {
|
||||||
|
closeEnd -= (closeEnd - closeStart) / 2;
|
||||||
|
}
|
||||||
|
return getCloseTwoPoint(closeStart, closeEnd, lon, lat, road);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算垂足以及最短距离
|
||||||
|
*
|
||||||
|
* @param x target point lon
|
||||||
|
* @param y target point lat
|
||||||
|
* @param x1 线段起点 lon
|
||||||
|
* @param y1 起点起点 lat
|
||||||
|
* @param x2 线段终点 lon
|
||||||
|
* @param y2 线段终点 lat
|
||||||
|
* @return double[]{footLon,footLat,minDistance} if(footLon == -1) => no foot or foot not in line
|
||||||
|
*/
|
||||||
|
private static double[] getFootAndMinDistance(double x, double y, double x1, double y1, double x2, double y2) {
|
||||||
|
double[] result = new double[]{-1, -1, -1};
|
||||||
|
double cross = (x2 - x1) * (x - x1) + (y2 - y1) * (y - y1);
|
||||||
|
if (cross < 0) {
|
||||||
|
// 垂足没有在线段内,所以也无需计算最短距离
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
double d2 = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);
|
||||||
|
if (cross > d2) {
|
||||||
|
// 垂足没有在线段内,所以也无需计算最短距离
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
double r = cross / d2;
|
||||||
|
result[0] = x1 + (x2 - x1) * r;
|
||||||
|
result[1] = y1 + (y2 - y1) * r;
|
||||||
|
result[2] = CoordinateUtils.calculateLineDistance(result[0], result[1], x, y);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.mogo.map.utils;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author congtaowang
|
||||||
|
* @since 2021/3/8
|
||||||
|
*
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
public class ResIdCache {
|
||||||
|
|
||||||
|
public static Map< String, String > sMarkerCachesResMd5Values = new HashMap<>();
|
||||||
|
|
||||||
|
public static String getVal( String name ) {
|
||||||
|
return sMarkerCachesResMd5Values.get( name );
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void putVal( String name, String val ) {
|
||||||
|
sMarkerCachesResMd5Values.put( name, val );
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
libraries/mogo-map/src/main/res/drawable/marker_blue.png
Normal file
BIN
libraries/mogo-map/src/main/res/drawable/marker_blue.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
@@ -1,8 +1,12 @@
|
|||||||
package com.mogo.module.common.datacenter;
|
package com.mogo.module.common.datacenter;
|
||||||
|
|
||||||
|
import static com.mogo.eagle.core.data.config.FunctionBuildConfig.gpsProvider;
|
||||||
|
|
||||||
import com.mogo.commons.debug.DebugConfig;
|
import com.mogo.commons.debug.DebugConfig;
|
||||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||||
|
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||||
|
import com.mogo.map.MogoMapUIController;
|
||||||
import com.mogo.module.common.MogoApisHandler;
|
import com.mogo.module.common.MogoApisHandler;
|
||||||
import com.mogo.service.cloud.location.CloudLocationInfo;
|
import com.mogo.service.cloud.location.CloudLocationInfo;
|
||||||
|
|
||||||
@@ -95,21 +99,22 @@ public class SnapshotLocationDataCenter {
|
|||||||
DebugConfig.setStatusData(DebugConfig.sLat, lat);
|
DebugConfig.setStatusData(DebugConfig.sLat, lat);
|
||||||
|
|
||||||
// 使用与渠道配置一样的gps提供者提供的数据
|
// 使用与渠道配置一样的gps提供者提供的数据
|
||||||
CloudLocationInfo cloudLocationInfo = new CloudLocationInfo();
|
if (gpsProvider == FunctionBuildConfig.gpsProvider) {
|
||||||
cloudLocationInfo.setAlt(alt);
|
CloudLocationInfo cloudLocationInfo = new CloudLocationInfo();
|
||||||
cloudLocationInfo.setHeading(heading);
|
cloudLocationInfo.setAlt(alt);
|
||||||
cloudLocationInfo.setLat(lat);
|
cloudLocationInfo.setHeading(heading);
|
||||||
cloudLocationInfo.setLon(lon);
|
cloudLocationInfo.setLat(lat);
|
||||||
cloudLocationInfo.setSpeed(speed);
|
cloudLocationInfo.setLon(lon);
|
||||||
cloudLocationInfo.setSatelliteTime(satelliteTime);
|
cloudLocationInfo.setSpeed(speed);
|
||||||
cloudLocationInfo.setSystemTime(systemTime);
|
cloudLocationInfo.setSatelliteTime(satelliteTime);
|
||||||
cloudLocationInfo.setTileId(String.valueOf(MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getTileId(lon, lat)));
|
cloudLocationInfo.setSystemTime(systemTime);
|
||||||
//todo list数据暂时无人使用,增加后会导致数据量缓慢增加
|
cloudLocationInfo.setTileId(String.valueOf(MogoMapUIController.getInstance().getTileId(lon, lat)));
|
||||||
// mMachineCacheList.add(cloudLocationInfo);
|
mMachineCacheList.add(cloudLocationInfo);
|
||||||
|
|
||||||
mCurLon = cloudLocationInfo.getLon();
|
mCurLon = cloudLocationInfo.getLon();
|
||||||
mCurLat = cloudLocationInfo.getLat();
|
mCurLat = cloudLocationInfo.getLat();
|
||||||
mSatelliteTime = cloudLocationInfo.getSatelliteTime();
|
mSatelliteTime = cloudLocationInfo.getSatelliteTime();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getCurLon() {
|
public double getCurLon() {
|
||||||
|
|||||||
@@ -0,0 +1,348 @@
|
|||||||
|
package com.mogo.module.common.drawer;
|
||||||
|
|
||||||
|
import static com.mogo.cloud.socket.entity.SocketDownDataHelper.FROM_ADAS;
|
||||||
|
|
||||||
|
import android.os.Build;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||||
|
import com.mogo.commons.debug.DebugConfig;
|
||||||
|
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||||
|
import com.mogo.eagle.core.data.traffic.TrafficData;
|
||||||
|
import com.mogo.map.MogoMarkerManager;
|
||||||
|
import com.mogo.map.marker.IMogoMarker;
|
||||||
|
import com.mogo.map.marker.MogoMarkerOptions;
|
||||||
|
import com.mogo.module.common.MogoApisHandler;
|
||||||
|
import com.mogo.module.common.constants.DataTypes;
|
||||||
|
import com.mogo.module.common.utils.Trigonometric;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author congtaowang
|
||||||
|
* @since 2020/10/28
|
||||||
|
* <p>
|
||||||
|
* 绘制adas近景识别到的车辆
|
||||||
|
*/
|
||||||
|
public class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||||
|
|
||||||
|
private static final String TAG = "AdasRecognizedResultDrawer";
|
||||||
|
|
||||||
|
private static volatile AdasRecognizedResultDrawer sInstance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上一帧数据的缓存
|
||||||
|
*/
|
||||||
|
private static Map<String, IMogoMarker> mMarkersCaches = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
public AdasRecognizedResultDrawer() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
private final Map<String, TrafficData> mLastPositions = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
public static AdasRecognizedResultDrawer getInstance() {
|
||||||
|
if (sInstance == null) {
|
||||||
|
synchronized (AdasRecognizedResultDrawer.class) {
|
||||||
|
if (sInstance == null) {
|
||||||
|
sInstance = new AdasRecognizedResultDrawer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void release() {
|
||||||
|
sInstance = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Object readResolve() {
|
||||||
|
// 阻止反序列化,必须实现 Serializable 接口
|
||||||
|
return sInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasCached(String uniqueKey) {
|
||||||
|
return mMarkersCaches.containsKey(uniqueKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 渲染 adas 识别的数据
|
||||||
|
*
|
||||||
|
* @param resultList adas感知融合数据
|
||||||
|
*/
|
||||||
|
public void renderAdasRecognizedResult(List<TrafficData> resultList) {
|
||||||
|
|
||||||
|
final long start = System.nanoTime();
|
||||||
|
if (resultList == null || resultList.isEmpty() || !DebugConfig.isUseAdasRecognize()) {
|
||||||
|
clearOldMarker();
|
||||||
|
Log.w("ADAS数据延时绘制", "resultList==>" + resultList + " DebugConfig.isUseAdasRecognize()==>" + DebugConfig.isUseAdasRecognize());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||||
|
clearOldMarker();
|
||||||
|
Log.w("ADAS数据延时绘制", "当前不是VR模式");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// List<TrafficData> allDatumsList = new ArrayList<>();
|
||||||
|
// prepareData(resultList, allDatumsList);
|
||||||
|
|
||||||
|
Map<String, IMogoMarker> newAdasRecognizedMarkersCaches = new ConcurrentHashMap<>();
|
||||||
|
List<TrafficData> newDiffSet = new ArrayList<>();
|
||||||
|
for (TrafficData recognizedListResult : resultList) {
|
||||||
|
|
||||||
|
if (isUselessValue(recognizedListResult)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 复用之前存在的 marker
|
||||||
|
String uniqueKey = recognizedListResult.getUuid();
|
||||||
|
IMogoMarker marker = mMarkersCaches.remove(uniqueKey);
|
||||||
|
if (marker != null && !marker.isDestroyed()) {
|
||||||
|
// Log.d(TAG, "发现缓存marker id : " + uniqueKey);
|
||||||
|
updateCacheMarkerRes(marker, recognizedListResult);
|
||||||
|
renderAdasOneFrame(marker, uniqueKey, recognizedListResult, newAdasRecognizedMarkersCaches);
|
||||||
|
} else {
|
||||||
|
// 新增添加进差集
|
||||||
|
newDiffSet.add(recognizedListResult);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
removeUselessMarker(mMarkersCaches);
|
||||||
|
removeUselessLastRecord();
|
||||||
|
int newDiffSetSize = newDiffSet.size();
|
||||||
|
// Log.d(TAG, "原数据量 : " + resultList.size() + " 新增marker数量 : " + newDiffSetSize);
|
||||||
|
// 复用过期 marker
|
||||||
|
if (newDiffSetSize > 0) {
|
||||||
|
for (int i = 0; i < newDiffSetSize; i++) {
|
||||||
|
TrafficData recognizedListResult = newDiffSet.get(i);
|
||||||
|
String uniqueKey = recognizedListResult.getUuid();
|
||||||
|
IMogoMarker marker = drawAdasRecognizedDataMarker(recognizedListResult);
|
||||||
|
if (marker == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// Log.d(TAG, "新增marker id : " + uniqueKey);
|
||||||
|
renderAdasOneFrame(marker, uniqueKey, recognizedListResult, newAdasRecognizedMarkersCaches);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sendMessage(MSG_REMOVE_DIRTY_MARKERS, mMarkersCaches);
|
||||||
|
mMarkersCaches.clear();
|
||||||
|
mMarkersCaches = newAdasRecognizedMarkersCaches;
|
||||||
|
Log.d("ADAS数据延时绘制", "render 接收数据 -> 处理结束 " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start)) + "ms");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对数据补点
|
||||||
|
*
|
||||||
|
* @param in
|
||||||
|
* @param out
|
||||||
|
*/
|
||||||
|
private void prepareData(List<TrafficData> in, List<TrafficData> out) {
|
||||||
|
// foreCastPoint(in);
|
||||||
|
out.addAll(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final static String FORECAST = "adasForecast";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 基于工控机识别的数据点速度预测当前位置和距离自车距离
|
||||||
|
*
|
||||||
|
* @param in 数据源
|
||||||
|
*/
|
||||||
|
private void foreCastPoint(List<TrafficData> in) {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
|
for (TrafficData adasResult : in) {
|
||||||
|
Log.d(FORECAST, "ready to foreCast current uuid : " + adasResult.getUuid());
|
||||||
|
long internal = getCurSatelliteTime() - adasResult.getSatelliteTime();
|
||||||
|
if (internal <= 0) {
|
||||||
|
Log.d(FORECAST, "time internal less than 0 , uuid : " + adasResult.getUuid());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
long startTime = System.currentTimeMillis();
|
||||||
|
// 预测点
|
||||||
|
Log.d(FORECAST, "time internal : " + internal + " speed : " + adasResult.getSpeed());
|
||||||
|
double foreCastDistance = adasResult.getSpeed() * internal / 1000;
|
||||||
|
Log.d(FORECAST, "foreCastDistance : " + foreCastDistance);
|
||||||
|
MogoLatLng mogoLatLng = new MogoLatLng(adasResult.getLat(), adasResult.getLon());
|
||||||
|
MogoLatLng foreCastMogoLatLon = Trigonometric.getNewLocation(mogoLatLng, foreCastDistance, adasResult.getHeading());
|
||||||
|
|
||||||
|
// 计算与自车距离
|
||||||
|
float distanceFromSelf = CoordinateUtils.calculateLineDistance(getCurCoordinates()[0], getCurCoordinates()[1]
|
||||||
|
, foreCastMogoLatLon.getLon(), foreCastMogoLatLon.getLat());
|
||||||
|
|
||||||
|
long foreCastInternal = System.currentTimeMillis() - startTime;
|
||||||
|
Log.d(FORECAST, "foreCastInternal :" + foreCastInternal); //todo 耗时1~2毫秒 需要测试是否由于补点算法造成
|
||||||
|
|
||||||
|
adasResult.setLat(foreCastMogoLatLon.getLat());
|
||||||
|
adasResult.setLon(foreCastMogoLatLon.getLon());
|
||||||
|
adasResult.setSatelliteTime((getCurSatelliteTime() - foreCastInternal));
|
||||||
|
adasResult.setDistance(distanceFromSelf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* todo 后面涉及到此类变化的数据均改动
|
||||||
|
*
|
||||||
|
* @param marker
|
||||||
|
* @param recognizedListResult
|
||||||
|
*/
|
||||||
|
private void updateCacheMarkerRes(IMogoMarker marker, TrafficData recognizedListResult) {
|
||||||
|
String resIdVal;
|
||||||
|
int resId = getModelRes(recognizedListResult.getType().getType());
|
||||||
|
resIdVal = resId + "";
|
||||||
|
String resName = mMarkerCachesResMd5Values.get(resIdVal);
|
||||||
|
if (!TextUtils.isEmpty(resName)) {
|
||||||
|
if (!TextUtils.equals(resName, marker.getMarkerResName())) {
|
||||||
|
marker.use3DResource(resName);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
resName = marker.use3DResource(resId);
|
||||||
|
mMarkerCachesResMd5Values.put(resIdVal, resName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void removeUselessLastRecord() { // todo 最好重新设计一个数据结构,用于多线程数据过期失效的场景,参见redis数据过期
|
||||||
|
if (mLastPositions.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Iterator<TrafficData> iterator = mLastPositions.values().iterator();
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
TrafficData result = iterator.next();
|
||||||
|
long internal = result.getSatelliteTime() - getCurSatelliteTime();
|
||||||
|
if (internal > 3000) { //防止帧率过低导致误删除上一个节点对象,从而出现跳跃现象
|
||||||
|
iterator.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 过滤无用数据
|
||||||
|
*
|
||||||
|
* @param recognizedListResult {@link TrafficData}
|
||||||
|
* @return useless
|
||||||
|
*/
|
||||||
|
private boolean isUselessValue(TrafficData recognizedListResult) {
|
||||||
|
if (recognizedListResult == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (nonRenderType(recognizedListResult.getType().getType())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
String uniqueKey = recognizedListResult.getUuid();
|
||||||
|
return TextUtils.isEmpty(uniqueKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绘制某个物体的一个数据
|
||||||
|
*
|
||||||
|
* @param recognizedListResult {@link TrafficData}
|
||||||
|
* @param newAdasRecognizedMarkersCaches 缓存集合
|
||||||
|
*/
|
||||||
|
private void renderAdasOneFrame(IMogoMarker marker,
|
||||||
|
String uniqueKey,
|
||||||
|
TrafficData recognizedListResult,
|
||||||
|
Map<String, IMogoMarker> newAdasRecognizedMarkersCaches) {
|
||||||
|
final long start = System.nanoTime();
|
||||||
|
// Log.d(TAG, "renderAdasOneFrame uuid : " + uniqueKey + " type : " + recognizedListResult.type + " heading : " + recognizedListResult.heading);
|
||||||
|
TrafficData lastPosition = mLastPositions.remove(uniqueKey);
|
||||||
|
// 道路吸附
|
||||||
|
// double lastLon = -1;
|
||||||
|
// double lastLat = -1;
|
||||||
|
// if (lastPosition != null) {
|
||||||
|
// lastLon = lastPosition.lon;
|
||||||
|
// lastLat = lastPosition.lat;
|
||||||
|
// }
|
||||||
|
// double[] matchLonLat = getMatchLonLat(recognizedListResult.uuid, recognizedListResult.lon, recognizedListResult.lat, recognizedListResult.heading, lastLon, lastLat);
|
||||||
|
//
|
||||||
|
// recognizedListResult.lon = matchLonLat[0];
|
||||||
|
// recognizedListResult.lat = matchLonLat[1];
|
||||||
|
// Log.d( "matchRoad", "cost = %s", System.currentTimeMillis() - start );
|
||||||
|
|
||||||
|
mLastPositions.put(uniqueKey, recognizedListResult);
|
||||||
|
// Log.d(TAG, "使用缓存 id : " + uniqueKey);
|
||||||
|
long interval = 45;
|
||||||
|
if (lastPosition != null) {
|
||||||
|
interval = computeAnimDuration(lastPosition.getSatelliteTime(), recognizedListResult.getSatelliteTime());
|
||||||
|
}
|
||||||
|
final MogoLatLng renderLoc = new MogoLatLng(recognizedListResult.getLat(), recognizedListResult.getLon());
|
||||||
|
long cost = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start);
|
||||||
|
//Log.d("ADAS动画数据", "cost : " + cost);
|
||||||
|
final long intervalRef = interval - cost;
|
||||||
|
//Log.d("ADAS动画数据", "最终赋值 : " + intervalRef + " 两帧间隔 : " + interval + " uuid : " + recognizedListResult.getUuid());
|
||||||
|
marker.addDynamicAnchorPosition(renderLoc, (float) recognizedListResult.getHeading(), intervalRef);
|
||||||
|
String carColor = getModelRenderColor(recognizedListResult.getType().getType(), FROM_ADAS, recognizedListResult.getThreatLevel());
|
||||||
|
marker.setAnchorColor(carColor);
|
||||||
|
|
||||||
|
newAdasRecognizedMarkersCaches.put(uniqueKey, marker);
|
||||||
|
|
||||||
|
// if (shouldShowSpeed(recognizedListResult.type)) {
|
||||||
|
// Message msg = mRenderThreadHandler.obtainMessage();
|
||||||
|
// msg.obj = new SpeedData(marker
|
||||||
|
// , recognizedListResult.speed
|
||||||
|
// , recognizedListResult.uuid
|
||||||
|
// , recognizedListResult.type
|
||||||
|
// , recognizedListResult.heading
|
||||||
|
// , MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode());
|
||||||
|
// msg.what = MSG_DISPLAY_SPEED;
|
||||||
|
// msg.sendToTarget();
|
||||||
|
// }
|
||||||
|
Log.d("ADAS数据延时", "render 刷新一台车 cost : " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绘制 marker
|
||||||
|
*
|
||||||
|
* @param recognizedListResult {@link TrafficData}
|
||||||
|
* @return {@link IMogoMarker}
|
||||||
|
*/
|
||||||
|
private IMogoMarker drawAdasRecognizedDataMarker(TrafficData recognizedListResult) {
|
||||||
|
long start = System.nanoTime();
|
||||||
|
if (recognizedListResult == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
int resId = getModelRes(recognizedListResult.getType().getType());
|
||||||
|
String resIdVal = resId + "";
|
||||||
|
|
||||||
|
String carColor = getModelRenderColor(recognizedListResult.getType().getType(), FROM_ADAS, recognizedListResult.getThreatLevel());
|
||||||
|
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||||
|
.owner(DataTypes.TYPE_MARKER_ADAS)
|
||||||
|
.anchor(0.5f, 0.5f)
|
||||||
|
.set3DMode(true)
|
||||||
|
.gps(true)
|
||||||
|
.anchorColor(carColor)
|
||||||
|
.controlAngle(true)
|
||||||
|
.resName(mMarkerCachesResMd5Values.get(resIdVal))
|
||||||
|
.icon3DRes(resId)
|
||||||
|
.rotate((float) recognizedListResult.getHeading())
|
||||||
|
.position(new MogoLatLng(recognizedListResult.getLat(), recognizedListResult.getLon()));
|
||||||
|
IMogoMarker marker = MogoMarkerManager.getInstance(mContext).addMarker(DataTypes.TYPE_MARKER_ADAS, options);
|
||||||
|
cacheMarkerIconResMd5Val(resIdVal, marker);
|
||||||
|
Log.d("ADAS数据延时", "创建一个新 marker cost : " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start)));
|
||||||
|
return marker;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* vr 模式切换
|
||||||
|
*/
|
||||||
|
public void notifyVrModeChanged() {
|
||||||
|
clearOldMarker();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清除旧的 marker 数据
|
||||||
|
*/
|
||||||
|
public void clearOldMarker() {
|
||||||
|
if (mMarkersCaches != null) {
|
||||||
|
mMarkersCaches.clear();
|
||||||
|
}
|
||||||
|
mLastPositions.clear();
|
||||||
|
sendMessage(MSG_REMOVE_DIRTY_MARKERS, DataTypes.TYPE_MARKER_ADAS);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@ import com.mogo.eagle.core.data.enums.TrafficTypeEnum;
|
|||||||
import com.mogo.eagle.core.data.traffic.TrafficData;
|
import com.mogo.eagle.core.data.traffic.TrafficData;
|
||||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||||
|
import com.mogo.map.MogoMarkerManager;
|
||||||
import com.mogo.module.common.MogoApisHandler;
|
import com.mogo.module.common.MogoApisHandler;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -109,9 +110,7 @@ public class IdentifyDataDrawer {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// 绘制新数据
|
// 绘制新数据
|
||||||
MogoApisHandler.getInstance().getApis()
|
MogoMarkerManager.getInstance(mContext)
|
||||||
.getMapServiceApi()
|
|
||||||
.getMarkerManager(mContext)
|
|
||||||
.updateBatchMarkerPosition(filterTrafficData(resultList));
|
.updateBatchMarkerPosition(filterTrafficData(resultList));
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -140,9 +139,7 @@ public class IdentifyDataDrawer {
|
|||||||
*/
|
*/
|
||||||
public void clearOldMarker() {
|
public void clearOldMarker() {
|
||||||
for (String uuid : trafficDataUuidList) {
|
for (String uuid : trafficDataUuidList) {
|
||||||
MogoApisHandler.getInstance().getApis()
|
MogoMarkerManager.getInstance(mContext)
|
||||||
.getMapServiceApi()
|
|
||||||
.getMarkerManager(mContext)
|
|
||||||
.removeMarker(uuid);
|
.removeMarker(uuid);
|
||||||
}
|
}
|
||||||
trafficDataUuidList.clear();
|
trafficDataUuidList.clear();
|
||||||
@@ -172,9 +169,7 @@ public class IdentifyDataDrawer {
|
|||||||
* @param s
|
* @param s
|
||||||
*/
|
*/
|
||||||
private void addPreVehicleModelWeiZhi(TrafficTypeEnum typeTrafficIdWeiZhi, String s) {
|
private void addPreVehicleModelWeiZhi(TrafficTypeEnum typeTrafficIdWeiZhi, String s) {
|
||||||
String preVehicleStrWeiZhi = MogoApisHandler.getInstance().getApis()
|
String preVehicleStrWeiZhi = MogoMarkerManager.getInstance(mContext)
|
||||||
.getMapServiceApi()
|
|
||||||
.getMarkerManager(mContext)
|
|
||||||
.addPreVehicleModel(typeTrafficIdWeiZhi.getType(),
|
.addPreVehicleModel(typeTrafficIdWeiZhi.getType(),
|
||||||
typeTrafficIdWeiZhi.getTraffic3DIconId());
|
typeTrafficIdWeiZhi.getTraffic3DIconId());
|
||||||
CallerLogger.INSTANCE.d(TAG, s + preVehicleStrWeiZhi);
|
CallerLogger.INSTANCE.d(TAG, s + preVehicleStrWeiZhi);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import android.text.TextUtils;
|
|||||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||||
import com.mogo.commons.AbsMogoApplication;
|
import com.mogo.commons.AbsMogoApplication;
|
||||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||||
|
import com.mogo.map.MogoMarkerManager;
|
||||||
import com.mogo.map.marker.IMogoMarker;
|
import com.mogo.map.marker.IMogoMarker;
|
||||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||||
import com.mogo.map.marker.MogoMarkerOptions;
|
import com.mogo.map.marker.MogoMarkerOptions;
|
||||||
@@ -110,7 +111,7 @@ class MarkerDrawer {
|
|||||||
options.icon(markerView.getBitmap(0));
|
options.icon(markerView.getBitmap(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(AbsMogoApplication.getApp()).addMarker(markerShowEntity.getMarkerType(), options);
|
IMogoMarker marker = MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).addMarker(markerShowEntity.getMarkerType(), options);
|
||||||
if (marker != null) {
|
if (marker != null) {
|
||||||
marker.setOwner(markerShowEntity.getMarkerType());
|
marker.setOwner(markerShowEntity.getMarkerType());
|
||||||
markerView.setMarker(marker);
|
markerView.setMarker(marker);
|
||||||
@@ -129,7 +130,7 @@ class MarkerDrawer {
|
|||||||
*/
|
*/
|
||||||
public Map<String, IMogoMarker> purgeMarkerData(List newList, String markerType) {
|
public Map<String, IMogoMarker> purgeMarkerData(List newList, String markerType) {
|
||||||
Map<String, IMogoMarker> existMap = new HashMap<>();
|
Map<String, IMogoMarker> existMap = new HashMap<>();
|
||||||
List<IMogoMarker> allCarsList = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(AbsMogoApplication.getApp()).getMarkers(markerType);
|
List<IMogoMarker> allCarsList = MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).getMarkers(markerType);
|
||||||
if (allCarsList == null || allCarsList.isEmpty()) {
|
if (allCarsList == null || allCarsList.isEmpty()) {
|
||||||
return existMap;
|
return existMap;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import android.view.animation.LinearInterpolator;
|
|||||||
|
|
||||||
import com.mogo.commons.AbsMogoApplication;
|
import com.mogo.commons.AbsMogoApplication;
|
||||||
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler;
|
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler;
|
||||||
|
import com.mogo.map.MogoMarkerManager;
|
||||||
import com.mogo.map.marker.IMogoMarker;
|
import com.mogo.map.marker.IMogoMarker;
|
||||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||||
import com.mogo.map.marker.anim.OnMarkerAnimationListener;
|
import com.mogo.map.marker.anim.OnMarkerAnimationListener;
|
||||||
@@ -60,7 +61,7 @@ class RoadConditionDrawer {
|
|||||||
public void drawRoadConditionMarker( List< MarkerExploreWay > exploreWayList, int maxAmount, IMogoMarkerClickListener listener ) {
|
public void drawRoadConditionMarker( List< MarkerExploreWay > exploreWayList, int maxAmount, IMogoMarkerClickListener listener ) {
|
||||||
// 将数据同步给探路,避免探路每次 perform 的时候去拉取,造成消耗
|
// 将数据同步给探路,避免探路每次 perform 的时候去拉取,造成消耗
|
||||||
if ( exploreWayList == null || exploreWayList.isEmpty() ) {
|
if ( exploreWayList == null || exploreWayList.isEmpty() ) {
|
||||||
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( AbsMogoApplication.getApp() ).removeMarkers( ModuleNames.CARD_TYPE_ROAD_CONDITION );
|
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).removeMarkers( ModuleNames.CARD_TYPE_ROAD_CONDITION );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int size = MarkerDrawer.getInstance().getAppropriateSize( maxAmount, exploreWayList );
|
int size = MarkerDrawer.getInstance().getAppropriateSize( maxAmount, exploreWayList );
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import com.mogo.commons.AbsMogoApplication;
|
|||||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||||
import com.mogo.eagle.core.utilcode.util.ViewUtils;
|
import com.mogo.eagle.core.utilcode.util.ViewUtils;
|
||||||
|
import com.mogo.map.MogoMarkerManager;
|
||||||
import com.mogo.map.marker.IMogoMarker;
|
import com.mogo.map.marker.IMogoMarker;
|
||||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||||
import com.mogo.map.marker.MogoMarkerOptions;
|
import com.mogo.map.marker.MogoMarkerOptions;
|
||||||
@@ -407,7 +408,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
|||||||
options.icon(view);
|
options.icon(view);
|
||||||
resIdVal = view.getId() + "";
|
resIdVal = view.getId() + "";
|
||||||
}
|
}
|
||||||
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(TYPE_MARKER_CLOUD_DATA, options);
|
IMogoMarker marker = MogoMarkerManager.getInstance(mContext).addMarker(TYPE_MARKER_CLOUD_DATA, options);
|
||||||
cacheMarkerIconResMd5Val(resIdVal, marker);
|
cacheMarkerIconResMd5Val(resIdVal, marker);
|
||||||
|
|
||||||
if (!TextUtils.isEmpty(data.getSn())) {
|
if (!TextUtils.isEmpty(data.getSn())) {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import com.mogo.eagle.core.data.traffic.TrafficData
|
|||||||
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
|
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
|
||||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||||
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler
|
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler
|
||||||
|
import com.mogo.map.MogoMarkerManager
|
||||||
import java.util.concurrent.ConcurrentHashMap
|
import java.util.concurrent.ConcurrentHashMap
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -197,11 +198,7 @@ object TrafficMarkerDrawer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
val marker = MogoMarkerManager.getInstance(mContext).addMarker(DataTypes.TYPE_MARKER_OBU_DATA, options)
|
||||||
val marker = MogoApisHandler.getInstance().apis
|
|
||||||
.mapServiceApi
|
|
||||||
.getMarkerManager(mContext)
|
|
||||||
.addMarker(DataTypes.TYPE_MARKER_OBU_DATA, options)
|
|
||||||
|
|
||||||
// 缓存3D资源
|
// 缓存3D资源
|
||||||
mMarkerCachesResMd5Values[resIdVal] = marker.markerResName
|
mMarkerCachesResMd5Values[resIdVal] = marker.markerResName
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_WARN_
|
|||||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||||
|
import com.mogo.eagle.core.utilcode.util.ViewUtils;
|
||||||
|
import com.mogo.map.MogoMarkerManager;
|
||||||
import com.mogo.map.marker.IMogoMarker;
|
import com.mogo.map.marker.IMogoMarker;
|
||||||
import com.mogo.map.marker.MogoMarkerOptions;
|
import com.mogo.map.marker.MogoMarkerOptions;
|
||||||
import com.mogo.module.common.MogoApisHandler;
|
import com.mogo.module.common.MogoApisHandler;
|
||||||
@@ -105,7 +107,7 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
|
|||||||
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
|
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
|
||||||
options.icon3DRes(getModelRes(modeResType)); //TODO
|
options.icon3DRes(getModelRes(modeResType)); //TODO
|
||||||
options.anchorColor("#FB3C3CFF");
|
options.anchorColor("#FB3C3CFF");
|
||||||
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerShowEntity.getMarkerType(), options);
|
IMogoMarker marker = MogoMarkerManager.getInstance(mContext).addMarker(markerShowEntity.getMarkerType(), options);
|
||||||
iMarkerView.setMarker(marker);
|
iMarkerView.setMarker(marker);
|
||||||
marker.setToTop();
|
marker.setToTop();
|
||||||
|
|
||||||
@@ -122,7 +124,7 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
|
|||||||
.icon3DRes(getModelRes(type))
|
.icon3DRes(getModelRes(type))
|
||||||
.anchorColor("#FB3C3CFF")
|
.anchorColor("#FB3C3CFF")
|
||||||
.flat(true);
|
.flat(true);
|
||||||
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerType, options);
|
IMogoMarker marker = MogoMarkerManager.getInstance(mContext).addMarker(markerType, options);
|
||||||
marker.setRotateAngle(rotate);
|
marker.setRotateAngle(rotate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,7 +157,7 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
|
|||||||
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
|
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
|
||||||
options.icon3DRes(getModelRes(9));
|
options.icon3DRes(getModelRes(9));
|
||||||
options.anchorColor("#FB3C3CFF");
|
options.anchorColor("#FB3C3CFF");
|
||||||
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerShowEntity.getMarkerType(), options);
|
IMogoMarker marker = MogoMarkerManager.getInstance(mContext).addMarker(markerShowEntity.getMarkerType(), options);
|
||||||
iMarkerView.setMarker(marker);
|
iMarkerView.setMarker(marker);
|
||||||
marker.setToTop();
|
marker.setToTop();
|
||||||
return marker;
|
return marker;
|
||||||
|
|||||||
@@ -6,16 +6,14 @@ import com.mogo.map.marker.IMogoMarker;
|
|||||||
import com.mogo.map.marker.IMogoMarkerManager;
|
import com.mogo.map.marker.IMogoMarkerManager;
|
||||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||||
import com.mogo.module.common.MogoApisHandler;
|
import com.mogo.module.common.MogoApisHandler;
|
||||||
import com.mogo.module.common.drawer.MarkerDrawer;
|
|
||||||
import com.mogo.module.common.entity.MarkerResponse;
|
|
||||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
|
||||||
import com.mogo.module.service.marker.MapMarkerManager;
|
import com.mogo.module.service.marker.MapMarkerManager;
|
||||||
import com.mogo.service.IMogoServiceApis;
|
import com.mogo.service.IMogoServiceApis;
|
||||||
import com.mogo.service.analytics.IMogoAnalytics;
|
import com.mogo.service.analytics.IMogoAnalytics;
|
||||||
|
import com.mogo.service.cloud.socket.IMogoSocketManager;
|
||||||
import com.mogo.service.datamanager.IMogoDataManager;
|
import com.mogo.service.datamanager.IMogoDataManager;
|
||||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||||
|
import com.mogo.service.imageloader.IMogoImageloader;
|
||||||
import com.mogo.service.intent.IMogoIntentManager;
|
import com.mogo.service.intent.IMogoIntentManager;
|
||||||
import com.mogo.service.map.IMogoMapService;
|
|
||||||
import com.mogo.service.module.IMogoActionManager;
|
import com.mogo.service.module.IMogoActionManager;
|
||||||
import com.mogo.service.module.IMogoRegisterCenter;
|
import com.mogo.service.module.IMogoRegisterCenter;
|
||||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||||
@@ -31,9 +29,7 @@ public class MarkerServiceHandler {
|
|||||||
private static final String TAG = "MarkerServiceHandler";
|
private static final String TAG = "MarkerServiceHandler";
|
||||||
|
|
||||||
private static IMogoServiceApis sApis;
|
private static IMogoServiceApis sApis;
|
||||||
private static IMogoMapService sMapService;
|
|
||||||
private static IMogoMarkerManager sMarkerManager;
|
|
||||||
private static IMogoMapUIController sMapUIController;
|
|
||||||
private static IMogoStatusManager sMogoStatusManager;
|
private static IMogoStatusManager sMogoStatusManager;
|
||||||
private static IMogoAnalytics sMogoAnalytics;
|
private static IMogoAnalytics sMogoAnalytics;
|
||||||
private static IMogoRegisterCenter sRegisterCenter;
|
private static IMogoRegisterCenter sRegisterCenter;
|
||||||
@@ -44,11 +40,8 @@ public class MarkerServiceHandler {
|
|||||||
|
|
||||||
public static synchronized void init(final Context context) {
|
public static synchronized void init(final Context context) {
|
||||||
sApis = MogoApisHandler.getInstance().getApis();
|
sApis = MogoApisHandler.getInstance().getApis();
|
||||||
sMapService = sApis.getMapServiceApi();
|
|
||||||
sMogoStatusManager = sApis.getStatusManagerApi();
|
sMogoStatusManager = sApis.getStatusManagerApi();
|
||||||
sMogoAnalytics = sApis.getAnalyticsApi();
|
sMogoAnalytics = sApis.getAnalyticsApi();
|
||||||
sMarkerManager = sMapService.getMarkerManager(context);
|
|
||||||
sMapUIController = sMapService.getMapUIController();
|
|
||||||
sRegisterCenter = sApis.getRegisterCenterApi();
|
sRegisterCenter = sApis.getRegisterCenterApi();
|
||||||
sActionManager = sApis.getActionManagerApi();
|
sActionManager = sApis.getActionManagerApi();
|
||||||
sDataManager = sApis.getDataManagerApi();
|
sDataManager = sApis.getDataManagerApi();
|
||||||
@@ -61,18 +54,6 @@ public class MarkerServiceHandler {
|
|||||||
return sApis;
|
return sApis;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IMogoMapService getMapService() {
|
|
||||||
return sMapService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IMogoMarkerManager getMarkerManager() {
|
|
||||||
return sMarkerManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IMogoMapUIController getMapUIController() {
|
|
||||||
return sMapUIController;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IMogoStatusManager getMogoStatusManager() {
|
public static IMogoStatusManager getMogoStatusManager() {
|
||||||
return sMogoStatusManager;
|
return sMogoStatusManager;
|
||||||
}
|
}
|
||||||
@@ -81,10 +62,6 @@ public class MarkerServiceHandler {
|
|||||||
return sMogoAnalytics;
|
return sMogoAnalytics;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MapMarkerManager getMapMarkerManager() {
|
|
||||||
return MapMarkerManager.getInstance();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IMogoRegisterCenter getRegisterCenter() {
|
public static IMogoRegisterCenter getRegisterCenter() {
|
||||||
return sRegisterCenter;
|
return sRegisterCenter;
|
||||||
}
|
}
|
||||||
@@ -104,36 +81,4 @@ public class MarkerServiceHandler {
|
|||||||
public static IMogoDataManager getDataManager() {
|
public static IMogoDataManager getDataManager() {
|
||||||
return sDataManager;
|
return sDataManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO -------------以下方法是临时过度使用的,后面统一使用,getMapMarkerManager进行调用
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 绘制Marker
|
|
||||||
* 建议使用
|
|
||||||
*
|
|
||||||
* @see MapMarkerManager#drawMapMarker(MarkerResponse)
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void drawMapMarker(MarkerResponse response) {
|
|
||||||
getMapMarkerManager().drawMapMarker(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 绘制Marker
|
|
||||||
* 建议使用
|
|
||||||
*
|
|
||||||
* @see MapMarkerManager#drawMapMarker(MarkerShowEntity, int)
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static IMogoMarker drawMapMarker(MarkerShowEntity markerShowEntity) {
|
|
||||||
return getMapMarkerManager().drawMapMarker(markerShowEntity, MarkerDrawer.MARKER_Z_INDEX_HIGH);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 对指定类型高亮处理
|
|
||||||
* 建议使用
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void highlightedMarker(String typeTag) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,12 +22,13 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
|||||||
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler;
|
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler;
|
||||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||||
import com.mogo.map.IDestroyable;
|
import com.mogo.map.IDestroyable;
|
||||||
|
import com.mogo.map.MogoMapUIController;
|
||||||
|
import com.mogo.map.MogoMarkerManager;
|
||||||
import com.mogo.map.listener.IMogoMapListener;
|
import com.mogo.map.listener.IMogoMapListener;
|
||||||
import com.mogo.map.location.IMogoLocationListener;
|
import com.mogo.map.location.IMogoLocationListener;
|
||||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||||
import com.mogo.map.navi.IMogoNaviListener;
|
import com.mogo.map.navi.IMogoNaviListener;
|
||||||
import com.mogo.map.uicontroller.EnumMapUI;
|
import com.mogo.map.uicontroller.EnumMapUI;
|
||||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
|
||||||
import com.mogo.module.common.MogoApisHandler;
|
import com.mogo.module.common.MogoApisHandler;
|
||||||
import com.mogo.module.common.MogoModule;
|
import com.mogo.module.common.MogoModule;
|
||||||
import com.mogo.module.common.MogoModulePaths;
|
import com.mogo.module.common.MogoModulePaths;
|
||||||
@@ -47,7 +48,6 @@ import com.mogo.service.fragmentmanager.FragmentStackTransactionListener;
|
|||||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||||
import com.mogo.service.intent.IMogoIntentListener;
|
import com.mogo.service.intent.IMogoIntentListener;
|
||||||
import com.mogo.service.intent.IMogoIntentManager;
|
import com.mogo.service.intent.IMogoIntentManager;
|
||||||
import com.mogo.service.map.IMogoMapService;
|
|
||||||
import com.mogo.service.module.IMogoActionManager;
|
import com.mogo.service.module.IMogoActionManager;
|
||||||
import com.mogo.service.module.IMogoRegisterCenter;
|
import com.mogo.service.module.IMogoRegisterCenter;
|
||||||
import com.mogo.service.module.MogoAction;
|
import com.mogo.service.module.MogoAction;
|
||||||
@@ -105,8 +105,6 @@ public class MogoServices implements IMogoMapListener,
|
|||||||
|
|
||||||
private MogoLatLng mLastAutoRefreshLocation = null;
|
private MogoLatLng mLastAutoRefreshLocation = null;
|
||||||
|
|
||||||
private IMogoMapUIController mUiController;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否已计算出地图显示状态
|
* 是否已计算出地图显示状态
|
||||||
*/
|
*/
|
||||||
@@ -125,7 +123,6 @@ public class MogoServices implements IMogoMapListener,
|
|||||||
// 上次手动操作的中心点坐标
|
// 上次手动操作的中心点坐标
|
||||||
private MogoLatLng mLastCustomRefreshCenterLocation;
|
private MogoLatLng mLastCustomRefreshCenterLocation;
|
||||||
|
|
||||||
private IMogoMapService mMogoMapService;
|
|
||||||
private IMogoStatusManager mStatusManager;
|
private IMogoStatusManager mStatusManager;
|
||||||
private IMogoIntentManager mIntentManager;
|
private IMogoIntentManager mIntentManager;
|
||||||
private IMogoActionManager mActionManager;
|
private IMogoActionManager mActionManager;
|
||||||
@@ -187,13 +184,13 @@ public class MogoServices implements IMogoMapListener,
|
|||||||
private void invokeAutoRefresh() {
|
private void invokeAutoRefresh() {
|
||||||
if (mStatusManager.isSearchUIShow() || mStatusManager.isV2XShow()) {
|
if (mStatusManager.isSearchUIShow() || mStatusManager.isV2XShow()) {
|
||||||
mStatusManager.setUserInteractionStatus(TAG, true, false);
|
mStatusManager.setUserInteractionStatus(TAG, true, false);
|
||||||
mUiController.recoverLockMode();
|
MogoMapUIController.getInstance().recoverLockMode();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mStatusManager.setUserInteractionStatus(ServiceConst.TYPE, true, false);
|
mStatusManager.setUserInteractionStatus(ServiceConst.TYPE, true, false);
|
||||||
mUiController.changeZoom(ServiceConst.DEFAULT_LOCK_CAR_ZOOM_LEVEL);
|
MogoMapUIController.getInstance().changeZoom(ServiceConst.DEFAULT_LOCK_CAR_ZOOM_LEVEL);
|
||||||
mStatusManager.setUserInteractionStatus(TAG, true, false);
|
mStatusManager.setUserInteractionStatus(TAG, true, false);
|
||||||
mUiController.recoverLockMode();
|
MogoMapUIController.getInstance().recoverLockMode();
|
||||||
notifyRefreshData(mLastAutoRefreshLocation, ServiceConst.DEFAULT_AUTO_REFRESH_DATA_RADIUS, mAutoRefreshCallback);
|
notifyRefreshData(mLastAutoRefreshLocation, ServiceConst.DEFAULT_AUTO_REFRESH_DATA_RADIUS, mAutoRefreshCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -275,10 +272,7 @@ public class MogoServices implements IMogoMapListener,
|
|||||||
public void preInit(Context context) {
|
public void preInit(Context context) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
|
|
||||||
mRefreshModel = new RefreshModel(context);
|
mRefreshModel = new RefreshModel( context );
|
||||||
mMogoMapService = MarkerServiceHandler.getMapService();
|
|
||||||
mUiController = mMogoMapService.getMapUIController();
|
|
||||||
|
|
||||||
mStatusManager = MarkerServiceHandler.getMogoStatusManager();
|
mStatusManager = MarkerServiceHandler.getMogoStatusManager();
|
||||||
mStatusManager.registerStatusChangedListener(ServiceConst.TYPE, StatusDescriptor.USER_INTERACTED, statusChangedListener);
|
mStatusManager.registerStatusChangedListener(ServiceConst.TYPE, StatusDescriptor.USER_INTERACTED, statusChangedListener);
|
||||||
mStatusManager.registerStatusChangedListener(ServiceConst.TYPE, StatusDescriptor.SEARCH_UI, statusChangedListener);
|
mStatusManager.registerStatusChangedListener(ServiceConst.TYPE, StatusDescriptor.SEARCH_UI, statusChangedListener);
|
||||||
@@ -445,7 +439,7 @@ public class MogoServices implements IMogoMapListener,
|
|||||||
switch (motionEvent.getActionMasked()) {
|
switch (motionEvent.getActionMasked()) {
|
||||||
case MotionEvent.ACTION_DOWN:
|
case MotionEvent.ACTION_DOWN:
|
||||||
if (mLastZoomLevel == 0) {
|
if (mLastZoomLevel == 0) {
|
||||||
mLastZoomLevel = mUiController.getZoomLevel();
|
mLastZoomLevel = MogoMapUIController.getInstance().getZoomLevel();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MotionEvent.ACTION_UP:
|
case MotionEvent.ACTION_UP:
|
||||||
@@ -528,8 +522,8 @@ public class MogoServices implements IMogoMapListener,
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int getQueryRadius() {
|
private int getQueryRadius() {
|
||||||
mCameraSouthWestPosition = mUiController.getCameraSouthWestPosition();
|
mCameraSouthWestPosition = MogoMapUIController.getInstance().getCameraSouthWestPosition();
|
||||||
mCameraNorthEastPosition = mUiController.getCameraNorthEastPosition();
|
mCameraNorthEastPosition = MogoMapUIController.getInstance().getCameraNorthEastPosition();
|
||||||
int radius;
|
int radius;
|
||||||
if (mIsVertical) {
|
if (mIsVertical) {
|
||||||
radius = ((int) (getMapCameraFactWidth() / 2));
|
radius = ((int) (getMapCameraFactWidth() / 2));
|
||||||
@@ -594,12 +588,12 @@ public class MogoServices implements IMogoMapListener,
|
|||||||
startFirstLocationRequest(point);
|
startFirstLocationRequest(point);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
float distance = Utils.calculateLineDistance(mLastAutoRefreshLocation, point);
|
float distance = Utils.calculateLineDistance( mLastAutoRefreshLocation, point );
|
||||||
if (distance > mAutoRefreshStrategy.getDistance()) {
|
if ( distance > mAutoRefreshStrategy.getDistance() ) {
|
||||||
mStatusManager.setUserInteractionStatus(ServiceConst.TYPE, true, false);
|
mStatusManager.setUserInteractionStatus( ServiceConst.TYPE, true, false );
|
||||||
mUiController.recoverLockMode();
|
MogoMapUIController.getInstance().recoverLockMode();
|
||||||
mStatusManager.setUserInteractionStatus(TAG, true, false);
|
mStatusManager.setUserInteractionStatus( TAG, true, false );
|
||||||
mUiController.changeZoom(ServiceConst.DEFAULT_ZOOM_LEVEL);
|
MogoMapUIController.getInstance().changeZoom( ServiceConst.DEFAULT_ZOOM_LEVEL );
|
||||||
mLastAutoRefreshLocation = point;
|
mLastAutoRefreshLocation = point;
|
||||||
notifyRefreshData(mLastAutoRefreshLocation, getQueryRadius(), mAutoRefreshCallback);
|
notifyRefreshData(mLastAutoRefreshLocation, getQueryRadius(), mAutoRefreshCallback);
|
||||||
}
|
}
|
||||||
@@ -659,8 +653,8 @@ public class MogoServices implements IMogoMapListener,
|
|||||||
|
|
||||||
public void clearAllData() {
|
public void clearAllData() {
|
||||||
try {
|
try {
|
||||||
MarkerServiceHandler.getMapService().getMarkerManager(mContext).removeMarkers();
|
MogoMarkerManager.getInstance(mContext).removeMarkers();
|
||||||
} catch (Exception e) {
|
} catch ( Exception e ) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -684,9 +678,9 @@ public class MogoServices implements IMogoMapListener,
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void refreshStrategy() {
|
public void refreshStrategy() {
|
||||||
mStatusManager.setUserInteractionStatus(ServiceConst.TYPE, true, false);
|
mStatusManager.setUserInteractionStatus( ServiceConst.TYPE, true, false );
|
||||||
mUiController.recoverLockMode();// 锁车代替移到中心点
|
MogoMapUIController.getInstance().recoverLockMode();// 锁车代替移到中心点
|
||||||
restartAutoRefreshAtTime(0);
|
restartAutoRefreshAtTime( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -729,14 +723,14 @@ public class MogoServices implements IMogoMapListener,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCmdSelected(String cmd) {
|
public void onCmdSelected( String cmd ) {
|
||||||
if (TextUtils.equals(ServiceConst.CMD_UN_WAKE_PREV, cmd)) {
|
if ( TextUtils.equals( ServiceConst.CMD_UN_WAKE_PREV, cmd ) ) {
|
||||||
onActionDone(MogoAction.Prev);
|
onActionDone( MogoAction.Prev );
|
||||||
} else if (TextUtils.equals(ServiceConst.CMD_UN_WAKE_NEXT, cmd)) {
|
} else if ( TextUtils.equals( ServiceConst.CMD_UN_WAKE_NEXT, cmd ) ) {
|
||||||
onActionDone(MogoAction.Next);
|
onActionDone( MogoAction.Next );
|
||||||
} else if (TextUtils.equals(ServiceConst.CMD_UN_WAKEUP_MY_LOCATION, cmd)) {
|
} else if ( TextUtils.equals( ServiceConst.CMD_UN_WAKEUP_MY_LOCATION, cmd ) ) {
|
||||||
if (mStatusManager.isMainPageOnResume()) {
|
if ( mStatusManager.isMainPageOnResume() ) {
|
||||||
mUiController.recoverLockMode();
|
MogoMapUIController.getInstance().recoverLockMode();
|
||||||
}
|
}
|
||||||
} else if (TextUtils.equals(ServiceConst.CMD_BACK, cmd)) {
|
} else if (TextUtils.equals(ServiceConst.CMD_BACK, cmd)) {
|
||||||
mFragmentManager.clearAll();
|
mFragmentManager.clearAll();
|
||||||
@@ -757,17 +751,17 @@ public class MogoServices implements IMogoMapListener,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTransaction(int size) {
|
public void onTransaction( int size ) {
|
||||||
if (size == 0) {
|
if ( size == 0 ) {
|
||||||
mUiController.showMyLocation(true);
|
MogoMapUIController.getInstance().showMyLocation( true );
|
||||||
AIAssist.getInstance(mContext).unregisterUnWakeupCommand(ServiceConst.CMD_BACK);
|
AIAssist.getInstance( mContext ).unregisterUnWakeupCommand( ServiceConst.CMD_BACK );
|
||||||
if (mStatusManager.isSearchUIShow()) {
|
if ( mStatusManager.isSearchUIShow() ) {
|
||||||
mStatusManager.setSearchUIShow(TAG, false);
|
mStatusManager.setSearchUIShow( TAG, false );
|
||||||
}
|
}
|
||||||
mUiController.recoverLockMode();
|
MogoMapUIController.getInstance().recoverLockMode();
|
||||||
} else {
|
} else {
|
||||||
mUiController.showMyLocation(false);
|
MogoMapUIController.getInstance().showMyLocation( false );
|
||||||
AIAssist.getInstance(mContext).registerUnWakeupCommand(ServiceConst.CMD_BACK, ServiceConst.CMD_BACK_WORDS, this);
|
AIAssist.getInstance( mContext ).registerUnWakeupCommand( ServiceConst.CMD_BACK, ServiceConst.CMD_BACK_WORDS, this );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import android.content.Intent;
|
|||||||
import com.mogo.commons.AbsMogoApplication;
|
import com.mogo.commons.AbsMogoApplication;
|
||||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||||
|
import com.mogo.map.MogoLocationClient;
|
||||||
|
import com.mogo.map.MogoMarkerManager;
|
||||||
import com.mogo.module.service.launchercard.LauncherCardRefresher;
|
import com.mogo.module.service.launchercard.LauncherCardRefresher;
|
||||||
import com.mogo.module.service.marker.MapMarkerManager;
|
import com.mogo.module.service.marker.MapMarkerManager;
|
||||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||||
@@ -131,14 +133,14 @@ abstract class StatusChangedAdapter implements IMogoStatusChangedListener {
|
|||||||
mIsFirstAccOn = false;
|
mIsFirstAccOn = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MarkerServiceHandler.getApis().getMapServiceApi().getSingletonLocationClient(AbsMogoApplication.getApp()).start();
|
MogoLocationClient.getInstance(AbsMogoApplication.getApp()).start();
|
||||||
MarkerServiceHandler.getApis().getMapServiceApi().getMarkerManager(AbsMogoApplication.getApp()).removeMarkers();
|
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).removeMarkers();
|
||||||
UiThreadHandler.postDelayed(() -> {
|
UiThreadHandler.postDelayed(() -> {
|
||||||
MogoServices.getInstance().refreshStrategy();
|
MogoServices.getInstance().refreshStrategy();
|
||||||
}, 3_000L);
|
}, 3_000L);
|
||||||
} else {
|
} else {
|
||||||
MarkerServiceHandler.getApis().getMapServiceApi().getSingletonLocationClient(AbsMogoApplication.getApp()).stop();
|
MogoLocationClient.getInstance(AbsMogoApplication.getApp()).stop();
|
||||||
MarkerServiceHandler.getApis().getMapServiceApi().getMarkerManager(AbsMogoApplication.getApp()).removeMarkers();
|
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).removeMarkers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user