From dd8428fb97c07a73ea98a7f0502cd441c707dc53 Mon Sep 17 00:00:00 2001 From: donghongyu Date: Fri, 13 Jan 2023 17:44:04 +0800 Subject: [PATCH] =?UTF-8?q?[dev=5Farch=5Fopt=5F3.0]=20[Change]=20[=201?= =?UTF-8?q?=E3=80=81=E4=BF=AE=E6=94=B9=E4=BA=86=E9=AB=98=E7=B2=BE=E5=9C=B0?= =?UTF-8?q?=E5=9B=BE=E7=9A=84=E8=AE=BE=E7=BD=AE=E5=A4=96=E9=83=A8=E5=9D=90?= =?UTF-8?q?=E6=A0=87=E7=9A=84=E6=96=B9=E6=B3=95=202=E3=80=81=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=BA=86=E5=9F=BA=E7=A1=80=E3=80=81=E5=87=BA=E7=A7=9F?= =?UTF-8?q?=E8=BD=A6=E3=80=81Bus=E5=B0=8F=E5=9C=B0=E5=9B=BE=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E4=BD=8D=E7=BD=AE=E5=9B=9E=E8=B0=83=EF=BC=8C=E4=BD=BF?= =?UTF-8?q?=E7=94=A8IMoGoChassisLocationGCJ02Listener=E3=80=82=203?= =?UTF-8?q?=E3=80=81TODO=20=E6=9C=89=E4=BA=9B=E9=9C=80=E8=A6=81=E9=AB=98?= =?UTF-8?q?=E5=BE=B7=E5=9C=B0=E5=9B=BE=E7=9A=84=E5=9C=B0=E6=96=B9=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E6=94=B9=E4=B8=BA=E4=BD=BF=E7=94=A8IMoGoChassisLocati?= =?UTF-8?q?onGCJ02Listener=EF=BC=8CWGS84=E7=9A=84=E5=9D=90=E6=A0=87?= =?UTF-8?q?=E4=BD=BF=E7=94=A8IMoGoChassisLocationWGS84Listener=20]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: donghongyu --- .../ui/BusPassengerMapDirectionView.java | 27 ++++---- .../ui/TaxiPassengerMapDirectionView.java | 24 +++---- .../och/taxi/ui/TaxiMapDirectionView.java | 24 +++---- .../autopilot/adapter/MoGoAdasListenerImpl.kt | 2 +- .../function/hmi/ui/widget/SpeedPanelView.kt | 27 ++++---- .../eagle/core/function/map/MapFragment.kt | 5 ++ .../core/function/smp/AMapCustomView.java | 45 ++++++------ .../function/smp/SmallMapDirectionView.java | 35 +++++----- .../src/main/java/com/mogo/map/IMogoMap.java | 68 +++++-------------- .../uicontroller/IMogoMapUIController.java | 9 ++- .../java/com/mogo/map/AMapViewWrapper.java | 58 +++++++--------- .../main/java/com/mogo/map/AMapWrapper.java | 52 ++------------ .../com/mogo/map/MogoMapUIController.java | 16 ++--- .../main/java/com/mogo/map/MogoMapView.java | 8 +++ .../map/uicontroller/AMapUIController.java | 15 ++-- 15 files changed, 171 insertions(+), 244 deletions(-) diff --git a/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/ui/BusPassengerMapDirectionView.java b/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/ui/BusPassengerMapDirectionView.java index 6a54479707..5e262d949f 100644 --- a/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/ui/BusPassengerMapDirectionView.java +++ b/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/ui/BusPassengerMapDirectionView.java @@ -1,5 +1,7 @@ package com.mogo.och.bus.passenger.ui; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS_P; + import android.content.Context; import android.os.Bundle; import android.util.AttributeSet; @@ -25,9 +27,8 @@ import com.amap.api.maps.model.Marker; import com.amap.api.maps.model.MarkerOptions; import com.amap.api.maps.model.Polyline; import com.amap.api.maps.model.PolylineOptions; -import com.mogo.eagle.core.data.map.MogoLocation; -import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener; -import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager; +import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener; +import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ20ListenerManager; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.och.bus.passenger.R; import com.mogo.och.bus.passenger.callback.IBusPassengerMapViewCallback; @@ -36,14 +37,16 @@ import com.mogo.och.bus.passenger.utils.BusPassengerMapAssetStyleUtil; import java.util.ArrayList; import java.util.List; -import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS_P; +import mogo.telematics.pad.MessagePad; /** * 乘客屏小地图 */ public class BusPassengerMapDirectionView extends RelativeLayout - implements IMoGoMapLocationListener, IBusPassengerMapDirectionView, AMap.OnCameraChangeListener { + implements IMoGoChassisLocationGCJ02Listener, + IBusPassengerMapDirectionView, + AMap.OnCameraChangeListener { //小地图名称 public static final String TAG = "TPMapDirectionView"; @@ -101,14 +104,14 @@ public class BusPassengerMapDirectionView initAMapView(); // 注册定位监听 - CallerMapLocationListenerManager.INSTANCE.addListener(TAG, this, false); + CallerChassisLocationGCJ20ListenerManager.INSTANCE.addListener(TAG, this); } @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); // 注册定位监听 - CallerMapLocationListenerManager.INSTANCE.removeListener(TAG, false); + CallerChassisLocationGCJ20ListenerManager.INSTANCE.removeListener(TAG); } private void initAMapView() { @@ -171,19 +174,18 @@ public class BusPassengerMapDirectionView return true; } - @Override - public void onLocationChanged(@org.jetbrains.annotations.Nullable MogoLocation location, int from, boolean isGps) { - if (location == null) { + public void onChassisLocationGCJ02(@Nullable MessagePad.GnssInfo gnssInfo) { + if (gnssInfo == null) { return; } // CallerLogger.INSTANCE.d(M_BUS_P + TAG, "onCarLocationChanged2 :" + location.getLatitude() + ":" + location.getLongitude()); - LatLng currentLatLng = new LatLng(location.getLatitude(), location.getLongitude()); + LatLng currentLatLng = new LatLng(gnssInfo.getLatitude(), gnssInfo.getLongitude()); //更新车辆位置 if (mCarMarker != null) { // CallerLogger.INSTANCE.d(M_BUS_P + TAG, "location.getBearing() = " + location.getBearing()); - mCarMarker.setRotateAngle(360 - location.getBearing()); + mCarMarker.setRotateAngle((float) (360 - gnssInfo.getHeading())); mCarMarker.setPosition(currentLatLng); mCarMarker.setToTop(); } @@ -208,7 +210,6 @@ public class BusPassengerMapDirectionView } - @Override public void drawablePolyline() { if (mPolyline != null) { diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerMapDirectionView.java b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerMapDirectionView.java index 89967334e7..10a9a541fb 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerMapDirectionView.java +++ b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerMapDirectionView.java @@ -29,9 +29,8 @@ import com.amap.api.maps.model.MarkerOptions; import com.amap.api.maps.model.Polyline; import com.amap.api.maps.model.PolylineOptions; import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.data.map.MogoLocation; -import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener; -import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager; +import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener; +import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ20ListenerManager; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.och.taxi.passenger.R; import com.mogo.och.taxi.passenger.callback.ITaxiPassengerMapViewCallback; @@ -40,12 +39,14 @@ import com.mogo.och.taxi.passenger.utils.TaxiPassengerMapAssetStyleUtil; import java.util.ArrayList; import java.util.List; +import mogo.telematics.pad.MessagePad; + /** * 乘客屏小地图 */ public class TaxiPassengerMapDirectionView extends RelativeLayout - implements IMoGoMapLocationListener, ITaxiPassengerMapDirectionView, AMap.OnCameraChangeListener { + implements IMoGoChassisLocationGCJ02Listener, ITaxiPassengerMapDirectionView, AMap.OnCameraChangeListener { //小地图名称 public static final String TAG = "TPMapDirectionView"; @@ -104,14 +105,14 @@ public class TaxiPassengerMapDirectionView initAMapView(); // 注册定位监听 - CallerMapLocationListenerManager.INSTANCE.addListener(TAG, this, false); + CallerChassisLocationGCJ20ListenerManager.INSTANCE.addListener(TAG, this); } @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); // 注册定位监听 - CallerMapLocationListenerManager.INSTANCE.removeListener(TAG, false); + CallerChassisLocationGCJ20ListenerManager.INSTANCE.removeListener(TAG); } private void initAMapView() { @@ -178,13 +179,12 @@ public class TaxiPassengerMapDirectionView return true; } - @Override - public void onLocationChanged(@org.jetbrains.annotations.Nullable MogoLocation location, int from, boolean isGps) { - if (location == null){ + public void onChassisLocationGCJ02(@Nullable MessagePad.GnssInfo gnssInfo) { + if (gnssInfo == null){ return; } - LatLng currentLatLng = new LatLng(location.getLatitude(), location.getLongitude()); + LatLng currentLatLng = new LatLng(gnssInfo.getLatitude(), gnssInfo.getLongitude()); if (mCoordinatesLatLng.size() > 1) { //圈定地图显示范围 @@ -200,13 +200,13 @@ public class TaxiPassengerMapDirectionView } else { //设置希望展示的地图缩放级别 CameraPosition cameraPosition = new CameraPosition.Builder() - .target(mCarMarker.getPosition()).tilt(0).bearing(location.getBearing()).zoom(zoomLevel).build(); + .target(mCarMarker.getPosition()).tilt(0).bearing((float) gnssInfo.getHeading()).zoom(zoomLevel).build(); mAMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); } //更新车辆位置 if (mCarMarker != null) { // CallerLogger.INSTANCE.d(M_TAXI_P + TAG, "location.getBearing() = " + location.getBearing()); - mCarMarker.setRotateAngle(360 - location.getBearing()); + mCarMarker.setRotateAngle((float) (360 - gnssInfo.getHeading())); mCarMarker.setPosition(currentLatLng); // CallerLogger.INSTANCE.d(M_TAXI_P + TAG, "onCarLocationChanged2--loacation :" + location.getLatitude()+", "+location.getLongitude()); mCarMarker.setToTop(); diff --git a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/TaxiMapDirectionView.java b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/TaxiMapDirectionView.java index 6a93cec871..298d49af2e 100644 --- a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/TaxiMapDirectionView.java +++ b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/TaxiMapDirectionView.java @@ -29,9 +29,8 @@ import com.amap.api.maps.model.MarkerOptions; import com.amap.api.maps.model.Polyline; import com.amap.api.maps.model.PolylineOptions; import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.data.map.MogoLocation; -import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener; -import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager; +import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener; +import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ20ListenerManager; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.och.taxi.R; import com.mogo.och.taxi.utils.TaxiMapAssetStyleUtil; @@ -39,12 +38,14 @@ import com.mogo.och.taxi.utils.TaxiMapAssetStyleUtil; import java.util.ArrayList; import java.util.List; +import mogo.telematics.pad.MessagePad; + /** * taxi司机端前往目的地小地图导航 */ public class TaxiMapDirectionView extends RelativeLayout - implements IMoGoMapLocationListener, ITaxiMapDirectionView, AMap.OnCameraChangeListener { + implements IMoGoChassisLocationGCJ02Listener, ITaxiMapDirectionView, AMap.OnCameraChangeListener { //小地图名称 public static final String TAG = "TPMapDirectionView"; @@ -98,14 +99,14 @@ public class TaxiMapDirectionView initAMapView(); // 注册定位监听 - CallerMapLocationListenerManager.INSTANCE.addListener(TAG, this, false); + CallerChassisLocationGCJ20ListenerManager.INSTANCE.addListener(TAG, this); } @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); // 注册定位监听 - CallerMapLocationListenerManager.INSTANCE.removeListener(TAG, false); + CallerChassisLocationGCJ20ListenerManager.INSTANCE.removeListener(TAG); } private void initAMapView() { @@ -174,13 +175,12 @@ public class TaxiMapDirectionView return true; } - @Override - public void onLocationChanged(@org.jetbrains.annotations.Nullable MogoLocation location, int from, boolean isGps) { - if (location == null){ + public void onChassisLocationGCJ02(@Nullable MessagePad.GnssInfo gnssInfo) { + if (gnssInfo == null){ return; } - LatLng currentLatLng = new LatLng(location.getLatitude(), location.getLongitude()); + LatLng currentLatLng = new LatLng(gnssInfo.getLatitude(), gnssInfo.getLongitude()); if (mCoordinatesLatLng.size() > 1) { //圈定地图显示范围 @@ -196,13 +196,13 @@ public class TaxiMapDirectionView } else { //设置希望展示的地图缩放级别 CameraPosition cameraPosition = new CameraPosition.Builder() - .target(mCarMarker.getPosition()).tilt(0).bearing(location.getBearing()).zoom(zoomLevel).build(); + .target(mCarMarker.getPosition()).tilt(0).bearing((float) gnssInfo.getHeading()).zoom(zoomLevel).build(); mAMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); } //更新车辆位置 if (mCarMarker != null) { // CallerLogger.INSTANCE.d(M_TAXI_P + TAG, "location.getBearing() = " + location.getBearing()); - mCarMarker.setRotateAngle(360 - location.getBearing()); + mCarMarker.setRotateAngle((float) (360 - gnssInfo.getHeading())); mCarMarker.setPosition(currentLatLng); // CallerLogger.INSTANCE.d(M_TAXI_P + TAG, "onCarLocationChanged2--loacation :" + location.getLatitude()+", "+location.getLongitude()); mCarMarker.setToTop(); diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt index be00b0ff61..40e1f75d5f 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt @@ -136,7 +136,7 @@ class MoGoAdasListenerImpl : OnAdasListener { if (gnssInfo != null) { if (1 == FunctionBuildConfig.gpsProvider) { // 同步给MAP地图 - CallerMapUIServiceManager.getMapUIController()?.syncLocation2Map(gnssInfo) + //CallerMapUIServiceManager.getMapUIController()?.syncLocation2Map(gnssInfo) // 同步更新经纬度和系统时间至 AutoPilotStatusListener CallerAutoPilotStatusListenerManager.updateAutoPilotLatLon( gnssInfo.satelliteTime, diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SpeedPanelView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SpeedPanelView.kt index 0b7e36a9f6..0575c586c8 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SpeedPanelView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SpeedPanelView.kt @@ -5,13 +5,13 @@ import android.graphics.Color import android.util.AttributeSet import android.view.Gravity import android.widget.FrameLayout -import com.mogo.eagle.core.data.map.MogoLocation -import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener +import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener +import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ20ListenerManager import com.mogo.eagle.core.function.call.hmi.CallerHmiManager -import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.utilcode.util.UiThreadHandler +import mogo.telematics.pad.MessagePad import java.util.* /** @@ -22,7 +22,7 @@ class SpeedPanelView @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 -) : FrameLayout(context, attrs, defStyleAttr), IMoGoMapLocationListener { +) : FrameLayout(context, attrs, defStyleAttr), IMoGoChassisLocationGCJ02Listener { companion object { const val TAG = "SpeedPanelView" @@ -30,7 +30,7 @@ class SpeedPanelView @JvmOverloads constructor( var mContext: Context var mSpeedChartView: SpeedChartView - var mLatLng: MogoLocation? = null + var mLatLng: MessagePad.GnssInfo? = null var mSpeedLimit = 60 private val timer by lazy { @@ -63,15 +63,17 @@ class SpeedPanelView @JvmOverloads constructor( override fun onAttachedToWindow() { super.onAttachedToWindow() // 注册位置回调 - CallerMapLocationListenerManager.addListener(TAG, this, false) + CallerChassisLocationGCJ20ListenerManager.addListener(TAG, this) // 开启定时查询速度 timerTask?.cancel() val task = object : TimerTask() { override fun run() { mLatLng?.let { - mSpeedLimit = CallerMapUIServiceManager.getMapUIController()!!.getLimitSpeed(it.longitude, it.latitude, it.bearing) + mSpeedLimit = CallerMapUIServiceManager.getMapUIController()!!.getLimitSpeed(it.longitude, it.latitude, + it.heading.toFloat() + ) UiThreadHandler.post { - val speed = (it.speed * 3.6f).toInt() + val speed = (it.gnssSpeed * 3.6f).toInt() mSpeedChartView.setArcColor(Color.parseColor(if (speed > mSpeedLimit) "#DB3137" else "#3E77F6")) mSpeedChartView.setValues(speed) setBackgroundResource(if (speed > mSpeedLimit) R.drawable.yi_biao_pan_bg_speeding else R.drawable.yi_biao_pan_bg_nor) @@ -83,16 +85,16 @@ class SpeedPanelView @JvmOverloads constructor( timer.schedule(task, Date(), 100) } - override fun onLocationChanged(location: MogoLocation?, from: Int, isGps: Boolean) { - location?.let { - mLatLng = location + override fun onChassisLocationGCJ02(gnssInfo: MessagePad.GnssInfo?) { + gnssInfo?.let { + mLatLng = gnssInfo } } override fun onDetachedFromWindow() { super.onDetachedFromWindow() // 解除注册 - CallerMapLocationListenerManager.removeListener(TAG, false) + CallerChassisLocationGCJ20ListenerManager.removeListener(TAG) try { timerTask?.cancel() } catch (e: Exception) { @@ -100,4 +102,5 @@ class SpeedPanelView @JvmOverloads constructor( } } + } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapFragment.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapFragment.kt index f85f0c028c..ff18af63ac 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapFragment.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapFragment.kt @@ -23,6 +23,8 @@ import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListener import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showBrakeLight import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showTurnLight import com.mogo.eagle.core.function.call.map.CallerHDMapManager +import com.mogo.eagle.core.function.call.map.CallerMapDataCollectorManager +import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager import com.mogo.eagle.core.function.overview.InfStructureManager import com.mogo.eagle.core.function.overview.InfStructureManager.savePlanningData @@ -362,6 +364,9 @@ class MapFragment : MvpFragment(), private var brakeLight = -1 override fun onChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo?) { + // 跟新地图控件 + mMogoMapView?.setExtraGPSData(gnssInfo) + if (gnssInfo != null) { //设置刹车信息 if (gnssInfo.acceleration < SharedPrefsMgr.getInstance(Utils.getApp()).getFloat(MoGoConfig.BRAKE_ACCELERATION_THRESHOLD, -2.5f)) { diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/AMapCustomView.java b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/AMapCustomView.java index 9dae3ccb16..df5c282b93 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/AMapCustomView.java +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/AMapCustomView.java @@ -31,12 +31,11 @@ import com.amap.api.maps.model.Polyline; import com.amap.api.maps.model.PolylineOptions; import com.mogo.eagle.core.data.config.FunctionBuildConfig; import com.mogo.eagle.core.data.map.Infrastructure; -import com.mogo.eagle.core.data.map.MogoLocation; +import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener; import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener; -import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener; +import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ20ListenerManager; import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager; import com.mogo.eagle.core.function.call.hmi.CallerHmiManager; -import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager; import com.mogo.eagle.core.function.map.R; import com.mogo.eagle.core.function.overview.InfStructureManager; import com.mogo.eagle.core.function.overview.remote.Center; @@ -64,7 +63,7 @@ import mogo.telematics.pad.MessagePad; */ public class AMapCustomView extends RelativeLayout - implements IMoGoMapLocationListener { + implements IMoGoChassisLocationGCJ02Listener { public static final String TAG = "AMapCustomView"; private TextureMapView mAMapView; private AMap mAMap; @@ -93,7 +92,7 @@ public class AMapCustomView private List textureList = new ArrayList<>(); private List texIndexList = new ArrayList<>(); - private MogoLocation mLocation; + private MessagePad.GnssInfo mLocation; private boolean isFirstLocation = true; CustomMapStyleOptions mCustomMapStyleOptions; @@ -133,7 +132,7 @@ public class AMapCustomView CallerPlanningRottingListenerManager.INSTANCE.addListener(TAG, moGoAutopilotPlanningListener); initAMapView(context); // 注册定位监听 - CallerMapLocationListenerManager.INSTANCE.addListener(TAG, this, false); + CallerChassisLocationGCJ20ListenerManager.INSTANCE.addListener(TAG, this); //设置全览模式 overLayerView.setOnClickListener(v -> { displayCustomOverView(); @@ -300,7 +299,7 @@ public class AMapCustomView protected void onDetachedFromWindow() { super.onDetachedFromWindow(); // 注册定位监听 - CallerMapLocationListenerManager.INSTANCE.removeListener(TAG, false); + CallerChassisLocationGCJ20ListenerManager.INSTANCE.removeListener(TAG); CallerPlanningRottingListenerManager.INSTANCE.removeListener(TAG); } @@ -309,18 +308,6 @@ public class AMapCustomView return false; } - - @Override - public void onLocationChanged(@org.jetbrains.annotations.Nullable MogoLocation location, int from, boolean isGps) { - mLocation = location; - MarkerDrawerManager.INSTANCE.setLonLat(new Pair(location.getLongitude(), location.getLatitude())); - drawCarMarker(location); - if (isFirstLocation) { - displayCustomOverView(); - isFirstLocation = false; - } - } - public void onCreateView(Bundle savedInstanceState) { if (mAMapView != null) { mAMapView.onCreate(savedInstanceState); @@ -435,7 +422,6 @@ public class AMapCustomView */ private void displayCustomOverView() { ArrayList linePointsLatLng = MarkerDrawerManager.INSTANCE.getPlanningPoints(); - MogoLocation location = mLocation; if (linePointsLatLng.size() > 1) { //圈定地图显示范围 //存放经纬度 @@ -443,7 +429,7 @@ public class AMapCustomView for (int i = 0; i < linePointsLatLng.size(); i++) { boundsBuilder.include(linePointsLatLng.get(i)); } - LatLng currentLatLng = new LatLng(location.getLatitude(), location.getLongitude()); + LatLng currentLatLng = new LatLng(mLocation.getLatitude(), mLocation.getLongitude()); boundsBuilder.include(currentLatLng); CameraPosition cameraPosition = new CameraPosition.Builder().tilt(mTilt).build(); @@ -463,15 +449,15 @@ public class AMapCustomView * * @param location */ - private void drawCarMarker(MogoLocation location) { + private void drawCarMarker(MessagePad.GnssInfo location) { if (location == null) return; if (mCarMarker != null) { LatLng currentLatLng = new LatLng(location.getLatitude(), location.getLongitude()); - mCarMarker.setRotateAngle(360 - location.getBearing()); + mCarMarker.setRotateAngle((float) (360 - location.getHeading())); mCarMarker.setPosition(currentLatLng); mCarMarker.setToTop(); if (mCompassMarker != null) { - mCompassMarker.setRotateAngle(360 - location.getBearing()); + mCompassMarker.setRotateAngle((float) (360 - location.getHeading())); mCompassMarker.setPosition(currentLatLng); } } @@ -539,4 +525,15 @@ public class AMapCustomView } } } + + @Override + public void onChassisLocationGCJ02(@Nullable MessagePad.GnssInfo gnssInfo) { + mLocation = gnssInfo; + MarkerDrawerManager.INSTANCE.setLonLat(new Pair(gnssInfo.getLongitude(), gnssInfo.getLatitude())); + drawCarMarker(gnssInfo); + if (isFirstLocation) { + displayCustomOverView(); + isFirstLocation = false; + } + } } diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/SmallMapDirectionView.java b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/SmallMapDirectionView.java index 218b1678e5..43b2152622 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/SmallMapDirectionView.java +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/SmallMapDirectionView.java @@ -32,9 +32,8 @@ import com.amap.api.maps.model.PolylineOptions; import com.mogo.cloud.commons.utils.CoordinateUtils; import com.mogo.eagle.core.data.config.FunctionBuildConfig; import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.data.map.MogoLocation; -import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener; -import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager; +import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener; +import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ20ListenerManager; import com.mogo.eagle.core.function.map.R; import com.mogo.eagle.core.function.smp.view.ISmallMapDirectionView; import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils; @@ -48,6 +47,8 @@ import java.util.List; import java.util.Timer; import java.util.TimerTask; +import mogo.telematics.pad.MessagePad; + /** * 小地图的方向View * @@ -56,7 +57,7 @@ import java.util.TimerTask; */ public class SmallMapDirectionView extends RelativeLayout - implements IMoGoMapLocationListener, ISmallMapDirectionView { + implements IMoGoChassisLocationGCJ02Listener, ISmallMapDirectionView { //小地图名称 public static final String TAG = "SmallMapDirectionView"; @@ -74,7 +75,7 @@ public class SmallMapDirectionView private Polyline mPolyline; private CameraUpdate mCameraUpdate; private Context mContext; - private MogoLocation mLocation; + private MessagePad.GnssInfo mLocation; public SmallMapDirectionView(Context context) { this(context, null); @@ -104,7 +105,7 @@ public class SmallMapDirectionView initAMapView(); // 注册定位监听 - CallerMapLocationListenerManager.INSTANCE.addListener(TAG, this, false); + CallerChassisLocationGCJ20ListenerManager.INSTANCE.addListener(TAG, this); startTask(); } @@ -117,7 +118,7 @@ public class SmallMapDirectionView protected void onDetachedFromWindow() { super.onDetachedFromWindow(); // 注册定位监听 - CallerMapLocationListenerManager.INSTANCE.removeListener(TAG, false); + CallerChassisLocationGCJ20ListenerManager.INSTANCE.removeListener(TAG); } private void initAMapView() { @@ -130,11 +131,11 @@ public class SmallMapDirectionView // 关闭显示实时路况图层,aMap是地图控制器对象。 mAMap.setTrafficEnabled(false); // 设置 锚点 图标 - if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)){ + if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) { mCarMarker = mAMap.addMarker(new MarkerOptions() .icon(BitmapDescriptorFactory.fromResource(R.drawable.map_bus_icon)) .anchor(0.5f, 0.5f)); - }else{ + } else { mCarMarker = mAMap.addMarker(new MarkerOptions() .icon(BitmapDescriptorFactory.fromResource(R.drawable.map_car_icon)) .anchor(0.5f, 0.5f)); @@ -177,30 +178,28 @@ public class SmallMapDirectionView return true; } - @Override - public void onLocationChanged(@org.jetbrains.annotations.Nullable MogoLocation location, int from, boolean isGps) { - if (location == null) { + public void onChassisLocationGCJ02(@Nullable MessagePad.GnssInfo gnssInfo) { + if (gnssInfo == null) { return; } - mLocation = location; + mLocation = gnssInfo; } private class UpdateLocationTask extends TimerTask { @Override public void run() { if (mLocation != null) { - MogoLocation location = mLocation; - if (mCarMarker == null){ + if (mCarMarker == null) { mCarMarker = mAMap.addMarker(new MarkerOptions() .icon(BitmapDescriptorFactory.fromResource(R.drawable.module_small_map_view_my_location_logo)) .anchor(0.5f, 0.5f)); } - if(mCarMarker == null){ + if (mCarMarker == null) { return; } - LatLng currentLatLng = new LatLng(location.getLatitude(), location.getLongitude()); - float bearing = (float) Math.floor(location.getBearing()); + LatLng currentLatLng = new LatLng(mLocation.getLatitude(), mLocation.getLongitude()); + float bearing = (float) Math.floor(mLocation.getHeading()); //更新车辆位置 mCarMarker.setPosition(currentLatLng); diff --git a/libraries/mogo-map-api/src/main/java/com/mogo/map/IMogoMap.java b/libraries/mogo-map-api/src/main/java/com/mogo/map/IMogoMap.java index 76729f44a7..72aa1774bb 100644 --- a/libraries/mogo-map-api/src/main/java/com/mogo/map/IMogoMap.java +++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/IMogoMap.java @@ -42,14 +42,14 @@ public interface IMogoMap { * @param options * @return */ - IMogoMarker addMarker( String tag, MogoMarkerOptions options ); + IMogoMarker addMarker(String tag, MogoMarkerOptions options); /** * 批量更新锚点位置 * * @param optionsArrayList 锚点集合 */ - void updateBatchMarkerPosition(HashMap optionsArrayList); + void updateBatchMarkerPosition(HashMap optionsArrayList); /** * 添加感知使用到的3d模型 @@ -74,7 +74,7 @@ public interface IMogoMap { * @param moveToCenter * @return */ - ArrayList< IMogoMarker > addMarkers( String tag, ArrayList< MogoMarkerOptions > options, boolean moveToCenter ); + ArrayList addMarkers(String tag, ArrayList options, boolean moveToCenter); /** * 从地图上删除所有的overlay(marker,circle,polyline 等对象)。 @@ -86,7 +86,7 @@ public interface IMogoMap { * * @param isKeepMyLocationOverlay */ - void clear( boolean isKeepMyLocationOverlay ); + void clear(boolean isKeepMyLocationOverlay); /** * 设置屏幕上的某个像素点为地图中心点。 @@ -94,47 +94,7 @@ public interface IMogoMap { * @param x * @param y */ - void setPointToCenter( int x, int y ); - - /** - * 设置地图POI是否允许点击。 - * - * @param touchPoiEnable - */ - void setTouchPoiEnable( boolean touchPoiEnable ); - - /** - * 设置是否打开交通路况图层。 - * - * @param enable - */ - void setTrafficEnable( boolean enable ); - - /** - * 设置是否显示3D建筑物,默认显示。 - * - * @param enabled - */ - void showBuildings( boolean enabled ); - - /** - * 设置是否显示室内地图,默认不显示。 - * - * @param enable - */ - void showIndoorMap( boolean enable ); - - /** - * 设置是否显示底图文字标注,默认显示。 - * - * @param enable - */ - void showMapText( boolean enable ); - - /** - * 停止当前执行的改变地图状态的动画。 - */ - void stopAnimation(); + void setPointToCenter(int x, int y); /** * 获取比例尺 @@ -148,7 +108,7 @@ public interface IMogoMap { * * @param zoom */ - void changeZoom( float zoom ); + void changeZoom(float zoom); /** * 获取缩放比例 @@ -168,13 +128,14 @@ public interface IMogoMap { * @param options * @return */ - IMogoPolyline addPolyline( MogoPolylineOptions options ); + IMogoPolyline addPolyline(MogoPolylineOptions options); /** * 获取行驶方向一定长度的中心线 - * @param lon 经度 - * @param lat 纬度 - * @param angle 航向角 + * + * @param lon 经度 + * @param lat 纬度 + * @param angle 航向角 * @param distance 获取车道中心线的长度,> 0: 行驶方向前方距离, <0 行驶方向后方距离 * @return 中心线相关数据 */ @@ -183,10 +144,13 @@ public interface IMogoMap { /** * 根据自车经纬度和航向角,获取道路名称 - * @param lon 经度 - * @param lat 纬度 + * + * @param lon 经度 + * @param lat 纬度 * @param angle 航向角 * @return 道路名称等相关信息 */ RoadNameInfo getRoadName(double lon, double lat, float angle); + + } diff --git a/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java b/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java index 18c82387c2..f1a463ac75 100644 --- a/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java +++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java @@ -272,9 +272,6 @@ public interface IMogoMapUIController { } - default void syncLocation2Map(MessagePad.GnssInfo gnssInfo) { - - } /** * 获取车速资源缓存 id @@ -329,4 +326,10 @@ public interface IMogoMapUIController { */ void setAllGesturesEnabled(boolean isEnable); + /** + * 设置外界坐标系 + * + * @param gnssInfo RTK 高精坐标,车辆惯导数据 + */ + void setExtraGPSData(MessagePad.GnssInfo gnssInfo); } diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.java b/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.java index a114a90c22..73b81ebdd7 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.java +++ b/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.java @@ -985,39 +985,6 @@ public class AMapViewWrapper implements IMogoMapView, CallerMapDataCollectorManager.INSTANCE.setIsInit(); } - @Override - public void syncLocation2Map(MessagePad.GnssInfo gnssInfo) { - if (!checkAMapView()) { - return; - } - if (gnssInfo.getLongitude() == -1) { - return; - } - LonLatPoint bean = new LonLatPoint(); - bean.setAngle(gnssInfo.getHeading()); - bean.setAltitude(gnssInfo.getAltitude()); - bean.setLongitude(gnssInfo.getLongitude()); - bean.setLatitude(gnssInfo.getLatitude()); - bean.setSatelliteTime(Double.valueOf(gnssInfo.getSatelliteTime() * 1000).longValue()); - bean.setSpeed((float) gnssInfo.getGnssSpeed()); -// RTKAutopilotLocationBean bean = new RTKAutopilotLocationBean(); -// bean.setYaw_rate(gnssInfo.getYawRate()); -// bean.setHeading(gnssInfo.getHeading()); -// bean.setAcceleration(gnssInfo.getAcceleration()); -// bean.setAlt(gnssInfo.getAltitude()); -// bean.setSystemTime(Double.valueOf(gnssInfo.getSystemTime()).longValue()); -// bean.setSatelliteTime(Double.valueOf(gnssInfo.getSatelliteTime() * 1000).longValue()); -// bean.setLon(gnssInfo.getLongitude()); -// bean.setLat(gnssInfo.getLatitude()); -// bean.setGnss_speed(((float) gnssInfo.getGnssSpeed())); -// bean.setReceiverDataTime(System.currentTimeMillis()); - // 使用外部定位数据修改自车位置 -// mMapView.getLocationClient().updateRTKAutoPilotLocation(bean); - mMapView.getLocationClient().updateLocation(bean); - CallerMapUIServiceManager.INSTANCE.getSingletonLocationClient(getContext()).updateLocation(bean); - CallerMapDataCollectorManager.INSTANCE.setIsInit(); - } - @Override public void stepInVrMode(boolean isDayMode) { // try { @@ -1135,4 +1102,29 @@ public class AMapViewWrapper implements IMogoMapView, mMapView.getMapAutoViewHelper().setAllGesturesEnabled(isEnable); } } + + + @Override + public void setExtraGPSData(MessagePad.GnssInfo gnssInfo) { + LocationClient locationClient = mMapView.getLocationClient(); + if (locationClient != null) { + locationClient.setIsUseExtraGPSData(true);//设置是否使用外界坐标 + locationClient.rtkEnable(true);//设置是否是高精定位 + + LonLatPoint lonLatPoint = new LonLatPoint(); + lonLatPoint.setAngle(gnssInfo.getHeading()); + lonLatPoint.setAltitude(gnssInfo.getAltitude()); + lonLatPoint.setLongitude(gnssInfo.getLongitude()); + lonLatPoint.setLatitude(gnssInfo.getLatitude()); + lonLatPoint.setSatelliteTime(Double.valueOf(gnssInfo.getSatelliteTime() * 1000).longValue()); + lonLatPoint.setSpeed((float) gnssInfo.getGnssSpeed()); + + locationClient.updateLocation(lonLatPoint);//更新新自动驾驶RTK相关数据 + + CallerMapUIServiceManager.INSTANCE.getSingletonLocationClient(getContext()).updateLocation(lonLatPoint); + CallerMapDataCollectorManager.INSTANCE.setIsInit(); + } + } + + } diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/AMapWrapper.java b/libraries/mogo-map/src/main/java/com/mogo/map/AMapWrapper.java index 0d8706c008..77fe42cd29 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/AMapWrapper.java +++ b/libraries/mogo-map/src/main/java/com/mogo/map/AMapWrapper.java @@ -53,7 +53,7 @@ public class AMapWrapper implements IMogoMap { private static final String TAG = "AMapWrapper"; private static MapAutoViewHelper sAMap; - private IMogoMapUIController mUIcontroller; + private IMogoMapUIController mMapUIController; private MapAutoViewHelper mAMap; private MapAutoView mMapView; private IMogoUiSettings mUiSettings; @@ -63,10 +63,10 @@ public class AMapWrapper implements IMogoMap { this.mAMap = map; sAMap = map; this.mMapView = mapView; - mUIcontroller = controller; + mMapUIController = controller; // 设置实现自定义 info window MapAutoApi.INSTANCE.setInfoWindowAdapter(new AMapInfoWindowAdapter()); - AMapUIController.getInstance().initClient(mUIcontroller); + AMapUIController.getInstance().initClient(mMapUIController); } public static MapAutoViewHelper getAMap() { @@ -86,7 +86,7 @@ public class AMapWrapper implements IMogoMap { @Override public IMogoMapUIController getUIController() { - return mUIcontroller; + return mMapUIController; } @Override @@ -211,48 +211,6 @@ public class AMapWrapper implements IMogoMap { } } - @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()) { @@ -279,8 +237,6 @@ public class AMapWrapper implements IMogoMap { } } return 0; - - } @Override diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java index d002863eed..dbedbd0a54 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java +++ b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java @@ -334,14 +334,6 @@ public class MogoMapUIController implements IMogoMapUIController { } } - @Override - public void syncLocation2Map(MessagePad.GnssInfo gnssInfo) { - initDelegate(); - if (mDelegate != null) { - mDelegate.syncLocation2Map(gnssInfo); - } - } - @Override public void destroy() { mDelegate = null; @@ -420,4 +412,12 @@ public class MogoMapUIController implements IMogoMapUIController { mDelegate.setAllGesturesEnabled(isEnable); } } + + @Override + public void setExtraGPSData(MessagePad.GnssInfo gnssInfo) { + initDelegate(); + if (mDelegate != null) { + mDelegate.setExtraGPSData(gnssInfo); + } + } } diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapView.java b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapView.java index ddb46ccc25..c6566e6446 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapView.java +++ b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapView.java @@ -10,8 +10,11 @@ import android.widget.FrameLayout; import androidx.annotation.Nullable; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; +import com.mogo.map.uicontroller.AMapUIController; import com.zhidaoauto.map.sdk.open.view.MapAutoView; +import mogo.telematics.pad.MessagePad; + /** * @author congtaowang * @since 2019-12-18 @@ -85,4 +88,9 @@ public class MogoMapView extends MogoBaseMapView implements ILifeCycle { public void onLowMemory() { super.onLowMemory(); } + + public void setExtraGPSData(MessagePad.GnssInfo gnssInfo) { + AMapUIController.getInstance().setExtraGPSData(gnssInfo); + } + } diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/uicontroller/AMapUIController.java b/libraries/mogo-map/src/main/java/com/mogo/map/uicontroller/AMapUIController.java index 67bd34ea4d..5546642519 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/uicontroller/AMapUIController.java +++ b/libraries/mogo-map/src/main/java/com/mogo/map/uicontroller/AMapUIController.java @@ -287,14 +287,6 @@ public class AMapUIController implements IMogoMapUIController { } } - @Override - public void syncLocation2Map(MessagePad.GnssInfo gnssInfo) { - if (mClient != null) { - mClient.syncLocation2Map(gnssInfo); - } - } - - @Override public void stepInVrMode(boolean isDayMode) { if (mClient != null) { @@ -361,4 +353,11 @@ public class AMapUIController implements IMogoMapUIController { mClient.setAllGesturesEnabled(isEnable); } } + + @Override + public void setExtraGPSData(MessagePad.GnssInfo gnssInfo) { + if (mClient != null) { + mClient.setExtraGPSData(gnssInfo); + } + } }