diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/camera/RoadVideoDialog.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/camera/RoadVideoDialog.kt index 1a5a426d86..5af993e377 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/camera/RoadVideoDialog.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/camera/RoadVideoDialog.kt @@ -44,7 +44,7 @@ class RoadVideoDialog(context: Context) : BaseFloatDialog(context), LifecycleObs ContextCompat.getColor(context, R.color.notice_blue), PorterDuff.Mode.MULTIPLY ) - setCanceledOnTouchOutside(true) + setCanceledOnTouchOutside(false) roadVideoClose.setOnClickListener { dismiss() diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapFragment.java b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapFragment.java index 8f20d0e56a..7f7dd770f6 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapFragment.java +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapFragment.java @@ -12,12 +12,14 @@ import com.alibaba.android.arouter.facade.annotation.Route; import com.mogo.commons.mvp.MvpFragment; import com.mogo.eagle.core.data.constants.MoGoFragmentPaths; import com.mogo.eagle.core.data.map.CenterLine; +import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener; import com.mogo.eagle.core.function.api.map.hd.IMoGoMapFragmentProvider; import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener; import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager; import com.mogo.eagle.core.function.call.map.CallerHDMapManager; import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager; import com.mogo.eagle.core.function.overview.InfStructureManager; +import com.mogo.eagle.core.function.overview.Infrastructure; import com.mogo.eagle.core.function.overview.ViewModelExtKt; import com.mogo.eagle.core.function.overview.vm.OverViewModel; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; @@ -28,6 +30,13 @@ import com.mogo.map.uicontroller.IMogoMapUIController; import com.zhidaoauto.map.sdk.open.MapAutoApi; import com.zhidaoauto.map.sdk.open.business.PointCloudHelper; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import ch.hsr.geohash.GeoHash; +import mogo.telematics.pad.MessagePad; + /** * @author donghongyu * @since 2021-11-09 @@ -37,7 +46,8 @@ import com.zhidaoauto.map.sdk.open.business.PointCloudHelper; */ @Route(path = MoGoFragmentPaths.PATH_FRAGMENT_MAP) public class MapFragment extends MvpFragment - implements MapView, IMoGoMapFragmentProvider, IMoGoSkinModeChangeListener { + implements MapView, IMoGoMapFragmentProvider, IMoGoSkinModeChangeListener, + IMoGoAutopilotPlanningListener { private static final String TAG = "MapFragment"; @@ -330,4 +340,31 @@ public class MapFragment extends MvpFragment public void setDebugMode(boolean debugMode) { MapAutoApi.INSTANCE.setDebugMode(debugMode); } + + @Override + public void onAutopilotTrajectory(@NonNull List trajectoryInfos) { + + } + + @Override + public void onAutopilotRotting(@Nullable MessagePad.GlobalPathResp globalPathResp) { + if (globalPathResp != null) { + HashMap> pathMap = new HashMap(); + String geoHash; + ArrayList infList; + for (MessagePad.Location location : globalPathResp.getWayPointsList()) { + geoHash = GeoHash.withCharacterPrecision(location.getLatitude(), location.getLongitude(), 7).toBase32(); + // 网格内的轨迹点只取一次 + if (!pathMap.containsKey(geoHash)) { + // 从缓存的新基建数据中去取对应geoHash的新基建数据集合 + infList = InfStructureManager.INSTANCE.getData().get(geoHash); + if (infList != null) { + pathMap.put(geoHash, infList); + } + } + } + // 全局路径规划只回调一次,保存供全览模式所在Fragment使用 + InfStructureManager.INSTANCE.savePathData(pathMap); + } + } } diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/InfStructureManager.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/InfStructureManager.kt index 7be615c9fe..40f50e5218 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/InfStructureManager.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/InfStructureManager.kt @@ -10,6 +10,11 @@ object InfStructureManager { HashMap>() } + // 全局路径规划中所有点的GeoHash网格对应的新基建数据集合 + private val _pathMap by lazy { + HashMap>() + } + fun saveData(map: HashMap>) { if (_infMap.isNotEmpty()) { _infMap.clear() @@ -18,4 +23,13 @@ object InfStructureManager { } fun getData(): Map> = _infMap + + fun savePathData(map: HashMap>) { + if (_pathMap.isNotEmpty()) { + _pathMap.clear() + } + _pathMap.putAll(map) + } + + fun getPathData(): Map> = _pathMap } \ No newline at end of file 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 fc6abecc4d..7002f15e25 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 @@ -732,58 +732,62 @@ public class AMapCustomView } } } - // 绘制新基建数据 - if (!posInfMap.isEmpty()) { - posInfMap.clear(); - } - ArrayList markerOptionsList = new ArrayList(); - for (ArrayList structureList : pathMap.values()) { - int firstQuadrantCt = 0, secondQuadrantCt = 0, thirdQuadrantCt = 0, forthQuadrantCt = 0; - // 每个GeoHash内根据坐标系象限分散开摄像头icon显示 - for (Infrastructure structure : structureList) { - MarkerOptions markerOption = new MarkerOptions(); - LatLng latLng = new LatLng(Double.valueOf(structure.getLat()), - Double.valueOf(structure.getLon())); - markerOption.position(latLng); - if (structure.getHeading() >= 0 && structure.getHeading() <= 90) { - markerOption.anchor(0.5f * firstQuadrantCt, 0.5f + 0.5f * firstQuadrantCt); - markerOption.icon(BitmapDescriptorFactory.fromBitmap( - BitmapFactory.decodeResource(getResources(),R.drawable.video_icon_right) - )); - firstQuadrantCt++; - } else if (structure.getHeading() >= 90 && structure.getHeading() <= 180) { - markerOption.anchor(0.5f * secondQuadrantCt, 0.5f * secondQuadrantCt); - markerOption.icon(BitmapDescriptorFactory.fromBitmap( - BitmapFactory.decodeResource(getResources(),R.drawable.video_icon_right) - )); - secondQuadrantCt++; - } else if (structure.getHeading() >= 180 && structure.getHeading() <= 270) { - markerOption.anchor(0.5f + 0.5f * thirdQuadrantCt, 0.5f * thirdQuadrantCt); - markerOption.icon(BitmapDescriptorFactory.fromBitmap( - BitmapFactory.decodeResource(getResources(),R.drawable.video_icon_left) - )); - thirdQuadrantCt++; - } else { - markerOption.anchor(0.75f + 0.25f * forthQuadrantCt, 0.75f + 0.25f * forthQuadrantCt); - markerOption.icon(BitmapDescriptorFactory.fromBitmap( - BitmapFactory.decodeResource(getResources(),R.drawable.video_icon_left) - )); - forthQuadrantCt++; - } - posInfMap.put(latLng, structure); - markerOptionsList.add(markerOption); - } - } - mAMap.addMarkers(markerOptionsList, false); - mAMap.setOnMarkerClickListener(marker -> { - Infrastructure infrastructure = posInfMap.get(marker.getPosition()); - // 如果是摄像头 - if (0 == infrastructure.getCategory() && infrastructure.getIp() != null) { - CallerHmiManager.INSTANCE.showVideoDialog(infrastructure.getIp()); - return true; - } - return false; - }); + drawInfMarkers(pathMap); } } + + public void drawInfMarkers(Map> infStruMap) { + // 绘制新基建数据 + if (!posInfMap.isEmpty()) { + posInfMap.clear(); + } + ArrayList markerOptionsList = new ArrayList(); + for (ArrayList structureList : infStruMap.values()) { + int firstQuadrantCt = 0, secondQuadrantCt = 0, thirdQuadrantCt = 0, forthQuadrantCt = 0; + // 每个GeoHash内根据坐标系象限分散开摄像头icon显示 + for (Infrastructure structure : structureList) { + MarkerOptions markerOption = new MarkerOptions(); + LatLng latLng = new LatLng(Double.valueOf(structure.getLat()), + Double.valueOf(structure.getLon())); + markerOption.position(latLng); + if (structure.getHeading() >= 0 && structure.getHeading() <= 90) { + markerOption.anchor(0.5f * firstQuadrantCt, 0.5f + 0.5f * firstQuadrantCt); + markerOption.icon(BitmapDescriptorFactory.fromBitmap( + BitmapFactory.decodeResource(getResources(),R.drawable.video_icon_right) + )); + firstQuadrantCt++; + } else if (structure.getHeading() >= 90 && structure.getHeading() <= 180) { + markerOption.anchor(0.5f * secondQuadrantCt, 0.5f * secondQuadrantCt); + markerOption.icon(BitmapDescriptorFactory.fromBitmap( + BitmapFactory.decodeResource(getResources(),R.drawable.video_icon_right) + )); + secondQuadrantCt++; + } else if (structure.getHeading() >= 180 && structure.getHeading() <= 270) { + markerOption.anchor(0.5f + 0.5f * thirdQuadrantCt, 0.5f * thirdQuadrantCt); + markerOption.icon(BitmapDescriptorFactory.fromBitmap( + BitmapFactory.decodeResource(getResources(),R.drawable.video_icon_left) + )); + thirdQuadrantCt++; + } else { + markerOption.anchor(0.75f + 0.25f * forthQuadrantCt, 0.75f + 0.25f * forthQuadrantCt); + markerOption.icon(BitmapDescriptorFactory.fromBitmap( + BitmapFactory.decodeResource(getResources(),R.drawable.video_icon_left) + )); + forthQuadrantCt++; + } + posInfMap.put(latLng, structure); + markerOptionsList.add(markerOption); + } + } + mAMap.addMarkers(markerOptionsList, false); + mAMap.setOnMarkerClickListener(marker -> { + Infrastructure infrastructure = posInfMap.get(marker.getPosition()); + // 如果是摄像头 + if (0 == infrastructure.getCategory() && infrastructure.getIp() != null) { + CallerHmiManager.INSTANCE.showVideoDialog(infrastructure.getIp()); + return true; + } + return false; + }); + } } diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/SmallMapFragment.java b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/SmallMapFragment.java index 5751b70918..40725b3f56 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/SmallMapFragment.java +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/SmallMapFragment.java @@ -17,12 +17,15 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener; import com.mogo.eagle.core.function.api.map.smp.IMogoSmallMapProvider; import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager; import com.mogo.eagle.core.function.map.R; +import com.mogo.eagle.core.function.overview.InfStructureManager; +import com.mogo.eagle.core.function.overview.Infrastructure; import com.mogo.eagle.core.utilcode.util.UiThreadHandler; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; +import java.util.Map; import mogo.telematics.pad.MessagePad; import mogo_msg.MogoReportMsg; @@ -102,6 +105,10 @@ public class SmallMapFragment extends BaseFragment if (mAMapCustomView != null) { mAMapCustomView.onResume(); } + Map> map = InfStructureManager.INSTANCE.getPathData(); + if (!map.isEmpty()) { + mAMapCustomView.drawInfMarkers(map); + } } @Override