[3.4.0-map-sdk] code tyle
This commit is contained in:
@@ -38,6 +38,7 @@ import com.mogo.eagle.core.utilcode.mogo.view.OnPreventFastClickListener;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.listener.MogoMapListenerHandler;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
import com.mogo.och.bus.R;
|
||||
import com.mogo.och.bus.bean.BusRoutesResult;
|
||||
@@ -48,8 +49,6 @@ import com.mogo.och.common.module.utils.SoundPoolHelper;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import bag_manager.BagManagerOuterClass;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import record_cache.RecordPanelOuterClass;
|
||||
@@ -136,18 +135,23 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
|
||||
mSwitchMapModeLayout.setOnClickListener(new OnPreventFastClickListener() {
|
||||
@Override
|
||||
public void onClickImpl(View v) {
|
||||
//切换地图的远近视图
|
||||
if (mapBizView.getUI().getCurrentMapVisualAngle().isLongSight()) {
|
||||
mapBizView.getUI().setLockMode(true);
|
||||
mapBizView.getUI().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_medium);
|
||||
} else if (mapBizView.getUI().getCurrentMapVisualAngle().isMediumSight()) {
|
||||
mapBizView.getUI().setLockMode(false);
|
||||
mapBizView.getUI().changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null);
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_long);
|
||||
} else {
|
||||
mapBizView.getUI().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_medium);
|
||||
if(mapBizView != null){
|
||||
IMogoMapUIController uiController = mapBizView.getUI();
|
||||
if(uiController != null){
|
||||
//切换地图的远近视图
|
||||
if (uiController.getCurrentMapVisualAngle().isLongSight()) {
|
||||
uiController.setLockMode(true);
|
||||
uiController.changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_medium);
|
||||
} else if (uiController.getCurrentMapVisualAngle().isMediumSight()) {
|
||||
uiController.setLockMode(false);
|
||||
uiController.changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null);
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_long);
|
||||
} else {
|
||||
uiController.changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_medium);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -194,7 +198,6 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
|
||||
|
||||
mSettingBtn = findViewById(R.id.module_mogo_och_setting_layout);
|
||||
mSettingBtn.setOnClickListener(v -> {
|
||||
// TODO: 2021/12/9
|
||||
CallerHmiManager.INSTANCE.showToolsView();
|
||||
});
|
||||
|
||||
@@ -251,12 +254,17 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
|
||||
protected abstract void onArriveStation();
|
||||
|
||||
private void updateSwitchMapIcon() {
|
||||
if (mapBizView.getUI().getCurrentMapVisualAngle().isLongSight()) {
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_long);
|
||||
} else if (mapBizView.getUI().getCurrentMapVisualAngle().isMediumSight()) {
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_medium);
|
||||
} else {
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_medium);
|
||||
if(mapBizView != null){
|
||||
IMogoMapUIController uiController = mapBizView.getUI();
|
||||
if(uiController != null){
|
||||
if (uiController.getCurrentMapVisualAngle().isLongSight()) {
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_long);
|
||||
} else if (uiController.getCurrentMapVisualAngle().isMediumSight()) {
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_medium);
|
||||
} else {
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_medium);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -104,17 +104,19 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
|
||||
mSwitchMapModeLayout!!.setOnClickListener(object : OnPreventFastClickListener() {
|
||||
override fun onClickImpl(v: View) {
|
||||
mapBizView?.let {
|
||||
if (it.getUI().currentMapVisualAngle.isLongSight) {
|
||||
it.getUI().setLockMode(true)
|
||||
it.getUI().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null)
|
||||
mSwitchMapModeImage!!.setImageResource(R.drawable.bus_switch_map_medium)
|
||||
} else if (it.getUI().currentMapVisualAngle.isMediumSight) {
|
||||
it.getUI().setLockMode(false)
|
||||
it.getUI().changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null)
|
||||
mSwitchMapModeImage!!.setImageResource(R.drawable.bus_switch_map_long)
|
||||
} else {
|
||||
it.getUI().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null)
|
||||
mSwitchMapModeImage!!.setImageResource(R.drawable.bus_switch_map_medium)
|
||||
it.getUI()?.let { ui ->
|
||||
if (ui.currentMapVisualAngle.isLongSight) {
|
||||
ui.setLockMode(true)
|
||||
ui.changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null)
|
||||
mSwitchMapModeImage!!.setImageResource(R.drawable.bus_switch_map_medium)
|
||||
} else if (ui.currentMapVisualAngle.isMediumSight) {
|
||||
ui.setLockMode(false)
|
||||
ui.changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null)
|
||||
mSwitchMapModeImage!!.setImageResource(R.drawable.bus_switch_map_long)
|
||||
} else {
|
||||
ui.changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null)
|
||||
mSwitchMapModeImage!!.setImageResource(R.drawable.bus_switch_map_medium)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -195,7 +197,7 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
|
||||
smallMapView = findViewById(R.id.smallMapView)
|
||||
}
|
||||
|
||||
override fun initViews(savedInstanceState: Bundle?) {
|
||||
override fun initViews(savedInstanceState: Bundle) {
|
||||
super.initViews(savedInstanceState)
|
||||
mapBizView!!.onCreate(savedInstanceState)
|
||||
smallMapView!!.onCreateView(savedInstanceState)
|
||||
@@ -263,12 +265,14 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
|
||||
|
||||
private fun updateSwitchMapIcon() {
|
||||
mapBizView?.let {
|
||||
if (it.getUI().currentMapVisualAngle.isLongSight) {
|
||||
mSwitchMapModeImage!!.setImageResource(R.drawable.bus_switch_map_long)
|
||||
} else if (it.getUI().currentMapVisualAngle.isMediumSight) {
|
||||
mSwitchMapModeImage!!.setImageResource(R.drawable.bus_switch_map_medium)
|
||||
} else {
|
||||
mSwitchMapModeImage!!.setImageResource(R.drawable.bus_switch_map_medium)
|
||||
it.getUI()?.let { ui ->
|
||||
if (ui.currentMapVisualAngle.isLongSight) {
|
||||
mSwitchMapModeImage!!.setImageResource(R.drawable.bus_switch_map_long)
|
||||
} else if (ui.currentMapVisualAngle.isMediumSight) {
|
||||
mSwitchMapModeImage!!.setImageResource(R.drawable.bus_switch_map_medium)
|
||||
} else {
|
||||
mSwitchMapModeImage!!.setImageResource(R.drawable.bus_switch_map_medium)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ import com.mogo.eagle.core.utilcode.mogo.view.OnPreventFastClickListener;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.listener.MogoMapListenerHandler;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
import com.mogo.och.bus.R;
|
||||
import com.mogo.och.data.bean.BusRoutesResult;
|
||||
@@ -138,17 +139,20 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
|
||||
@Override
|
||||
public void onClickImpl(View v) {
|
||||
if(mapBizView != null){
|
||||
if (mapBizView.getUI().getCurrentMapVisualAngle().isLongSight()) {
|
||||
mapBizView.getUI().setLockMode(true);
|
||||
mapBizView.getUI().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_medium);
|
||||
} else if (mapBizView.getUI().getCurrentMapVisualAngle().isMediumSight()) {
|
||||
mapBizView.getUI().setLockMode(false);
|
||||
mapBizView.getUI().changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null);
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_long);
|
||||
} else {
|
||||
mapBizView.getUI().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_medium);
|
||||
IMogoMapUIController uiController = mapBizView.getUI();
|
||||
if(uiController != null){
|
||||
if (uiController.getCurrentMapVisualAngle().isLongSight()) {
|
||||
uiController.setLockMode(true);
|
||||
uiController.changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_medium);
|
||||
} else if (uiController.getCurrentMapVisualAngle().isMediumSight()) {
|
||||
uiController.setLockMode(false);
|
||||
uiController.changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null);
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_long);
|
||||
} else {
|
||||
uiController.changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_medium);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -258,12 +262,15 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
|
||||
|
||||
private void updateSwitchMapIcon() {
|
||||
if(mapBizView != null){
|
||||
if (mapBizView.getUI().getCurrentMapVisualAngle().isLongSight()) {
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_long);
|
||||
} else if (mapBizView.getUI().getCurrentMapVisualAngle().isMediumSight()) {
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_medium);
|
||||
} else {
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_medium);
|
||||
IMogoMapUIController uiController = mapBizView.getUI();
|
||||
if(uiController != null){
|
||||
if (uiController.getCurrentMapVisualAngle().isLongSight()) {
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_long);
|
||||
} else if (uiController.getCurrentMapVisualAngle().isMediumSight()) {
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_medium);
|
||||
} else {
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_medium);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.listener.MogoMapListenerHandler;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
import com.mogo.och.common.module.map.AmapNaviToDestinationModel;
|
||||
import com.mogo.och.sweeper.R;
|
||||
@@ -155,12 +156,15 @@ public abstract class BaseSweeperTabFragment<V extends IView, P extends Presente
|
||||
|
||||
private void updateSwitchMapIcon() {
|
||||
if(mapBizView != null){
|
||||
if (mapBizView.getUI().getCurrentMapVisualAngle().isLongSight()) {
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.sweeper_switch_map_big_selector);
|
||||
} else if (mapBizView.getUI().getCurrentMapVisualAngle().isMediumSight()) {
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.sweeper_switch_map_small_selector);
|
||||
} else {
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.sweeper_switch_map_small_selector);
|
||||
IMogoMapUIController uiController = mapBizView.getUI();
|
||||
if(uiController != null){
|
||||
if (uiController.getCurrentMapVisualAngle().isLongSight()) {
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.sweeper_switch_map_big_selector);
|
||||
} else if (uiController.getCurrentMapVisualAngle().isMediumSight()) {
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.sweeper_switch_map_small_selector);
|
||||
} else {
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.sweeper_switch_map_small_selector);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -324,15 +328,18 @@ public abstract class BaseSweeperTabFragment<V extends IView, P extends Presente
|
||||
@Override
|
||||
public void onClickImpl(View v) {
|
||||
if(mapBizView != null){
|
||||
if (mapBizView.getUI().getCurrentMapVisualAngle().isLongSight()) {
|
||||
mapBizView.getUI().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.sweeper_switch_map_small_selector);
|
||||
} else if (mapBizView.getUI().getCurrentMapVisualAngle().isMediumSight()) {
|
||||
mapBizView.getUI().changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null);
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.sweeper_switch_map_big_selector);
|
||||
} else {
|
||||
mapBizView.getUI().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.sweeper_switch_map_big_selector);
|
||||
IMogoMapUIController uiController = mapBizView.getUI();
|
||||
if(uiController != null){
|
||||
if (uiController.getCurrentMapVisualAngle().isLongSight()) {
|
||||
uiController.changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.sweeper_switch_map_small_selector);
|
||||
} else if (uiController.getCurrentMapVisualAngle().isMediumSight()) {
|
||||
uiController.changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null);
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.sweeper_switch_map_big_selector);
|
||||
} else {
|
||||
uiController.changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.sweeper_switch_map_big_selector);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ enum class TaxiOrderStatusEnum(val code: Int) {
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun valueOf(code: Int): TaxiOrderStatusEnum? {
|
||||
fun valueOf(code: Int): TaxiOrderStatusEnum {
|
||||
for (value in values()) {
|
||||
if (value.code == code) {
|
||||
return value
|
||||
|
||||
@@ -894,12 +894,9 @@ public class TaxiModel {
|
||||
|
||||
//检测当前订单
|
||||
public boolean checkCurrentOCHOrder() {
|
||||
if (mCurrentOCHOrder != null
|
||||
return mCurrentOCHOrder != null
|
||||
&& mCurrentOCHOrder.startSiteGcjPoint != null
|
||||
&& mCurrentOCHOrder.endSiteGcjPoint != null) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
&& mCurrentOCHOrder.endSiteGcjPoint != null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -41,6 +41,7 @@ import com.mogo.eagle.core.utilcode.mogo.view.OnPreventFastClickListener;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
import com.mogo.och.common.module.utils.AnimatorDrawableUtil;
|
||||
import com.mogo.och.taxi.R;
|
||||
@@ -188,16 +189,19 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
|
||||
long start = SystemClock.elapsedRealtime();
|
||||
try {
|
||||
if(mapBizView != null){
|
||||
if (mapBizView.getUI().getCurrentMapVisualAngle().isLongSight()) {
|
||||
mapBizView.getUI().setLockMode(true);
|
||||
mapBizView.getUI().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
|
||||
mSwitchBtnIcon.setImageResource(R.drawable.taxi_switch_map_medium);
|
||||
} else if (mapBizView.getUI().getCurrentMapVisualAngle().isMediumSight()) {
|
||||
mapBizView.getUI().setLockMode(false);
|
||||
mapBizView.getUI().changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null);
|
||||
mSwitchBtnIcon.setImageResource(R.drawable.taxi_switch_map_long);
|
||||
} else {
|
||||
mSwitchBtnIcon.setImageResource(R.drawable.taxi_switch_map_medium);
|
||||
IMogoMapUIController uiController = mapBizView.getUI();
|
||||
if(uiController != null){
|
||||
if (uiController.getCurrentMapVisualAngle().isLongSight()) {
|
||||
uiController.setLockMode(true);
|
||||
uiController.changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
|
||||
mSwitchBtnIcon.setImageResource(R.drawable.taxi_switch_map_medium);
|
||||
} else if (uiController.getCurrentMapVisualAngle().isMediumSight()) {
|
||||
uiController.setLockMode(false);
|
||||
uiController.changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null);
|
||||
mSwitchBtnIcon.setImageResource(R.drawable.taxi_switch_map_long);
|
||||
} else {
|
||||
mSwitchBtnIcon.setImageResource(R.drawable.taxi_switch_map_medium);
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
@@ -320,12 +324,15 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
|
||||
|
||||
private void updateSwitchMapIcon() {
|
||||
if(mapBizView != null){
|
||||
if (mapBizView.getUI().getCurrentMapVisualAngle().isLongSight()) {
|
||||
mSwitchBtnIcon.setImageResource(R.drawable.taxi_switch_map_long);
|
||||
} else if (mapBizView.getUI().getCurrentMapVisualAngle().isMediumSight()) {
|
||||
mSwitchBtnIcon.setImageResource(R.drawable.taxi_switch_map_medium);
|
||||
} else {
|
||||
mSwitchBtnIcon.setImageResource(R.drawable.taxi_switch_map_medium);
|
||||
IMogoMapUIController uiController = mapBizView.getUI();
|
||||
if(uiController != null){
|
||||
if (uiController.getCurrentMapVisualAngle().isLongSight()) {
|
||||
mSwitchBtnIcon.setImageResource(R.drawable.taxi_switch_map_long);
|
||||
} else if (uiController.getCurrentMapVisualAngle().isMediumSight()) {
|
||||
mSwitchBtnIcon.setImageResource(R.drawable.taxi_switch_map_medium);
|
||||
} else {
|
||||
mSwitchBtnIcon.setImageResource(R.drawable.taxi_switch_map_medium);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ class TaxiPassengerBaseFragment() :
|
||||
initListener()
|
||||
}
|
||||
|
||||
override fun initViews(savedInstanceState: Bundle?) {
|
||||
override fun initViews(savedInstanceState: Bundle) {
|
||||
super.initViews(savedInstanceState)
|
||||
mapBizView!!.onCreate(savedInstanceState)
|
||||
overMapView.onCreateView(savedInstanceState)
|
||||
@@ -144,9 +144,9 @@ class TaxiPassengerBaseFragment() :
|
||||
when (bottom.getCurrentPage()) {
|
||||
BottomBar.SelectView.PRECISIONMAP -> {
|
||||
//切换到地图中间
|
||||
mapBizView.getUI().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null)
|
||||
mapBizView.getUI()?.changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null)
|
||||
// 切换缩放到中视角
|
||||
mapBizView.getUI().changeZoom2(0.8f)
|
||||
mapBizView.getUI()?.changeZoom2(0.8f)
|
||||
}
|
||||
BottomBar.SelectView.OVERMAPVIEW -> {
|
||||
overMapView.displayCustomOverView()
|
||||
|
||||
@@ -53,7 +53,7 @@ class MapPointCloudSubscriber private constructor()
|
||||
|
||||
CallerLogger.d(M_MAP + TAG, "====开始传入地图点云数据====")
|
||||
val result = CallerMapUIServiceManager.getMapUIController()?.updatePointCloud(pointCloud,
|
||||
isTrasformer = true, isResidual = false, isReset = false
|
||||
isTransformer = true, isResidual = false, isReset = false
|
||||
)
|
||||
CallerLogger.d(M_MAP + TAG, "====结束传入地图点云数据=====$result")
|
||||
} else {
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.mogo.eagle.core.function.business.identify
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import androidx.collection.ArraySet
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.module.status.MogoStatusManager
|
||||
import com.mogo.map.identify.MogoIdentifyManager
|
||||
import mogo.yycp.api.proto.SocketDownData
|
||||
@@ -10,10 +9,6 @@ import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
class IdentifyAiCloudDataDrawer : Identify {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "IdentifyDataDrawer"
|
||||
}
|
||||
|
||||
/**
|
||||
* 上一帧数据的缓存
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.mogo.eagle.core.function.business.identify
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.module.status.MogoStatusManager
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData
|
||||
import com.mogo.map.identify.MogoIdentifyManager
|
||||
@@ -13,10 +12,6 @@ import mogo.telematics.pad.MessagePad.TrackedObject
|
||||
*/
|
||||
class IdentifyBeautifyDataDrawer : Identify {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "IdentifyDataDrawer"
|
||||
}
|
||||
|
||||
override fun renderPlanningWarningObj(planningObjects: List<MessagePad.PlanningObject>?) {
|
||||
TrackManager.getInstance().renderPlanningWarningObj(planningObjects)
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.mogo.eagle.core.function.business.identify
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import androidx.collection.ArraySet
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.module.status.MogoStatusManager
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData
|
||||
import com.mogo.map.identify.MogoIdentifyManager
|
||||
@@ -17,10 +16,6 @@ import java.util.concurrent.ConcurrentHashMap
|
||||
*/
|
||||
class IdentifyOriginDataDrawer : Identify {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "IdentifyDataDrawer"
|
||||
}
|
||||
|
||||
/**
|
||||
* 上一帧数据的缓存
|
||||
*/
|
||||
|
||||
@@ -28,11 +28,10 @@ class MapBizView(context: Context?, attrs: AttributeSet?) : MogoMapView(context,
|
||||
private const val TAG = "MapBizView"
|
||||
}
|
||||
|
||||
override fun onCreate(bundle: Bundle?) {
|
||||
override fun onCreate(bundle: Bundle) {
|
||||
super.onCreate(bundle)
|
||||
map?.uiController?.showMyLocation(true)
|
||||
initMapView()
|
||||
|
||||
CallerSkinModeListenerManager.addListener(TAG, this)
|
||||
CallerChassisLocationWGS84ListenerManager.addListener(TAG, 20,this)
|
||||
CallerChassisLamplightListenerManager.addListener(TAG, this)
|
||||
@@ -64,19 +63,19 @@ class MapBizView(context: Context?, attrs: AttributeSet?) : MogoMapView(context,
|
||||
}
|
||||
}
|
||||
|
||||
fun getUI(): IMogoMapUIController {
|
||||
return uiController
|
||||
fun getUI(): IMogoMapUIController? {
|
||||
return map?.uiController
|
||||
}
|
||||
|
||||
fun addLine(options:Polyline.Options): IMapPolylineOverlay? {
|
||||
return map.addLine(options)
|
||||
return map?.addLine(options)
|
||||
}
|
||||
|
||||
fun addPoint(options: Point.Options): IMapPointOverlay?{
|
||||
return map.addPoint(options)
|
||||
return map?.addPoint(options)
|
||||
}
|
||||
|
||||
override fun onSaveInstanceState(outState: Bundle?) {
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
super.onSaveInstanceState(outState)
|
||||
}
|
||||
|
||||
@@ -90,9 +89,9 @@ class MapBizView(context: Context?, attrs: AttributeSet?) : MogoMapView(context,
|
||||
|
||||
override fun onSkinModeChange(skinMode: Int) {
|
||||
if (skinMode == 0) {
|
||||
getUI().stepInDayMode(false)
|
||||
getUI()?.stepInDayMode(false)
|
||||
} else if (skinMode == 1) {
|
||||
getUI().stepInDayMode(true)
|
||||
getUI()?.stepInDayMode(true)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,9 +122,9 @@ class MapBizView(context: Context?, attrs: AttributeSet?) : MogoMapView(context,
|
||||
private fun turn(lightNum: Int) {
|
||||
if (currentLevel != lightNum) {
|
||||
when (lightNum) {
|
||||
0 -> getUI().setCarLightsType(0, 500)
|
||||
1 -> getUI().setCarLightsType(1, 500)
|
||||
2 -> getUI().setCarLightsType(2, 500)
|
||||
0 -> getUI()?.setCarLightsType(0, 500)
|
||||
1 -> getUI()?.setCarLightsType(1, 500)
|
||||
2 -> getUI()?.setCarLightsType(2, 500)
|
||||
}
|
||||
currentLevel = lightNum
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ object MapAutoApi {
|
||||
MapStyleHelper.loadStyleOver.set(true)
|
||||
}
|
||||
if (!TextUtils.isEmpty(mapParams.getCachePath())) {
|
||||
MapDataHelper.updateData(context, mapParams.getCachePath()!!)
|
||||
MapDataHelper.updateData(context, mapParams.getCachePath())
|
||||
}else{
|
||||
MapDataHelper.updateData(context, CommonUtils.getCachePath(context))
|
||||
}
|
||||
@@ -194,8 +194,8 @@ object MapAutoApi {
|
||||
mapAutoView.getClerk()?.setIsRecordLogs(isRecordLogs)
|
||||
}
|
||||
|
||||
private val RULE_MORTON: Double = Math.pow(2.0, 32.0) / 360.0
|
||||
private val RULE_MORTON_TO_LONLAT: Double = 360.0 / Math.pow(2.0, 32.0)
|
||||
private val RULE_MORTON: Double = 2.0.pow(32.0) / 360.0
|
||||
private val RULE_MORTON_TO_LONLAT: Double = 360.0 / 2.0.pow(32.0)
|
||||
private val NDS_90_DEGREES: Long = 0x3fffffff
|
||||
private val NDS_180_DEGREES: Long = 0x7fffffff
|
||||
private val NDS_360_DEGREES: Long = 4294967295
|
||||
@@ -275,18 +275,18 @@ object MapAutoApi {
|
||||
// Clerk.add()
|
||||
// if x > 180 degrees, then subtract 360 degrees
|
||||
if (result.x > NDS_180_DEGREES) {
|
||||
result.x -= NDS_360_DEGREES + 1; // add 1 because 0 must be counted as well
|
||||
result.x -= NDS_360_DEGREES + 1 // add 1 because 0 must be counted as well
|
||||
} else if (result.x < -NDS_180_DEGREES) // if x < 180 , x += 360
|
||||
{
|
||||
result.x += NDS_360_DEGREES + 1; // add 1 because 0 must be counted as well
|
||||
result.x += NDS_360_DEGREES + 1 // add 1 because 0 must be counted as well
|
||||
}
|
||||
|
||||
// if y > 90 degrees, then subtract 180 degrees
|
||||
if (result.y > NDS_90_DEGREES) {
|
||||
result.y -= NDS_180_DEGREES + 1; // add 1 because 0 must be counted as well
|
||||
result.y -= NDS_180_DEGREES + 1 // add 1 because 0 must be counted as well
|
||||
} else if (result.y < -NDS_90_DEGREES) // if y < 90, y += 180
|
||||
{
|
||||
result.y += NDS_180_DEGREES + 1; // add 1 because 0 must be counted as well
|
||||
result.y += NDS_180_DEGREES + 1 // add 1 because 0 must be counted as well
|
||||
}
|
||||
}
|
||||
|
||||
@@ -372,13 +372,13 @@ object MapAutoApi {
|
||||
}
|
||||
|
||||
private fun getLeftBottomOfTile(tileId:Long):Coord {
|
||||
return getLeftBottomOfTileWithLevel(tileId, getLevelOfTileId(tileId));
|
||||
return getLeftBottomOfTileWithLevel(tileId, getLevelOfTileId(tileId))
|
||||
}
|
||||
|
||||
fun getLonlatOfTile(tileId: Long):Coord_d{
|
||||
// Clerk.add("$tileId")
|
||||
val coord = getLeftBottomOfTile(tileId)
|
||||
val result = Coord_d();
|
||||
val result = Coord_d()
|
||||
val lon = String.format("%.9f", coord.x * RULE_MORTON_TO_LONLAT).toDouble()
|
||||
val lat = String.format("%.9f", coord.y * RULE_MORTON_TO_LONLAT).toDouble()
|
||||
result.lon = lon
|
||||
@@ -394,7 +394,7 @@ object MapAutoApi {
|
||||
}
|
||||
|
||||
private fun getLeftBottomOfTileWithLevel(tileId:Long, level:Int):Coord {
|
||||
val indexOfTile = getIndexOfTileIdWithLevel(tileId,level).toLong()
|
||||
val indexOfTile = getIndexOfTileIdWithLevel(tileId,level)
|
||||
//System.out.println("indexOfTile:level:${level},${indexOfTile}")
|
||||
val mortonCode = indexOfTile shl (2 * (31 - level))
|
||||
// val mortonCode1 = tileId*Math.pow(2.0,2.0*(31-level)).toLong()
|
||||
@@ -404,10 +404,10 @@ object MapAutoApi {
|
||||
//System.out.println("mortonCodeToCoord:${coord.x},${coord.y}")
|
||||
normalizeCoord(coord)
|
||||
// NOTE: 处理边界的偏移问题
|
||||
coord.x += 1;
|
||||
coord.y += 1;
|
||||
coord.x += 1
|
||||
coord.y += 1
|
||||
//System.out.println("normalizeCoord:${coord.x},${coord.y}")
|
||||
return coord;
|
||||
return coord
|
||||
}
|
||||
|
||||
fun getTileBoundingBox(tileId:Long):Box{
|
||||
@@ -415,7 +415,7 @@ object MapAutoApi {
|
||||
val level = getLevelOfTileId(tileId)
|
||||
// println("level:$level")
|
||||
val coord = getLeftBottomOfTileWithLevel(tileId, level)
|
||||
val result = Box();
|
||||
val result = Box()
|
||||
val lon = String.format("%.9f", coord.x * RULE_MORTON_TO_LONLAT).toDouble()
|
||||
val lat = String.format("%.9f", coord.y * RULE_MORTON_TO_LONLAT).toDouble()
|
||||
result.lbLon = lon
|
||||
@@ -489,7 +489,7 @@ object MapAutoApi {
|
||||
val curLon = 112.598977
|
||||
val curLat = 26.831300
|
||||
println("---$curLon,$curLat-----")
|
||||
tileId = getTileID(curLon,curLat,16)
|
||||
// tileId = getTileID(curLon,curLat,16)
|
||||
tileId = 5572659558
|
||||
println("getTileID-16:${tileId}")
|
||||
var box = getTileBoundingBox(tileId)
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-18
|
||||
* <p>
|
||||
* 生命周期
|
||||
*/
|
||||
public interface ILifeCycle {
|
||||
|
||||
void onCreate( Bundle bundle );
|
||||
|
||||
void onResume();
|
||||
|
||||
void onPause();
|
||||
|
||||
void onDestroy();
|
||||
|
||||
void onSaveInstanceState( Bundle outState );
|
||||
|
||||
// mapview only.
|
||||
void onLowMemory();
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.mogo.map
|
||||
|
||||
import android.os.Bundle
|
||||
|
||||
/**
|
||||
* 生命周期
|
||||
*/
|
||||
interface ILifeCycle {
|
||||
fun onCreate(bundle: Bundle)
|
||||
fun onResume()
|
||||
fun onPause()
|
||||
fun onDestroy()
|
||||
fun onSaveInstanceState(outState: Bundle)
|
||||
// mapview only.
|
||||
fun onLowMemory()
|
||||
}
|
||||
@@ -1,38 +1,34 @@
|
||||
package com.mogo.map;
|
||||
package com.mogo.map
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-18
|
||||
* <p>
|
||||
* 图层控制
|
||||
*/
|
||||
public interface IMogoUiSettings {
|
||||
|
||||
interface IMogoUiSettings {
|
||||
/**
|
||||
* 设置比例尺功能是否可用。
|
||||
*/
|
||||
void setScaleControlsEnabled( boolean enabled );
|
||||
fun setScaleControlsEnabled(enabled: Boolean)
|
||||
|
||||
/**
|
||||
* 这个方法设置了地图是否允许显示缩放按钮。如果允许,则在地图上显示。
|
||||
*
|
||||
* @param enabled
|
||||
*/
|
||||
void setZoomControlsEnabled( boolean enabled );
|
||||
fun setZoomControlsEnabled(enabled: Boolean)
|
||||
|
||||
/**
|
||||
* 这个方法设置了地图是否允许显示指南针
|
||||
*
|
||||
* @param enabled
|
||||
*/
|
||||
void setCompassEnabled( boolean enabled );
|
||||
fun setCompassEnabled(enabled: Boolean)
|
||||
|
||||
/**
|
||||
* 设置定位按钮是否显示
|
||||
*
|
||||
* @param enabled
|
||||
*/
|
||||
void setMyLocationButtonEnabled( boolean enabled );
|
||||
fun setMyLocationButtonEnabled(enabled: Boolean)
|
||||
|
||||
/**
|
||||
* 这个方法设置了地图是否允许通过手势来移动。如果允许,则用户可以通过按住地图移动来改变可视区域。
|
||||
@@ -40,7 +36,7 @@ public interface IMogoUiSettings {
|
||||
*
|
||||
* @param enabled
|
||||
*/
|
||||
void setScrollGesturesEnabled( boolean enabled );
|
||||
fun setScrollGesturesEnabled(enabled: Boolean)
|
||||
|
||||
/**
|
||||
* 这个方法设置了地图是否允许通过手势来缩放。
|
||||
@@ -49,20 +45,16 @@ public interface IMogoUiSettings {
|
||||
*
|
||||
* @param enabled
|
||||
*/
|
||||
void setZoomGesturesEnabled( boolean enabled );
|
||||
|
||||
void setTiltGesturesEnabled( boolean enabled );
|
||||
|
||||
void setRotateGesturesEnabled( boolean enabled );
|
||||
fun setZoomGesturesEnabled(enabled: Boolean)
|
||||
fun setTiltGesturesEnabled(enabled: Boolean)
|
||||
fun setRotateGesturesEnabled(enabled: Boolean)
|
||||
|
||||
/**
|
||||
* 设置当前地图是否支持所有手势。这个设置不影响用户在点击屏幕上的按钮(如缩放按钮)的效果,也不影响用户在程序里对地图的操作。
|
||||
*
|
||||
* @param enabled
|
||||
*/
|
||||
void setAllGesturesEnabled( boolean enabled );
|
||||
|
||||
void setIndoorSwitchEnabled( boolean enabled );
|
||||
|
||||
void setLogoEnable( boolean enabled );
|
||||
}
|
||||
fun setAllGesturesEnabled(enabled: Boolean)
|
||||
fun setIndoorSwitchEnabled(enabled: Boolean)
|
||||
fun setLogoEnable(enabled: Boolean)
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.mogo.map.identity;
|
||||
|
||||
import java.util.HashMap;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo.yycp.api.proto.SocketDownData;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-25
|
||||
* <p>
|
||||
* 地图 marker 管理
|
||||
*/
|
||||
public interface IMogoIdentifyManager {
|
||||
|
||||
|
||||
/**
|
||||
* 要移除的感知数据uuid
|
||||
*
|
||||
* @param uuidString
|
||||
*/
|
||||
void removeMarker(String uuidString);
|
||||
|
||||
/**
|
||||
* 批量更新锚点位置
|
||||
*
|
||||
* @param optionsArrayList 锚点集合
|
||||
*/
|
||||
void updateBatchMarkerPosition(HashMap<String, MessagePad.TrackedObject> optionsArrayList);
|
||||
|
||||
/**
|
||||
* 批量更新锚点位置
|
||||
*
|
||||
* @param optionsArrayList 锚点集合
|
||||
*/
|
||||
void updateBatchAiMarkerPosition(HashMap<String, SocketDownData.CloudRoadDataProto> optionsArrayList);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.mogo.map.identity
|
||||
|
||||
import mogo.telematics.pad.MessagePad.TrackedObject
|
||||
import mogo.yycp.api.proto.SocketDownData
|
||||
import java.util.HashMap
|
||||
|
||||
/**
|
||||
* 地图 marker 管理
|
||||
*/
|
||||
interface IMogoIdentifyManager {
|
||||
/**
|
||||
* 要移除的感知数据uuid
|
||||
*
|
||||
* @param uuidString
|
||||
*/
|
||||
fun removeMarker(uuidString: String?)
|
||||
|
||||
/**
|
||||
* 批量更新锚点位置
|
||||
*
|
||||
* @param optionsArrayList 锚点集合
|
||||
*/
|
||||
fun updateBatchMarkerPosition(optionsArrayList: HashMap<String, TrackedObject>)
|
||||
|
||||
/**
|
||||
* 批量更新锚点位置
|
||||
*
|
||||
* @param optionsArrayList 锚点集合
|
||||
*/
|
||||
fun updateBatchAiMarkerPosition(optionsArrayList: HashMap<String, SocketDownData.CloudRoadDataProto>)
|
||||
}
|
||||
@@ -22,40 +22,30 @@ public interface IMogoMapListener {
|
||||
|
||||
/**
|
||||
* 地图点击
|
||||
*
|
||||
* @param motionEvent
|
||||
*/
|
||||
default void onTouch(MotionEvent motionEvent) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 地图点击
|
||||
*
|
||||
* @param latLng
|
||||
*/
|
||||
default void onMapClick(MogoLatLng latLng) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 地图锁定
|
||||
*
|
||||
* @param isLock
|
||||
*/
|
||||
default void onLockMap(boolean isLock) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 地图白天黑夜、导航视角切换
|
||||
*
|
||||
* @param ui
|
||||
*/
|
||||
default void onMapModeChanged(EnumMapUI ui) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 地图视距切换回调
|
||||
*
|
||||
* @param visualAngleMode
|
||||
*/
|
||||
default void onMapVisualAngleChanged(VisualAngleMode visualAngleMode) {
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.mogo.map.location
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
|
||||
/**
|
||||
* 高德定位位置监听
|
||||
*/
|
||||
interface IMoGoGDLocationListener {
|
||||
/**
|
||||
* 位置信息
|
||||
*
|
||||
* @param mogoLocation 位置信息
|
||||
*/
|
||||
fun onLocationChanged(mogoLocation: MogoLocation)
|
||||
}
|
||||
@@ -18,7 +18,7 @@ interface IMogoMapUIController {
|
||||
/**
|
||||
* 修改缩放级别
|
||||
*/
|
||||
fun changeZoom(zoom: Float): MapControlResult
|
||||
fun changeZoom(zoom: Float)
|
||||
|
||||
/**
|
||||
* 修改缩放级别的另一种方式
|
||||
@@ -271,14 +271,14 @@ interface IMogoMapUIController {
|
||||
|
||||
/**
|
||||
* 更新点云数据
|
||||
* @param dataStr 点云数据
|
||||
* @param isTrasformer 是否需要转换坐标
|
||||
* @param dataArray 点云数据
|
||||
* @param isTransformer 是否需要转换坐标
|
||||
* @param isResidual 是否需要差量更新
|
||||
* @param isStrong 是否加粗显示
|
||||
* @param isReset 是否加粗显示
|
||||
* @return 是否执行
|
||||
*/
|
||||
fun updatePointCloud(
|
||||
dataArray: ByteArray?, isTrasformer: Boolean,
|
||||
dataArray: ByteArray?, isTransformer: Boolean,
|
||||
isResidual: Boolean, isReset: Boolean
|
||||
): Boolean
|
||||
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
package com.mogo.map.uicontroller;
|
||||
|
||||
public interface IMogoMapVisualAngle {
|
||||
|
||||
boolean isLongSight();
|
||||
|
||||
boolean isCloseSight();
|
||||
|
||||
boolean isMediumSight();
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.mogo.map.uicontroller
|
||||
|
||||
interface IMogoMapVisualAngle {
|
||||
val isLongSight: Boolean
|
||||
val isCloseSight: Boolean
|
||||
val isMediumSight: Boolean
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package com.mogo.map.uicontroller;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-01
|
||||
* <p>
|
||||
* 地图控制结果
|
||||
*/
|
||||
public enum MapControlResult {
|
||||
|
||||
/**
|
||||
* 成功
|
||||
*/
|
||||
SUCCESS,
|
||||
|
||||
/**
|
||||
* 当前已经为预期结果
|
||||
*/
|
||||
TARGET,
|
||||
|
||||
/**
|
||||
* 失败
|
||||
*/
|
||||
FAIL,
|
||||
|
||||
/**
|
||||
* 错误,未执行
|
||||
*/
|
||||
ERROR
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
package com.mogo.map.uicontroller;
|
||||
|
||||
/**
|
||||
* 切换视距
|
||||
*
|
||||
* @author zhongchao
|
||||
*/
|
||||
public enum VisualAngleMode implements IMogoMapVisualAngle {
|
||||
|
||||
/**
|
||||
* 视距近景
|
||||
*/
|
||||
MODE_CLOSE_SIGHT(0),
|
||||
|
||||
/**
|
||||
* 视距中景
|
||||
*/
|
||||
MODE_MEDIUM_SIGHT(1),
|
||||
|
||||
/**
|
||||
* 视距远景
|
||||
*/
|
||||
MODE_LONG_SIGHT(2),
|
||||
|
||||
/**
|
||||
* 后方来车300视角
|
||||
*/
|
||||
MAP_STYLE_VR_ANGLE_300(3),
|
||||
|
||||
/**
|
||||
* 顶视角
|
||||
*/
|
||||
MAP_STYLE_VR_ANGLE_TOP(4),
|
||||
|
||||
/**
|
||||
* 十字路口视角
|
||||
*/
|
||||
MAP_STYLE_VR_ANGLE_CROSS(5),
|
||||
|
||||
/**
|
||||
* 漫游模式
|
||||
*/
|
||||
MAP_STYLE_VR_ROMA(7);
|
||||
|
||||
|
||||
private final int code;
|
||||
|
||||
VisualAngleMode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLongSight() {
|
||||
return code == MODE_LONG_SIGHT.getCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCloseSight() {
|
||||
return code == MODE_CLOSE_SIGHT.getCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMediumSight() {
|
||||
return code == MODE_MEDIUM_SIGHT.getCode();
|
||||
}
|
||||
|
||||
public boolean isRoma(){
|
||||
return code == MAP_STYLE_VR_ROMA.getCode();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.mogo.map.uicontroller
|
||||
|
||||
/**
|
||||
* 切换视距
|
||||
*/
|
||||
enum class VisualAngleMode(val code: Int) : IMogoMapVisualAngle {
|
||||
/**
|
||||
* 视距近景
|
||||
*/
|
||||
MODE_CLOSE_SIGHT(0),
|
||||
|
||||
/**
|
||||
* 视距中景
|
||||
*/
|
||||
MODE_MEDIUM_SIGHT(1),
|
||||
|
||||
/**
|
||||
* 视距远景
|
||||
*/
|
||||
MODE_LONG_SIGHT(2),
|
||||
|
||||
/**
|
||||
* 后方来车300视角
|
||||
*/
|
||||
MAP_STYLE_VR_ANGLE_300(3),
|
||||
|
||||
/**
|
||||
* 顶视角
|
||||
*/
|
||||
MAP_STYLE_VR_ANGLE_TOP(4),
|
||||
|
||||
/**
|
||||
* 十字路口视角
|
||||
*/
|
||||
MAP_STYLE_VR_ANGLE_CROSS(5),
|
||||
|
||||
/**
|
||||
* 漫游模式
|
||||
*/
|
||||
MAP_STYLE_VR_ROMA(7);
|
||||
|
||||
override val isLongSight: Boolean
|
||||
get() = code == code
|
||||
override val isCloseSight: Boolean
|
||||
get() = code == code
|
||||
override val isMediumSight: Boolean
|
||||
get() = code == code
|
||||
val isRoma: Boolean
|
||||
get() = code == code
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
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 final MapAutoViewHelper mUiSettings;
|
||||
|
||||
public AMapUiSettingsWrapper( MapAutoViewHelper mUiSettings ) {
|
||||
this.mUiSettings = mUiSettings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setScaleControlsEnabled( boolean enabled ) {
|
||||
if ( mUiSettings != null ) {
|
||||
if(enabled){
|
||||
mUiSettings.showScale();
|
||||
}else{
|
||||
mUiSettings.hiddenScale();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.mogo.map
|
||||
|
||||
import com.zhidaoauto.map.sdk.open.view.MapAutoViewHelper
|
||||
|
||||
/**
|
||||
* 代理自研地图UiSettings
|
||||
*/
|
||||
class AMapUiSettingsWrapper(private val mUiSettings: MapAutoViewHelper?) : IMogoUiSettings {
|
||||
|
||||
override fun setScaleControlsEnabled(enabled: Boolean) {
|
||||
if (enabled) {
|
||||
mUiSettings?.showScale()
|
||||
} else {
|
||||
mUiSettings?.hiddenScale()
|
||||
}
|
||||
}
|
||||
|
||||
override fun setZoomControlsEnabled(enabled: Boolean) {
|
||||
mUiSettings?.setZoomGesturesEnabled(enabled)
|
||||
}
|
||||
|
||||
override fun setCompassEnabled(enabled: Boolean) {
|
||||
if (enabled) {
|
||||
mUiSettings?.showDirection()
|
||||
} else {
|
||||
mUiSettings?.hiddenDirection()
|
||||
}
|
||||
}
|
||||
|
||||
override fun setMyLocationButtonEnabled(enabled: Boolean) {
|
||||
if (enabled) {
|
||||
mUiSettings?.showLocation()
|
||||
} else {
|
||||
mUiSettings?.hiddenLocation()
|
||||
}
|
||||
}
|
||||
|
||||
override fun setScrollGesturesEnabled(enabled: Boolean) {
|
||||
mUiSettings?.setScrollGesturesEnabled(enabled)
|
||||
}
|
||||
|
||||
override fun setZoomGesturesEnabled(enabled: Boolean) {
|
||||
mUiSettings?.setZoomGesturesEnabled(enabled)
|
||||
}
|
||||
|
||||
override fun setTiltGesturesEnabled(enabled: Boolean) {
|
||||
mUiSettings?.setTiltGesturesEnabled(enabled)
|
||||
}
|
||||
|
||||
override fun setRotateGesturesEnabled(enabled: Boolean) {
|
||||
mUiSettings?.setRotateGesturesEnabled(enabled)
|
||||
}
|
||||
|
||||
override fun setAllGesturesEnabled(enabled: Boolean) {
|
||||
mUiSettings?.setAllGesturesEnabled(enabled)
|
||||
}
|
||||
|
||||
override fun setIndoorSwitchEnabled(enabled: Boolean) {
|
||||
// mUiSettings.setIndoorSwitchEnabled( enabled )
|
||||
}
|
||||
|
||||
override fun setLogoEnable(enabled: Boolean) {
|
||||
if (mUiSettings != null) {
|
||||
try {
|
||||
val method = mUiSettings.javaClass.getMethod(
|
||||
"setLogoEnable",
|
||||
Boolean::class.javaPrimitiveType
|
||||
)
|
||||
method.isAccessible = true
|
||||
method.invoke(mUiSettings, enabled)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -122,7 +122,7 @@ class AMapViewWrapper(mMapView: MapAutoView) : IMogoMapView, IMogoMapUIControlle
|
||||
return mIMap
|
||||
}
|
||||
|
||||
override fun onCreate(bundle: Bundle?) {
|
||||
override fun onCreate(bundle: Bundle) {
|
||||
mMapView.onCreate(bundle)
|
||||
d(SceneConstant.M_MAP + TAG, "map onCreate")
|
||||
}
|
||||
@@ -258,11 +258,10 @@ class AMapViewWrapper(mMapView: MapAutoView) : IMogoMapView, IMogoMapUIControlle
|
||||
return ret
|
||||
}
|
||||
|
||||
override fun changeZoom(zoom: Float): MapControlResult {
|
||||
override fun changeZoom(zoom: Float) {
|
||||
if (checkAMapView()) {
|
||||
mMapView.getMapAutoViewHelper()!!.setZoom(zoom.toInt())
|
||||
}
|
||||
return MapControlResult.SUCCESS
|
||||
}
|
||||
|
||||
override fun changeZoom2(zoom: Float) {
|
||||
@@ -792,10 +791,10 @@ class AMapViewWrapper(mMapView: MapAutoView) : IMogoMapView, IMogoMapUIControlle
|
||||
|
||||
//更新点云
|
||||
override fun updatePointCloud(
|
||||
dataArray: ByteArray?, isTrasformer: Boolean, isResidual: Boolean, isReset: Boolean
|
||||
dataArray: ByteArray?, isTransformer: Boolean, isResidual: Boolean, isReset: Boolean
|
||||
): Boolean {
|
||||
return updatePointCloudDataByPb(
|
||||
dataArray, isTrasformer, isResidual, isReset, mMapView.getMapController()
|
||||
dataArray, isTransformer, isResidual, isReset, mMapView.getMapController()
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,199 +0,0 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.map.overlay.proxy.line.IMapPolylineOverlay;
|
||||
import com.mogo.map.overlay.proxy.point.IMapPointOverlay;
|
||||
import com.mogo.map.overlay.wrapper.point.AMapPointWrapper;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.utils.ObjectUtils;
|
||||
import com.zhidaoauto.map.sdk.open.marker.BatchMarkerOptions;
|
||||
import com.zhidaoauto.map.sdk.open.marker.Marker;
|
||||
import com.zhidaoauto.map.sdk.open.marker.MarkerOptions;
|
||||
import com.zhidaoauto.map.sdk.open.marker.MarkerSimpleData;
|
||||
import com.zhidaoauto.map.sdk.open.poyline.Polyline;
|
||||
import com.zhidaoauto.map.sdk.open.poyline.PolylineOptions;
|
||||
import com.zhidaoauto.map.sdk.open.view.MapAutoView;
|
||||
import com.zhidaoauto.map.sdk.open.view.MapAutoViewHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo.yycp.api.proto.SocketDownData;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-18
|
||||
* <p>
|
||||
* 代理自研AMap
|
||||
*/
|
||||
public class AMapWrapper implements IMogoMap {
|
||||
|
||||
private static final String TAG = "AMapWrapper";
|
||||
|
||||
private final IMogoMapUIController mMapUIController;
|
||||
private MapAutoViewHelper mAMap;
|
||||
private final MapAutoView mMapView;
|
||||
private IMogoUiSettings mUiSettings;
|
||||
|
||||
public AMapWrapper(MapAutoViewHelper map, MapAutoView mapView, IMogoMapUIController controller) {
|
||||
CallerLogger.INSTANCE.i(TAG, "autoop--AMapWrapper: init" + this);
|
||||
this.mAMap = map;
|
||||
this.mMapView = mapView;
|
||||
mMapUIController = controller;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoUiSettings getUiSettings() {
|
||||
if (!checkAMap()) {
|
||||
return null;
|
||||
}
|
||||
if (mUiSettings == null) {
|
||||
mUiSettings = new AMapUiSettingsWrapper(mAMap);
|
||||
}
|
||||
return mUiSettings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMapUIController getUiController() {
|
||||
return mMapUIController;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMapPointOverlay addPoint(@NonNull com.mogo.map.overlay.point.Point.Options options) {
|
||||
if (!checkAMap()) {
|
||||
return null;
|
||||
}
|
||||
MarkerOptions markerOptions = ObjectUtils.fromMogo(options,mMapView);
|
||||
if (markerOptions == null) {
|
||||
CallerLogger.INSTANCE.e(TAG, "marker参数为空");
|
||||
return null;
|
||||
}
|
||||
Marker delegate = mAMap.addMarker(markerOptions);
|
||||
if (delegate == null) {
|
||||
return null;
|
||||
}
|
||||
return new AMapPointWrapper(options.getId(), delegate,mMapView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMapPolylineOverlay addLine(@NonNull com.mogo.map.overlay.line.Polyline.Options options) {
|
||||
if (!checkAMap()) {
|
||||
return null;
|
||||
}
|
||||
PolylineOptions polylineOptions = ObjectUtils.fromMogo(options,mMapView);
|
||||
if (polylineOptions == null) {
|
||||
CallerLogger.INSTANCE.e(TAG, "polyline参数为空");
|
||||
return null;
|
||||
}
|
||||
Polyline delegate = polylineOptions.getLineWidth() > 0 ? mAMap.drawThickLine(polylineOptions) : mAMap.drawLine(polylineOptions);
|
||||
if (delegate == null) {
|
||||
return null;
|
||||
}
|
||||
return new com.mogo.map.overlay.wrapper.line.AMapPolylineWrapper(options.getId(), delegate,mMapView);
|
||||
}
|
||||
|
||||
BatchMarkerOptions batchMarkerOptions = new BatchMarkerOptions();
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Override
|
||||
public void updateBatchMarkerPosition(HashMap<String, MessagePad.TrackedObject> optionsArrayList) {
|
||||
if (!checkAMap()) {
|
||||
return;
|
||||
}
|
||||
if(optionsArrayList == null || optionsArrayList.size() == 0){
|
||||
return;
|
||||
}
|
||||
ArrayList<MarkerSimpleData> markerOptionsArrayList = new ArrayList<>();
|
||||
optionsArrayList.forEach((s, trackedObject) -> {
|
||||
MarkerSimpleData markerOptions = ObjectUtils.fromTrafficData(trackedObject);
|
||||
if (markerOptions != null) {
|
||||
markerOptionsArrayList.add(markerOptions);
|
||||
}
|
||||
});
|
||||
if(markerOptionsArrayList.size() == 0){
|
||||
return;
|
||||
}
|
||||
long time = markerOptionsArrayList.get(0).getTime();
|
||||
batchMarkerOptions.setList(markerOptionsArrayList);
|
||||
batchMarkerOptions.setDelayStrategy(false);
|
||||
batchMarkerOptions.setRuleAngle(8.0f);
|
||||
batchMarkerOptions.setControlIcon(1);
|
||||
batchMarkerOptions.setSatelliteTime(time);
|
||||
batchMarkerOptions.setDeleteRule(0);
|
||||
if(mMapView.getMarkerController() != null){
|
||||
mMapView.getMarkerController().updateBatchMarkerPositon(batchMarkerOptions);
|
||||
}
|
||||
}
|
||||
|
||||
BatchMarkerOptions aiBatchMarkerOptions = new BatchMarkerOptions();
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Override
|
||||
public void updateBatchAiMarkerPosition(HashMap<String, SocketDownData.CloudRoadDataProto> optionsArrayList) {
|
||||
if (!checkAMap()) {
|
||||
return;
|
||||
}
|
||||
if(optionsArrayList == null || optionsArrayList.size() == 0){
|
||||
return;
|
||||
}
|
||||
ArrayList<MarkerSimpleData> markerOptionsArrayList = new ArrayList<>();
|
||||
optionsArrayList.forEach((s, trackedObject) -> {
|
||||
MarkerSimpleData markerOptions = ObjectUtils.fromAiData(trackedObject);
|
||||
if (markerOptions != null) {
|
||||
markerOptionsArrayList.add(markerOptions);
|
||||
}
|
||||
});
|
||||
if(markerOptionsArrayList.size() == 0){
|
||||
return;
|
||||
}
|
||||
long time = markerOptionsArrayList.get(0).getTime();
|
||||
// 最后一个参数,是否管理锚点的删除
|
||||
aiBatchMarkerOptions.setList(markerOptionsArrayList);
|
||||
aiBatchMarkerOptions.setDelayStrategy(false);
|
||||
aiBatchMarkerOptions.setRuleAngle(8.0f);
|
||||
aiBatchMarkerOptions.setControlIcon(1);
|
||||
aiBatchMarkerOptions.setSatelliteTime(time);
|
||||
aiBatchMarkerOptions.setDeleteRule(0);
|
||||
if(mMapView.getMarkerController() != null) {
|
||||
mMapView.getMarkerController().updateBatchMarkerPositon(aiBatchMarkerOptions);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String addPreVehicleModel(int type, int modelRes) {
|
||||
try {
|
||||
if(mMapView.getMarkerController() != null){
|
||||
return mMapView.getMarkerController().addPreVehicleModel(type, modelRes);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeMarker(String uuidString) {
|
||||
try {
|
||||
if(mMapView.getMarkerController() != null){
|
||||
mMapView.getMarkerController().removeMarker(uuidString);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkAMap() {
|
||||
mAMap = mMapView.getMapAutoViewHelper();
|
||||
if (mAMap == null) {
|
||||
CallerLogger.INSTANCE.e(TAG, "自研map实例为空,请检查");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
178
libraries/mogo-map/src/main/java/com/mogo/map/AMapWrapper.kt
Normal file
178
libraries/mogo-map/src/main/java/com/mogo/map/AMapWrapper.kt
Normal file
@@ -0,0 +1,178 @@
|
||||
package com.mogo.map
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.e
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.i
|
||||
import com.mogo.map.overlay.line.Polyline
|
||||
import com.mogo.map.overlay.point.Point
|
||||
import com.mogo.map.overlay.proxy.line.IMapPolylineOverlay
|
||||
import com.mogo.map.overlay.proxy.point.IMapPointOverlay
|
||||
import com.mogo.map.overlay.wrapper.line.AMapPolylineWrapper
|
||||
import com.mogo.map.overlay.wrapper.point.AMapPointWrapper
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController
|
||||
import com.mogo.map.utils.ObjectUtils
|
||||
import com.zhidaoauto.map.sdk.open.marker.BatchMarkerOptions
|
||||
import com.zhidaoauto.map.sdk.open.marker.MarkerSimpleData
|
||||
import com.zhidaoauto.map.sdk.open.view.MapAutoView
|
||||
import com.zhidaoauto.map.sdk.open.view.MapAutoViewHelper
|
||||
import mogo.telematics.pad.MessagePad.TrackedObject
|
||||
import mogo.yycp.api.proto.SocketDownData
|
||||
import java.util.function.BiConsumer
|
||||
|
||||
/**
|
||||
* 代理自研AMap
|
||||
*/
|
||||
class AMapWrapper(map: MapAutoViewHelper?, mapView: MapAutoView, controller: IMogoMapUIController) :
|
||||
IMogoMap {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "AMapWrapper"
|
||||
}
|
||||
|
||||
override val uiController: IMogoMapUIController
|
||||
private var mAMap: MapAutoViewHelper?
|
||||
private val mMapView: MapAutoView
|
||||
private var mUiSettings: IMogoUiSettings? = null
|
||||
override val uiSettings: IMogoUiSettings?
|
||||
get() {
|
||||
if (!checkAMap()) {
|
||||
return null
|
||||
}
|
||||
if (mUiSettings == null) {
|
||||
mUiSettings = AMapUiSettingsWrapper(mAMap)
|
||||
}
|
||||
return mUiSettings
|
||||
}
|
||||
|
||||
override fun addPoint(options: Point.Options): IMapPointOverlay? {
|
||||
if (!checkAMap()) {
|
||||
return null
|
||||
}
|
||||
val markerOptions = ObjectUtils.fromMogo(options, mMapView)
|
||||
if (markerOptions == null) {
|
||||
e(TAG, "marker参数为空")
|
||||
return null
|
||||
}
|
||||
val delegate = mAMap!!.addMarker(markerOptions) ?: return null
|
||||
return AMapPointWrapper(options.id, delegate, mMapView)
|
||||
}
|
||||
|
||||
override fun addLine(options: Polyline.Options): IMapPolylineOverlay? {
|
||||
if (!checkAMap()) {
|
||||
return null
|
||||
}
|
||||
val polylineOptions = ObjectUtils.fromMogo(options, mMapView)
|
||||
if (polylineOptions == null) {
|
||||
e(TAG, "polyline参数为空")
|
||||
return null
|
||||
}
|
||||
val delegate =
|
||||
(if (polylineOptions.lineWidth > 0) mAMap!!.drawThickLine(polylineOptions) else mAMap!!.drawLine(
|
||||
polylineOptions
|
||||
))
|
||||
?: return null
|
||||
return AMapPolylineWrapper(options.id, delegate, mMapView)
|
||||
}
|
||||
|
||||
var batchMarkerOptions = BatchMarkerOptions()
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
override fun updateBatchMarkerPosition(optionsArrayList: HashMap<String, TrackedObject>?) {
|
||||
if (!checkAMap()) {
|
||||
return
|
||||
}
|
||||
if (optionsArrayList == null || optionsArrayList.size == 0) {
|
||||
return
|
||||
}
|
||||
val markerOptionsArrayList = ArrayList<MarkerSimpleData>()
|
||||
optionsArrayList.forEach(BiConsumer { s: String?, trackedObject: TrackedObject? ->
|
||||
val markerOptions = ObjectUtils.fromTrafficData(trackedObject)
|
||||
if (markerOptions != null) {
|
||||
markerOptionsArrayList.add(markerOptions)
|
||||
}
|
||||
})
|
||||
if (markerOptionsArrayList.size == 0) {
|
||||
return
|
||||
}
|
||||
val time = markerOptionsArrayList[0].time
|
||||
batchMarkerOptions.list = markerOptionsArrayList
|
||||
batchMarkerOptions.delayStrategy = false
|
||||
batchMarkerOptions.ruleAngle = 8.0f
|
||||
batchMarkerOptions.controlIcon = 1
|
||||
batchMarkerOptions.satelliteTime = time
|
||||
batchMarkerOptions.deleteRule = 0
|
||||
if (mMapView.getMarkerController() != null) {
|
||||
mMapView.getMarkerController()!!.updateBatchMarkerPositon(batchMarkerOptions)
|
||||
}
|
||||
}
|
||||
|
||||
var aiBatchMarkerOptions = BatchMarkerOptions()
|
||||
|
||||
init {
|
||||
i(TAG, "autoop--AMapWrapper: init$this")
|
||||
mAMap = map
|
||||
mMapView = mapView
|
||||
uiController = controller
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
override fun updateBatchAiMarkerPosition(optionsArrayList: HashMap<String, SocketDownData.CloudRoadDataProto>?) {
|
||||
if (!checkAMap()) {
|
||||
return
|
||||
}
|
||||
if (optionsArrayList == null || optionsArrayList.size == 0) {
|
||||
return
|
||||
}
|
||||
val markerOptionsArrayList = ArrayList<MarkerSimpleData>()
|
||||
optionsArrayList.forEach(BiConsumer { s: String?, trackedObject: SocketDownData.CloudRoadDataProto? ->
|
||||
val markerOptions = ObjectUtils.fromAiData(trackedObject)
|
||||
if (markerOptions != null) {
|
||||
markerOptionsArrayList.add(markerOptions)
|
||||
}
|
||||
})
|
||||
if (markerOptionsArrayList.size == 0) {
|
||||
return
|
||||
}
|
||||
val time = markerOptionsArrayList[0].time
|
||||
// 最后一个参数,是否管理锚点的删除
|
||||
aiBatchMarkerOptions.list = markerOptionsArrayList
|
||||
aiBatchMarkerOptions.delayStrategy = false
|
||||
aiBatchMarkerOptions.ruleAngle = 8.0f
|
||||
aiBatchMarkerOptions.controlIcon = 1
|
||||
aiBatchMarkerOptions.satelliteTime = time
|
||||
aiBatchMarkerOptions.deleteRule = 0
|
||||
if (mMapView.getMarkerController() != null) {
|
||||
mMapView.getMarkerController()!!.updateBatchMarkerPositon(aiBatchMarkerOptions)
|
||||
}
|
||||
}
|
||||
|
||||
override fun addPreVehicleModel(type: Int, modelRes: Int): String? {
|
||||
try {
|
||||
if (mMapView.getMarkerController() != null) {
|
||||
return mMapView.getMarkerController()!!.addPreVehicleModel(type, modelRes)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
override fun removeMarker(uuidString: String?) {
|
||||
try {
|
||||
if (mMapView.getMarkerController() != null) {
|
||||
mMapView.getMarkerController()!!.removeMarker(uuidString!!)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkAMap(): Boolean {
|
||||
mAMap = mMapView.getMapAutoViewHelper()
|
||||
if (mAMap == null) {
|
||||
e(TAG, "自研map实例为空,请检查")
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ import com.zhidaoauto.map.sdk.open.data.CityInfo
|
||||
import com.zhidaoauto.map.sdk.open.data.MapDataApi
|
||||
|
||||
/**
|
||||
* 地图数据工具
|
||||
* 地图数据工具,涉及到数据调用可能会有耗时,建议IO操作
|
||||
*/
|
||||
object MapDataWrapper : IMogoData {
|
||||
|
||||
@@ -68,6 +68,7 @@ object MapDataWrapper : IMogoData {
|
||||
* @param angle 角度
|
||||
* @param call 回调
|
||||
*/
|
||||
@Synchronized
|
||||
override fun getCenterLineRangeInfo(
|
||||
lon: Double,
|
||||
lat: Double,
|
||||
@@ -94,6 +95,7 @@ object MapDataWrapper : IMogoData {
|
||||
* @param angle 角度
|
||||
* @param call 回调
|
||||
*/
|
||||
@Synchronized
|
||||
override fun getLimitSpeed(lon: Double, lat: Double, angle: Float, call: ((Int) -> Unit)) {
|
||||
MapDataApi.getLimitSpeed(lon, lat, angle, object : IResult<RoadInfo> {
|
||||
override fun result(code: Int, result: RoadInfo?) {
|
||||
@@ -109,6 +111,7 @@ object MapDataWrapper : IMogoData {
|
||||
* @param angle 角度
|
||||
* @param call 回调
|
||||
*/
|
||||
@Synchronized
|
||||
override fun getRoadAngle(lon: Double, lat: Double, angle: Float, call: ((Double) -> Unit)) {
|
||||
MapDataApi.getRoadRectInfo(lon, lat, angle, object : IResult<RoadRectInfos> {
|
||||
override fun result(code: Int, result: RoadRectInfos?) {
|
||||
@@ -120,6 +123,7 @@ object MapDataWrapper : IMogoData {
|
||||
/**
|
||||
* 获取道路宽度
|
||||
*/
|
||||
@Synchronized
|
||||
override fun getRoadWidth(
|
||||
lon: Double,
|
||||
lat: Double,
|
||||
@@ -137,6 +141,7 @@ object MapDataWrapper : IMogoData {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Synchronized
|
||||
override fun getAngle(
|
||||
startLon: Double,
|
||||
startLat: Double,
|
||||
@@ -153,6 +158,7 @@ object MapDataWrapper : IMogoData {
|
||||
* @param lat 纬度
|
||||
* @return 瓦片id
|
||||
*/
|
||||
@Synchronized
|
||||
override fun getTileId(lon: Double, lat: Double): Long {
|
||||
return MapAutoApi.getTileID(lon, lat, 13) // 13为默认获取瓦片层级级别
|
||||
}
|
||||
@@ -160,6 +166,7 @@ object MapDataWrapper : IMogoData {
|
||||
/**
|
||||
* 通过cityCode获取HDMap对应缓存城市
|
||||
*/
|
||||
@Synchronized
|
||||
override fun cacheHDDataByCity(
|
||||
progress: (cityId: Int, progress: Double) -> Unit,
|
||||
result: (cityId: Int, state: Int) -> Unit
|
||||
@@ -183,6 +190,7 @@ object MapDataWrapper : IMogoData {
|
||||
/**
|
||||
* 通过经纬度信息,获取HDMap对应缓存城市
|
||||
*/
|
||||
@Synchronized
|
||||
override fun cacheHDDataByCityByLonLat(
|
||||
location: MogoLocation,
|
||||
progress: (cityId: Int, progress: Double) -> Unit,
|
||||
@@ -206,6 +214,7 @@ object MapDataWrapper : IMogoData {
|
||||
/**
|
||||
* 当前城市离线数据是否已缓存
|
||||
*/
|
||||
@Synchronized
|
||||
override fun isCityDataCached(cache: ((Boolean) -> Unit)) {
|
||||
val cityCode = gdLocationClient.lastCityCode
|
||||
i(M_MAP + TAG, "gdCityCode is:$cityCode")
|
||||
@@ -228,6 +237,7 @@ object MapDataWrapper : IMogoData {
|
||||
}
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
override fun cancelDownloadCacheData() {
|
||||
MapDataApi.cancelCacheHDData()
|
||||
}
|
||||
|
||||
@@ -1,120 +0,0 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.zhidaoauto.map.sdk.open.view.MapAutoView;
|
||||
import com.zhidaoauto.map.sdk.open.view.MapStyleParams;
|
||||
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-18
|
||||
* <p>
|
||||
* 地图实例
|
||||
*/
|
||||
public class MogoMapView extends MogoBaseMapView implements ILifeCycle {
|
||||
|
||||
private static final String TAG = "MogoMapView";
|
||||
|
||||
public MogoMapView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public MogoMapView(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public MogoMapView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
private MapAutoView mapAutoView;
|
||||
|
||||
@Override
|
||||
protected void addMapView(Context context, AttributeSet attrs) {
|
||||
if (mapAutoView == null) {
|
||||
if (getStyleParams() == null) {
|
||||
mapAutoView = new MapAutoView(context, attrs);
|
||||
} else {
|
||||
mapAutoView = new MapAutoView(context, getStyleParams());
|
||||
}
|
||||
}
|
||||
if (mMapView == null) {
|
||||
mMapView = new AMapViewWrapper(mapAutoView);
|
||||
final View mapView = mMapView.getMapView();
|
||||
if (mapView != null) {
|
||||
addView(mapView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
||||
} else {
|
||||
CallerLogger.e(TAG, "create MapView instance failed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 子类实现
|
||||
* 代码StyleParams和XML初始化设置同时仅支持一种
|
||||
*
|
||||
* @return MapStyleParams
|
||||
*/
|
||||
protected MapStyleParams getStyleParams() {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected IMogoMapUIController getUIController(){
|
||||
return mMapView.getMap().getUiController();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getInstanceTag() {
|
||||
return MogoMap.DEFAULT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
CallerLogger.d(TAG, "onCreate");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
CallerLogger.d(TAG, "onResume");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
CallerLogger.d(TAG, "onPause");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
CallerLogger.d(TAG, "onDestroy");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLowMemory() {
|
||||
super.onLowMemory();
|
||||
}
|
||||
|
||||
public void setExtraGPSData(MogoLocation gnssInfo) {
|
||||
getMap().getUiController().setExtraGPSData(gnssInfo);
|
||||
}
|
||||
|
||||
}
|
||||
103
libraries/mogo-map/src/main/java/com/mogo/map/MogoMapView.kt
Normal file
103
libraries/mogo-map/src/main/java/com/mogo/map/MogoMapView.kt
Normal file
@@ -0,0 +1,103 @@
|
||||
package com.mogo.map
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.util.AttributeSet
|
||||
import android.view.ViewGroup
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.e
|
||||
import com.zhidaoauto.map.sdk.open.view.MapAutoView
|
||||
import com.zhidaoauto.map.sdk.open.view.MapStyleParams
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-18
|
||||
*
|
||||
*
|
||||
* 地图实例
|
||||
*/
|
||||
open class MogoMapView : MogoBaseMapView, ILifeCycle {
|
||||
constructor(context: Context?) : super(context) {}
|
||||
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) {}
|
||||
constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(
|
||||
context,
|
||||
attrs,
|
||||
defStyleAttr) {
|
||||
}
|
||||
|
||||
private var mapAutoView: MapAutoView? = null
|
||||
|
||||
override fun addMapView(context: Context, attrs: AttributeSet) {
|
||||
if (mapAutoView == null) {
|
||||
mapAutoView = if (styleParams == null) {
|
||||
MapAutoView(context, attrs)
|
||||
} else {
|
||||
MapAutoView(context, styleParams!!)
|
||||
}
|
||||
}
|
||||
if (mMapView == null) {
|
||||
mMapView = AMapViewWrapper(mapAutoView!!)
|
||||
val mapView = mMapView.mapView
|
||||
if (mapView != null) {
|
||||
addView(
|
||||
mapView, LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT
|
||||
)
|
||||
)
|
||||
} else {
|
||||
e(TAG, "create MapView instance failed.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 子类实现
|
||||
* 代码StyleParams和XML初始化设置同时仅支持一种
|
||||
*
|
||||
* @return MapStyleParams
|
||||
*/
|
||||
protected val styleParams: MapStyleParams?
|
||||
protected get() = null
|
||||
|
||||
override fun getInstanceTag(): String {
|
||||
return MogoMap.DEFAULT
|
||||
}
|
||||
|
||||
override fun onCreate(bundle: Bundle) {
|
||||
super.onCreate(bundle)
|
||||
d(TAG, "onCreate")
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
d(TAG, "onResume")
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
d(TAG, "onPause")
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
d(TAG, "onDestroy")
|
||||
}
|
||||
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
super.onSaveInstanceState(outState)
|
||||
}
|
||||
|
||||
override fun onLowMemory() {
|
||||
super.onLowMemory()
|
||||
}
|
||||
|
||||
fun setExtraGPSData(gnssInfo: MogoLocation) {
|
||||
map?.uiController?.setExtraGPSData(gnssInfo)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "MogoMapView"
|
||||
}
|
||||
}
|
||||
@@ -64,15 +64,11 @@ class GDLocationClient private constructor() : AMapLocationListener,
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
if (mLocationClient != null) {
|
||||
mLocationClient.startLocation()
|
||||
}
|
||||
mLocationClient.startLocation()
|
||||
}
|
||||
|
||||
override fun stop() {
|
||||
if (mLocationClient != null) {
|
||||
mLocationClient.stopLocation()
|
||||
}
|
||||
mLocationClient.stopLocation()
|
||||
}
|
||||
|
||||
override fun onLocationChanged(aMapLocation: AMapLocation) {
|
||||
@@ -170,7 +166,7 @@ class GDLocationClient private constructor() : AMapLocationListener,
|
||||
}
|
||||
|
||||
companion object {
|
||||
val gdLocationClient by lazy(LazyThreadSafetyMode.SYNCHRONIZED){
|
||||
val gdLocationClient by lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
|
||||
GDLocationClient()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,6 @@ import java.util.List;
|
||||
*/
|
||||
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() ) {
|
||||
@@ -42,14 +40,14 @@ public class MogoMapUtils {
|
||||
return null;
|
||||
}
|
||||
|
||||
double south = 0.0;
|
||||
double west = 0.0;
|
||||
double south;
|
||||
double west;
|
||||
|
||||
double east = 0.0;
|
||||
double north = 0.0;
|
||||
double east;
|
||||
double north;
|
||||
|
||||
double dLat = 0.0;
|
||||
double dLon = 0.0;
|
||||
double dLat;
|
||||
double dLon;
|
||||
|
||||
if ( latLngBounds.getNortheast() == null ) {
|
||||
dLat = Math.abs( carPosition.lat - latLngBounds.getSouthwest().getLatitude() );
|
||||
|
||||
Reference in New Issue
Block a user