Merge branch 'dev_robo_240612_6.5.0_tmp' of gitlab.zhidaoauto.com:SCA/L4HA/AndroidApp/MoGoEagleEye into dev_robo_240612_6.5.0_tmp
@@ -28,7 +28,7 @@
|
||||
android:layout_height="@dimen/dp_269"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<!--V2X预警红色边框-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.V2XWarningView
|
||||
@@ -101,11 +101,31 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_71"
|
||||
app:layout_constraintEnd_toEndOf="@+id/viewLimitingVelocity"
|
||||
app:layout_goneMarginEnd="40dp"
|
||||
app:layout_goneMarginTop="@dimen/dp_236"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintTop_toBottomOf="@+id/viewLimitingVelocity"/>
|
||||
app:layout_constraintEnd_toEndOf="@+id/viewLimitingVelocity"
|
||||
app:layout_constraintTop_toBottomOf="@+id/viewLimitingVelocity"
|
||||
app:layout_goneMarginEnd="40dp"
|
||||
app:layout_goneMarginTop="@dimen/dp_236" />
|
||||
|
||||
<!-- 前方路况探查 -->
|
||||
<com.mogo.eagle.core.function.view.RoadCrossRoamView
|
||||
android:layout_width="@dimen/dp_600"
|
||||
android:layout_height="@dimen/dp_740"
|
||||
android:layout_marginTop="@dimen/dp_350"
|
||||
android:layout_marginRight="@dimen/dp_50"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<!-- 地图marker点击触发路侧直播 -->
|
||||
<com.mogo.eagle.core.function.hmi.ui.camera.RoadCrossLiveView
|
||||
android:layout_width="@dimen/dp_800"
|
||||
android:layout_height="@dimen/dp_560"
|
||||
android:layout_marginTop="@dimen/dp_333"
|
||||
android:layout_marginEnd="@dimen/dp_50"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<!--消息盒子选择入口-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxButtonView
|
||||
@@ -163,10 +183,10 @@
|
||||
android:layout_height="@dimen/dp_185"
|
||||
android:layout_marginStart="@dimen/dp_9"
|
||||
android:layout_marginTop="-31dp"
|
||||
android:paddingTop="@dimen/dp_27"
|
||||
android:paddingBottom="@dimen/dp_32"
|
||||
android:background="@drawable/bus_autopilot_0_1_status_bg"
|
||||
android:gravity="center"
|
||||
android:paddingTop="@dimen/dp_27"
|
||||
android:paddingBottom="@dimen/dp_32"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/fl_speed"
|
||||
tools:visibility="visible">
|
||||
@@ -200,8 +220,7 @@
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
android:layout_marginTop="-24dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/module_mogo_och_autopilot_status"
|
||||
/>
|
||||
app:layout_constraintTop_toBottomOf="@id/module_mogo_och_autopilot_status" />
|
||||
<!--订单调试页面-->
|
||||
<include
|
||||
android:id="@+id/module_mogo_och_bus_test_bar"
|
||||
@@ -217,8 +236,8 @@
|
||||
android:id="@+id/module_mogo_och_arrived_tv"
|
||||
android:layout_width="@dimen/dp_142"
|
||||
android:layout_height="@dimen/dp_142"
|
||||
android:layout_marginBottom="@dimen/dp_16"
|
||||
android:layout_marginStart="@dimen/dp_19"
|
||||
android:layout_marginBottom="@dimen/dp_16"
|
||||
android:background="@drawable/common_arrive_station_selector"
|
||||
android:elevation="@dimen/dp_10"
|
||||
android:gravity="center"
|
||||
@@ -230,39 +249,39 @@
|
||||
|
||||
<com.mogo.och.common.module.wigets.map.toolsview.ToolsView
|
||||
android:id="@+id/toolsView"
|
||||
android:layout_width="@dimen/dp_142"
|
||||
android:layout_height="@dimen/dp_142"
|
||||
android:layout_marginStart="-10dp"
|
||||
android:layout_marginBottom="@dimen/dp_17"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@id/module_mogo_och_arrived_tv"
|
||||
android:layout_width="@dimen/dp_142"
|
||||
android:layout_height="@dimen/dp_142"/>
|
||||
app:layout_constraintLeft_toRightOf="@id/module_mogo_och_arrived_tv" />
|
||||
|
||||
<!--切换地图远近事件 @dimen/module_switch_map -->
|
||||
<com.mogo.och.common.module.wigets.map.switchvisual.VisualView
|
||||
android:id="@+id/switch_visual_view"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@id/toolsView"
|
||||
android:layout_width="@dimen/dp_142"
|
||||
android:layout_height="@dimen/dp_142"
|
||||
android:layout_marginStart="-10dp"
|
||||
android:layout_marginBottom="@dimen/dp_17"
|
||||
android:layout_width="@dimen/dp_142"
|
||||
android:layout_height="@dimen/dp_142"/>
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@id/toolsView" />
|
||||
|
||||
|
||||
<com.mogo.och.common.module.wigets.map.reportworkorder.ReportWorkOrderView
|
||||
android:id="@+id/reportworkorderview"
|
||||
android:layout_width="@dimen/dp_142"
|
||||
android:layout_height="@dimen/dp_142"
|
||||
android:layout_marginStart="-10dp"
|
||||
android:layout_marginBottom="@dimen/dp_17"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@id/switch_visual_view"
|
||||
android:layout_width="@dimen/dp_142"
|
||||
android:layout_height="@dimen/dp_142"/>
|
||||
app:layout_constraintLeft_toRightOf="@id/switch_visual_view" />
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.RomaTaxiView
|
||||
android:layout_width="@dimen/dp_142"
|
||||
android:layout_height="@dimen/dp_142"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginStart="-10dp"
|
||||
android:layout_marginBottom="@dimen/dp_17"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@id/reportworkorderview"
|
||||
app:roma_close_bg="@drawable/common_driverroma_normal"
|
||||
app:roma_open_bg="@drawable/common_driver_roma_press" />
|
||||
@@ -305,7 +324,7 @@
|
||||
|
||||
<com.mogo.och.common.module.wigets.LoadingMapStatusView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.ConnectionProcessView
|
||||
android:layout_width="wrap_content"
|
||||
@@ -313,8 +332,7 @@
|
||||
android:layout_marginBottom="@dimen/dp_18"
|
||||
app:layout_constraintBottom_toTopOf="@id/viewVersionName"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
/>
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -31,6 +31,7 @@ import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxButtonView;
|
||||
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxListView;
|
||||
import com.mogo.eagle.core.function.view.MapBizView;
|
||||
import com.mogo.eagle.core.function.smp.view.SmallMapView;
|
||||
import com.mogo.eagle.core.function.view.MapRoamView;
|
||||
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;
|
||||
@@ -56,6 +57,7 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
|
||||
protected FrameLayout flStationPanelContainer;
|
||||
private FrameLayout flNaviPanelContainer;
|
||||
private MapBizView mapBizView;
|
||||
private MapRoamView mapRoamView;
|
||||
private Group groupTestPanel;
|
||||
private FrameLayout mSpeedView;
|
||||
private ImageView mAutopilotImage;
|
||||
@@ -81,6 +83,7 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
|
||||
@Override
|
||||
protected void initViews() {
|
||||
mapBizView = findViewById(R.id.mapBizView);
|
||||
mapRoamView = findViewById(R.id.mapRoamView);
|
||||
groupTestPanel = findViewById(R.id.groupTestPanel);
|
||||
ctvAutopilotStatusRL = findViewById(R.id.module_mogo_och_autopilot_status);
|
||||
ctvAutopilotStatusRL.setBackground(getResources().getDrawable(R.drawable.taxi_autopilot_bg_selector));
|
||||
@@ -184,6 +187,7 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
|
||||
protected void initViews(Bundle savedInstanceState) {
|
||||
super.initViews(savedInstanceState);
|
||||
mapBizView.onCreate(savedInstanceState);
|
||||
mapRoamView.onCreate(savedInstanceState);
|
||||
smallMapView.onCreateView(savedInstanceState);
|
||||
}
|
||||
|
||||
@@ -191,6 +195,7 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
mapBizView.onResume();
|
||||
mapRoamView.onResume();
|
||||
smallMapView.onResume();
|
||||
}
|
||||
|
||||
@@ -198,6 +203,7 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
mapBizView.onPause();
|
||||
mapRoamView.onPause();
|
||||
smallMapView.onPause();
|
||||
}
|
||||
|
||||
@@ -209,17 +215,20 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
|
||||
public void onLowMemory() {
|
||||
super.onLowMemory();
|
||||
mapBizView.onLowMemory();
|
||||
mapRoamView.onLowMemory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
mapBizView.onSaveInstanceState(outState);
|
||||
mapRoamView.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
mapBizView.onDestroy();
|
||||
mapRoamView.onDestroy();
|
||||
if(smallMapView != null){
|
||||
smallMapView.onDestroy();
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
android:layout_height="@dimen/dp_269"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/module_mogo_och_autopilot_status"
|
||||
@@ -35,13 +35,12 @@
|
||||
android:layout_height="@dimen/dp_180"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:layout_marginTop="-31dp"
|
||||
android:background="@drawable/taxi_autopilot_bg_selector"
|
||||
android:gravity="center"
|
||||
android:paddingTop="@dimen/dp_27"
|
||||
android:paddingBottom="@dimen/dp_32"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/taxi_autopilot_bg_selector"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/taxi_speed_contain"
|
||||
>
|
||||
app:layout_constraintTop_toBottomOf="@+id/taxi_speed_contain">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/module_och_autopilot_iv"
|
||||
@@ -134,11 +133,31 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_71"
|
||||
app:layout_constraintEnd_toEndOf="@+id/viewLimitingVelocity"
|
||||
app:layout_goneMarginEnd="40dp"
|
||||
app:layout_goneMarginTop="@dimen/dp_236"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintTop_toBottomOf="@+id/viewLimitingVelocity"/>
|
||||
app:layout_constraintEnd_toEndOf="@+id/viewLimitingVelocity"
|
||||
app:layout_constraintTop_toBottomOf="@+id/viewLimitingVelocity"
|
||||
app:layout_goneMarginEnd="40dp"
|
||||
app:layout_goneMarginTop="@dimen/dp_236" />
|
||||
|
||||
<!-- 前方路况探查 -->
|
||||
<com.mogo.eagle.core.function.view.RoadCrossRoamView
|
||||
android:layout_width="@dimen/dp_600"
|
||||
android:layout_height="@dimen/dp_740"
|
||||
android:layout_marginTop="@dimen/dp_350"
|
||||
android:layout_marginRight="@dimen/dp_50"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<!-- 地图marker点击触发路侧直播 -->
|
||||
<com.mogo.eagle.core.function.hmi.ui.camera.RoadCrossLiveView
|
||||
android:layout_width="@dimen/dp_800"
|
||||
android:layout_height="@dimen/dp_560"
|
||||
android:layout_marginTop="@dimen/dp_333"
|
||||
android:layout_marginEnd="@dimen/dp_50"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<!--消息盒子选择入口-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxButtonView
|
||||
@@ -194,21 +213,21 @@
|
||||
android:id="@+id/module_mogo_och_station_panel_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/transparent"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:layout_marginTop="-25dp"
|
||||
android:background="@android:color/transparent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/module_mogo_och_autopilot_status"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<com.mogo.och.common.module.wigets.map.orderstatus.OrderStatusView
|
||||
android:id="@+id/module_mogo_och_operation_status"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:layout_marginBottom="@dimen/dp_16"
|
||||
android:layout_marginStart="@dimen/dp_19"
|
||||
android:layout_width="@dimen/dp_316"
|
||||
android:layout_height="@dimen/dp_144"/>
|
||||
android:layout_height="@dimen/dp_144"
|
||||
android:layout_marginStart="@dimen/dp_19"
|
||||
android:layout_marginBottom="@dimen/dp_16"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/taxi_driver_role_tv"
|
||||
@@ -224,38 +243,38 @@
|
||||
|
||||
<com.mogo.och.common.module.wigets.map.toolsview.ToolsView
|
||||
android:id="@+id/toolsView"
|
||||
android:layout_width="@dimen/dp_142"
|
||||
android:layout_height="@dimen/dp_142"
|
||||
android:layout_marginStart="-11dp"
|
||||
android:layout_marginBottom="@dimen/dp_17"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@id/module_mogo_och_operation_status"
|
||||
android:layout_width="@dimen/dp_142"
|
||||
android:layout_height="@dimen/dp_142"/>
|
||||
app:layout_constraintLeft_toRightOf="@id/module_mogo_och_operation_status" />
|
||||
|
||||
|
||||
<com.mogo.och.common.module.wigets.map.switchvisual.VisualView
|
||||
android:id="@+id/switch_visual_view"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@id/toolsView"
|
||||
android:layout_width="@dimen/dp_142"
|
||||
android:layout_height="@dimen/dp_142"
|
||||
android:layout_marginStart="-10dp"
|
||||
android:layout_marginBottom="@dimen/dp_17"
|
||||
android:layout_width="@dimen/dp_142"
|
||||
android:layout_height="@dimen/dp_142"/>
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@id/toolsView" />
|
||||
|
||||
<com.mogo.och.common.module.wigets.map.reportworkorder.ReportWorkOrderView
|
||||
android:id="@+id/reportworkorderview"
|
||||
android:layout_width="@dimen/dp_142"
|
||||
android:layout_height="@dimen/dp_142"
|
||||
android:layout_marginStart="-10dp"
|
||||
android:layout_marginBottom="@dimen/dp_17"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@id/switch_visual_view"
|
||||
android:layout_width="@dimen/dp_142"
|
||||
android:layout_height="@dimen/dp_142"/>
|
||||
app:layout_constraintLeft_toRightOf="@id/switch_visual_view" />
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.RomaTaxiView
|
||||
android:layout_width="@dimen/dp_142"
|
||||
android:layout_height="@dimen/dp_142"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginStart="-10dp"
|
||||
android:layout_marginBottom="@dimen/dp_17"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@id/reportworkorderview"
|
||||
app:roma_close_bg="@drawable/common_driverroma_normal"
|
||||
app:roma_open_bg="@drawable/common_driver_roma_press" />
|
||||
@@ -349,7 +368,7 @@
|
||||
|
||||
<com.mogo.och.common.module.wigets.LoadingMapStatusView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.ConnectionProcessView
|
||||
android:layout_width="wrap_content"
|
||||
@@ -357,8 +376,7 @@
|
||||
android:layout_marginBottom="@dimen/dp_18"
|
||||
app:layout_constraintBottom_toTopOf="@id/viewVersionName"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
/>
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -8,7 +8,7 @@ apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
apply plugin: 'kotlin-kapt'
|
||||
|
||||
apply from: rootProject.file('gradle/bytex/bytex.gradle')
|
||||
//apply from: rootProject.file('gradle/bytex/bytex.gradle')
|
||||
|
||||
Properties properties = new Properties()
|
||||
properties.load(project.rootProject.file("gradle.properties").newDataInputStream())
|
||||
@@ -230,6 +230,7 @@ dependencies {
|
||||
androidTestImplementation rootProject.ext.dependencies.androidx_espresso_core
|
||||
androidTestImplementation rootProject.ext.dependencies.localbroadcastmanager
|
||||
androidTestImplementation rootProject.ext.dependencies.downloader
|
||||
androidTestImplementation project(":libraries:mogo-map")
|
||||
}
|
||||
|
||||
|
||||
|
||||
1
app/src/androidTest/assets/polygon.txt
Normal file
@@ -0,0 +1 @@
|
||||
112.57337137520945,26.822950000610152,112.5733703998375,26.82294943400411,112.57336923793872,26.82294944578748,112.57336827709125,26.82295003202963,112.57336786590433,26.822950822795498,112.57332583348149,26.823144415135413,112.57332583904886,26.823145130116597,112.57332615359141,26.82314578706645,112.57332672775591,26.823146282906478,112.57332747145331,26.823146539837108,112.57332807078356,26.823146549872188,112.57332882464814,26.82314631801647,112.57332941903356,26.823145841742402,112.57332970267485,26.82314536795171,112.57339652767452,26.82297757920771,112.57339644737766,26.82297673161999,112.57339607387638,26.822976136665098,112.57337137520945,26.822950000610152
|
||||
113
app/src/androidTest/java/com/mogo/functions/test/RoadInfoTest.kt
Normal file
@@ -0,0 +1,113 @@
|
||||
package com.mogo.functions.test
|
||||
|
||||
import android.util.Log
|
||||
import androidx.test.core.app.ActivityScenario
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.LargeTest
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import com.mogo.eagle.core.function.main.MainLauncherActivity
|
||||
import com.mogo.eagle.function.biz.v2x.v2n.utils.V2NUtils
|
||||
import com.mogo.map.MapDataWrapper
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@LargeTest
|
||||
class RoadInfoTest {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "RoadInfoTest"
|
||||
}
|
||||
|
||||
lateinit var launch: ActivityScenario<MainLauncherActivity>
|
||||
|
||||
@Before
|
||||
fun before() {
|
||||
launch = ActivityScenario.launch(MainLauncherActivity::class.java)
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
fun testGetRoadName(): Unit = runBlocking {
|
||||
val arguments = InstrumentationRegistry.getArguments()
|
||||
val millis = arguments.getString("delay", "0").toLong()
|
||||
if (millis > 0) {
|
||||
delay(millis)
|
||||
}
|
||||
val lon = arguments.getString("lon", "0").toDouble()
|
||||
val lat = arguments.getString("lat", "0").toDouble()
|
||||
val angle = arguments.getString("angle", "0").toFloat()
|
||||
val times = arguments.getString("times", "1").toInt()
|
||||
var count = 0
|
||||
Log.d(TAG, "lon: $lon, lat:$lat, angle: $angle, times: $times")
|
||||
while (count < times) {
|
||||
val roadInfo = MapDataWrapper.getRoadInfo(lon, lat, angle)
|
||||
Log.d(TAG, "road-data: $roadInfo")
|
||||
delay(millis)
|
||||
count++
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
fun testGetLaneInfo(): Unit = runBlocking {
|
||||
val arguments = InstrumentationRegistry.getArguments()
|
||||
val millis = arguments.getString("delay", "0").toLong()
|
||||
if (millis > 0) {
|
||||
delay(millis)
|
||||
}
|
||||
val tileId = arguments.getString("tileId", "0").toLong()
|
||||
val roadId = arguments.getString("roadId", "0").toInt()
|
||||
val times = arguments.getString("times", "1").toInt()
|
||||
Log.d(TAG, "tileId: $tileId, roadId:$roadId, times: $times")
|
||||
var count = 0
|
||||
while (count < times) {
|
||||
val laneInfo = MapDataWrapper.getLaneInfo(tileId, roadId)
|
||||
Log.d(TAG, "lane-data: ${ laneInfo.joinToString(",") { itx -> itx.points.joinToString("-") { "${it.first}->${it.second}" } } }")
|
||||
count++
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testComputeOccupyLaneInfo(): Unit = runBlocking {
|
||||
val arguments = InstrumentationRegistry.getArguments()
|
||||
val millis = arguments.getString("delay", "0").toLong()
|
||||
if (millis > 0) {
|
||||
delay(millis)
|
||||
}
|
||||
val lon = arguments.getString("lon", "0").toDouble()
|
||||
val lat = arguments.getString("lat", "0").toDouble()
|
||||
val angle = arguments.getString("angle", "0").toFloat()
|
||||
val times = arguments.getString("times", "1").toInt()
|
||||
var count = 0
|
||||
while (count < times) {
|
||||
val polygon = readPolygonJson()
|
||||
Log.d(TAG, "polygon -> " + polygon.joinToString(","))
|
||||
val decision = V2NUtils.computeOccupyLanesInfo(Triple(0.0, 0.0, 1f), Triple(lon, lat, angle), polygon)
|
||||
Log.d(TAG, "decision -> $decision")
|
||||
count++
|
||||
}
|
||||
}
|
||||
|
||||
private fun readPolygonJson(): List<Pair<Double, Double>> {
|
||||
return InstrumentationRegistry.getInstrumentation().context.assets.open("polygon.txt").reader().use { itx ->
|
||||
val items = itx.readLines().map { xx ->
|
||||
xx.split(",").map { it.trim().toDouble() }
|
||||
}.flatten()
|
||||
val result = ArrayList<Pair<Double, Double>>()
|
||||
var first = 0.0
|
||||
for ((index, data) in items.withIndex()) {
|
||||
if ((index % 2) == 0) {
|
||||
first = data
|
||||
} else {
|
||||
result.add(Pair(first, data))
|
||||
}
|
||||
}
|
||||
result
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -235,7 +235,10 @@ ext {
|
||||
google_auto_service : "com.google.auto.service:auto-service:1.0-rc7",
|
||||
|
||||
//======================== handler-proxy-runtime ==============
|
||||
handler_proxy_runtime : "com.mogo.eagle.core.handler.proxy:runtime:10.0.10"
|
||||
handler_proxy_runtime : "com.mogo.eagle.core.handler.proxy:runtime:10.0.10",
|
||||
|
||||
//======================== jts-core ==============
|
||||
jts_core : "org.locationtech.jts:jts-core:1.19.0"
|
||||
]
|
||||
android = [
|
||||
fLauncherApplicationId : "com.mogo.launcher.f",
|
||||
|
||||
@@ -67,8 +67,9 @@ dependencies {
|
||||
kapt rootProject.ext.dependencies.androidxroomcompiler
|
||||
implementation rootProject.ext.dependencies.androidxroomktx
|
||||
implementation rootProject.ext.dependencies.localbroadcastmanager
|
||||
implementation rootProject.ext.dependencies.jts_core
|
||||
compileOnly project(':core:function-impl:mogo-core-function-map')
|
||||
|
||||
compileOnly project(":libraries:mogo-map")
|
||||
implementation project(':foudations:mogo-commons')
|
||||
implementation project(':core:mogo-core-utils')
|
||||
implementation project(':core:mogo-core-network')
|
||||
|
||||
@@ -26,19 +26,25 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListen
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerV2XListenerManager.V2NCarTypeCheck
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerRoadV2NEventWindowListenerManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager.saveMsgBox
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.util.CoordinateTransform
|
||||
import com.mogo.eagle.core.utilcode.util.CoordinateUtils
|
||||
import com.mogo.eagle.core.utilcode.util.DrivingDirectionUtils
|
||||
import com.mogo.eagle.function.biz.v2x.V2XBizTrace
|
||||
import com.mogo.eagle.function.biz.v2x.v2n.scenario.scene.airoad.AiRoadMarker
|
||||
import com.mogo.eagle.function.biz.v2x.v2n.scenario.scene.airoad.AiRoadMarker.Marker
|
||||
import com.mogo.eagle.function.biz.v2x.v2n.utils.V2NUtils
|
||||
import com.mogo.eagle.function.biz.v2x.v2n.utils.V2XEventAnalyticsManager
|
||||
import com.mogo.map.entities.Lane
|
||||
import mogo.telematics.pad.MessagePad.Header
|
||||
import mogo.telematics.pad.MessagePad.TrackedObject
|
||||
import mogo.v2x.MogoV2X
|
||||
import mogo.v2x.MogoV2X.RSI_PB
|
||||
import mogo.v2x.MogoV2X.RTEData_PB
|
||||
import java.lang.Math.abs
|
||||
|
||||
/**
|
||||
* V2N上车相关事件绘制
|
||||
@@ -64,7 +70,7 @@ internal object V2NIdentifyDrawer {
|
||||
Log.d("V2NIdentifyDrawer", "---callback -- drawShiGu --- 1 ---")
|
||||
}
|
||||
val car = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
|
||||
val filtered = events.filterIsInstance(TrackedObject::class.java).filter { itx ->
|
||||
val filtered = events.filterIsInstance<TrackedObject>().filter { itx ->
|
||||
DrivingDirectionUtils.getDegreeOfCar2Poi(
|
||||
car.longitude,
|
||||
car.latitude,
|
||||
@@ -140,33 +146,62 @@ internal object V2NIdentifyDrawer {
|
||||
)
|
||||
)
|
||||
)
|
||||
CallerHmiManager.warningV2X(
|
||||
poiType,
|
||||
alertContent,
|
||||
ttsContent,
|
||||
object : IMoGoWarningStatusListener {
|
||||
override fun onShow() {
|
||||
super.onShow()
|
||||
runCatching { CallerHmiManager.notifyXiaoZhiStatusChanged(V2N(EventTypeEnumNew.getEnumType(poiType)), State.START) }
|
||||
CallerVisualAngleManager.changeAngle(
|
||||
RoadEvent(
|
||||
itx.longitude,
|
||||
itx.latitude,
|
||||
itx.angle
|
||||
)
|
||||
)
|
||||
// CallerHmiManager.warningV2X(
|
||||
// poiType,
|
||||
// alertContent,
|
||||
// ttsContent,
|
||||
// object : IMoGoWarningStatusListener {
|
||||
// override fun onShow() {
|
||||
// super.onShow()
|
||||
// runCatching { CallerHmiManager.notifyXiaoZhiStatusChanged(V2N(EventTypeEnumNew.getEnumType(poiType)), State.START) }
|
||||
// CallerVisualAngleManager.changeAngle(
|
||||
// RoadEvent(
|
||||
// itx.longitude,
|
||||
// itx.latitude,
|
||||
// itx.angle
|
||||
// )
|
||||
// )
|
||||
// }
|
||||
//
|
||||
// override fun onDismiss() {
|
||||
// super.onDismiss()
|
||||
// runCatching { CallerHmiManager.notifyXiaoZhiStatusChanged(V2N(EventTypeEnumNew.getEnumType(poiType)), State.STOP) }
|
||||
// CallerVisualAngleManager.changeAngle(Default())
|
||||
// }
|
||||
// },
|
||||
// ALERT_WARNING_TOP,
|
||||
// 10000,
|
||||
// false
|
||||
// )
|
||||
if (polygon.isNotEmpty()) {
|
||||
val decision = V2NUtils.computeOccupyLanesInfo(Triple(car.longitude, car.latitude, car.heading.toFloat()), Triple(itx.longitude, itx.latitude, itx.heading.toFloat()), polygon.map { kotlin.Pair(it.first, it.second) })
|
||||
if (decision != null) {
|
||||
val isDriver = AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)
|
||||
val total = decision.total
|
||||
val occupy = decision.occupy
|
||||
val laneId = decision.laneId
|
||||
val sb = StringBuilder()
|
||||
if (laneId != null) {
|
||||
val isOccupy = occupy.find { it.id == laneId } != null
|
||||
if (isOccupy) {
|
||||
if (isDriver) {
|
||||
val bestLane = computeBestLane(laneId, occupy, total)
|
||||
sb.append("发现前方${distance.toInt()}米${ if (poiType == EventTypeEnumNew.TYPE_SOCKET_ROAD_SHIGONG.poiType) "车道施工" else "车道事故" }, 蘑菇建议您尽快${bestLane.second}")
|
||||
} else {
|
||||
sb.append("发现前方${distance.toInt()}米${ if (poiType == EventTypeEnumNew.TYPE_SOCKET_ROAD_SHIGONG.poiType) "车道施工" else "车道事故" }, 蘑菇时刻为您守护")
|
||||
}
|
||||
} else {
|
||||
if (isDriver) {
|
||||
sb.append("发现前方${distance.toInt()}米${ if (poiType == EventTypeEnumNew.TYPE_SOCKET_ROAD_SHIGONG.poiType) "车道施工" else "车道事故" }, 蘑菇提醒您小心${ if (computeDirection(laneId, occupy) > 0) "右侧" else "左侧" }行人及来车")
|
||||
} else {
|
||||
sb.append("发现前方${distance.toInt()}米${ if (poiType == EventTypeEnumNew.TYPE_SOCKET_ROAD_SHIGONG.poiType) "车道施工" else "车道事故" }, 蘑菇时刻为您守护")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDismiss() {
|
||||
super.onDismiss()
|
||||
runCatching { CallerHmiManager.notifyXiaoZhiStatusChanged(V2N(EventTypeEnumNew.getEnumType(poiType)), State.STOP) }
|
||||
CallerVisualAngleManager.changeAngle(Default())
|
||||
}
|
||||
},
|
||||
ALERT_WARNING_TOP,
|
||||
10000,
|
||||
false
|
||||
)
|
||||
val alert = sb.toString()
|
||||
CallerRoadV2NEventWindowListenerManager.show("${itx.longitude}-${itx.latitude}", itx.systemTime.toLong(), EventTypeEnumNew.getMarker3DRes(poiType), alert, isDriver, itx.cameraIp, itx.longitude, itx.latitude)
|
||||
}
|
||||
}
|
||||
//消息埋点
|
||||
V2XEventAnalyticsManager.triggerV2XEvent(
|
||||
poiType, alertContent, ttsContent,
|
||||
@@ -184,7 +219,7 @@ internal object V2NIdentifyDrawer {
|
||||
return@Callback true
|
||||
}
|
||||
val car = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
|
||||
val filtered = events.filterIsInstance(MogoV2X.RTEData_PB::class.java).filter { itx ->
|
||||
val filtered = events.filterIsInstance<RTEData_PB>().filter { itx ->
|
||||
val eventLon =
|
||||
itx.eventPos?.offsetLL?.positionLatLon?.lon?.let { it * 1.0 / 10_000_000 }
|
||||
?: 0.0
|
||||
@@ -291,6 +326,55 @@ internal object V2NIdentifyDrawer {
|
||||
true
|
||||
}
|
||||
|
||||
private fun computeDirection(laneId: Int, occupy: List<Lane>): Int {
|
||||
val left = occupy.first()
|
||||
return if (laneId <= left.id) {
|
||||
1
|
||||
} else {
|
||||
-1
|
||||
}
|
||||
}
|
||||
|
||||
private fun computeBestLane(laneId: Int, occupy: List<Lane>, total: List<Lane>): kotlin.Pair<Int, String> {
|
||||
if (occupy.size == total.size) {
|
||||
return kotlin.Pair(Int.MIN_VALUE, "更换路线")
|
||||
}
|
||||
val map = HashMap<Int, String>()
|
||||
if (total.size % 2 == 0) {
|
||||
val half = total.size / 2
|
||||
for (i in 0 until half) {
|
||||
val left = total[i]
|
||||
val right = total[half + i]
|
||||
map[left.id] = "驶入左${i + 1}车道"
|
||||
map[right.id] = "驶入右${i + 1}车道"
|
||||
}
|
||||
} else {
|
||||
val middle = total.size / 2
|
||||
map[total[middle].id] = "驶入中间车道"
|
||||
for (i in 0 until middle) {
|
||||
val left = total[i]
|
||||
val right = total[middle + i + 1]
|
||||
map[left.id] = "驶入左${i + 1}车道"
|
||||
map[right.id] = "驶入右${i + 1}车道"
|
||||
}
|
||||
}
|
||||
val ids = occupy.map { it.id }
|
||||
val freeLanes = total.filter { itx -> !ids.contains(itx.id) }
|
||||
if (freeLanes.isNotEmpty()) {
|
||||
var best = Int.MIN_VALUE
|
||||
var delta = Int.MAX_VALUE
|
||||
for (lane in freeLanes) {
|
||||
val abs = kotlin.math.abs(lane.id - laneId)
|
||||
if (abs < delta && lane.id != laneId) {
|
||||
best = lane.id
|
||||
delta = abs
|
||||
}
|
||||
}
|
||||
return kotlin.Pair(best, map[best] ?: "更换路线")
|
||||
}
|
||||
return kotlin.Pair(Int.MIN_VALUE, "更换路线")
|
||||
}
|
||||
|
||||
private fun getTtsContent(poiType: String, distance: Double): String {
|
||||
return when (poiType) {
|
||||
EventTypeEnumNew.TYPE_SOCKET_ROAD_SHIGONG.poiType -> {
|
||||
|
||||
@@ -5,17 +5,16 @@ import android.graphics.Color
|
||||
import android.os.Handler
|
||||
import android.os.HandlerThread
|
||||
import android.os.Looper
|
||||
import android.util.Log
|
||||
import android.view.animation.DecelerateInterpolator
|
||||
import androidx.core.util.Pair
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng
|
||||
import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerRoadV2NEventWindowListenerManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||
import com.mogo.eagle.core.utilcode.util.CoordinateUtils
|
||||
import com.mogo.eagle.core.utilcode.util.DrivingDirectionUtils
|
||||
import com.mogo.eagle.function.biz.v2x.V2XBizTrace
|
||||
import com.mogo.eagle.function.biz.v2x.v2n.V2XEventManager
|
||||
import com.mogo.eagle.function.biz.v2x.v2n.consts.V2XConst
|
||||
import com.mogo.eagle.function.biz.v2x.v2n.remove.MarkerRemoveManager
|
||||
import com.mogo.eagle.function.biz.v2x.v2n.remove.MarkerWrapper
|
||||
@@ -232,7 +231,10 @@ class AiRoadMarker {
|
||||
wrapper.addLine(line)
|
||||
}
|
||||
wrapper.onRemoved = { id ->
|
||||
aiMakers.remove(id)
|
||||
aiMakers.remove(id)?.also {
|
||||
val m = it.marker.get()
|
||||
CallerRoadV2NEventWindowListenerManager.dismiss("${m.poi_lon}-${m.poi_lat}")
|
||||
}
|
||||
}
|
||||
MarkerRemoveManager.addMarker(wrapper)
|
||||
countDown.set(0)
|
||||
@@ -257,6 +259,7 @@ class AiRoadMarker {
|
||||
roadMarker.removeMarkers()
|
||||
handler.removeCallbacks(checkExpiredTask)
|
||||
aiMakers.remove(marker.id)
|
||||
CallerRoadV2NEventWindowListenerManager.dismiss("${marker.poi_lon}-${marker.poi_lat}")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.mogo.eagle.function.biz.v2x.v2n.utils
|
||||
|
||||
import android.util.Log
|
||||
import androidx.annotation.WorkerThread
|
||||
import com.mogo.map.MapDataWrapper
|
||||
import com.mogo.map.entities.Lane
|
||||
import com.zhidaoauto.map.data.road.CenterLine
|
||||
import org.locationtech.jts.geom.Coordinate
|
||||
import org.locationtech.jts.geom.GeometryFactory
|
||||
import java.util.concurrent.CountDownLatch
|
||||
|
||||
object V2NUtils {
|
||||
|
||||
private const val TAG = "V2NUtils"
|
||||
|
||||
@WorkerThread
|
||||
fun computeOccupyLanesInfo(car: Triple<Double, Double, Float>, point: Triple<Double, Double, Float> ,polygon: List<Pair<Double, Double>>): Decision? {
|
||||
val roadInfo = MapDataWrapper.getRoadInfo(point.first, point.second, point.third)
|
||||
Log.d(TAG, "road_info:$roadInfo")
|
||||
val lanes = MapDataWrapper.getLaneInfo(roadInfo.tileId, roadInfo.roadId)
|
||||
Log.d(TAG, "lanes: ${lanes.joinToString(",") { itx -> itx.points.joinToString(",") { "${it.first}, ${it.second}" } } }")
|
||||
if (lanes.isEmpty()) {
|
||||
return null
|
||||
}
|
||||
val occupy = ArrayList<Lane>()
|
||||
val factory = GeometryFactory()
|
||||
for (lane in lanes) {
|
||||
val p1 = factory.createPolygon(polygon.map { Coordinate(it.first, it.second) }.toTypedArray())
|
||||
val p2 = factory.createLineString(lane.points.map { Coordinate(it.first, it.second) }.toTypedArray()).buffer((lane.width.toDouble() * 0.7 * (1e-5)) / 2.0)
|
||||
if (p1.intersects(p2)) {
|
||||
occupy += lane
|
||||
}
|
||||
}
|
||||
val latch = CountDownLatch(1)
|
||||
var centerLine: CenterLine? = null
|
||||
MapDataWrapper.getCenterLineInfo(car.first, car.second, car.third) {
|
||||
centerLine = it
|
||||
latch.countDown()
|
||||
}
|
||||
latch.await()
|
||||
return Decision(centerLine?.lane_id?.toInt() , lanes, occupy)
|
||||
}
|
||||
|
||||
data class Decision(val laneId: Int? = null,val total: List<Lane>, val occupy: List<Lane>)
|
||||
}
|
||||
@@ -27,7 +27,7 @@ class CameraListAdapter : Adapter<CameraListAdapter.CameraListHolder> {
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CameraListHolder {
|
||||
var view = LayoutInflater.from(parent.context)
|
||||
val view = LayoutInflater.from(parent.context)
|
||||
.inflate(R.layout.item_camera_info, parent, false)
|
||||
return CameraListHolder(view)
|
||||
}
|
||||
|
||||
@@ -1,26 +1,179 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.camera
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.PorterDuff
|
||||
import android.graphics.PorterDuffColorFilter
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.os.Message
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.mogo.eagle.core.data.road.RoadCameraLive
|
||||
import com.mogo.eagle.core.function.api.map.road.IMoGoMapRoadListener
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager
|
||||
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.function.hmi.ui.utils.HmiActionLog
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.eagle.core.widget.media.video.SimpleVideoPlayer
|
||||
import com.shuyu.gsyvideoplayer.GSYVideoManager
|
||||
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
|
||||
import com.shuyu.gsyvideoplayer.model.VideoOptionModel
|
||||
import com.shuyu.gsyvideoplayer.player.IjkPlayerManager
|
||||
import com.shuyu.gsyvideoplayer.player.PlayerFactory
|
||||
import com.shuyu.gsyvideoplayer.utils.GSYVideoType
|
||||
import com.zhidaoauto.map.data.road.RoadCross
|
||||
import kotlinx.android.synthetic.main.view_road_cross_live.view.roadCrossLiveClose
|
||||
import kotlinx.android.synthetic.main.view_road_cross_live.view.roadCrossLivePB
|
||||
import kotlinx.android.synthetic.main.view_road_cross_live.view.roadCrossLivePlayer
|
||||
import tv.danmaku.ijk.media.player.IjkMediaPlayer
|
||||
|
||||
class RoadCrossLiveView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr) {
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoMapRoadListener {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "RoadCrossLiveView"
|
||||
private const val CLOSE_VIEW_DELAY_TIME = 10_000L
|
||||
}
|
||||
|
||||
@Volatile
|
||||
private var curLiveDevice: String? = null
|
||||
|
||||
private val gsyVideoOptionBuilder by lazy {
|
||||
GSYVideoOptionBuilder()
|
||||
}
|
||||
|
||||
private val handler = object : Handler(Looper.getMainLooper()) {
|
||||
override fun handleMessage(msg: Message) {
|
||||
super.handleMessage(msg)
|
||||
if (this@RoadCrossLiveView.visibility == View.VISIBLE) {
|
||||
closeView()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_road_cross_live, this, true)
|
||||
val res = when (CallerSkinModeListenerManager.getMode()) {
|
||||
0 -> R.layout.view_road_cross_live
|
||||
1 -> R.layout.view_road_cross_live_light
|
||||
else -> R.layout.view_road_cross_live
|
||||
}
|
||||
LayoutInflater.from(context).inflate(res, this, true)
|
||||
initVideoPlayer()
|
||||
roadCrossLivePB.indeterminateDrawable.colorFilter = PorterDuffColorFilter(
|
||||
ContextCompat.getColor(context, R.color.notice_blue),
|
||||
PorterDuff.Mode.MULTIPLY
|
||||
)
|
||||
roadCrossLiveClose.setOnClickListener {
|
||||
HmiActionLog.hmiAction("关闭路侧视频流", "")
|
||||
closeView()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun initVideoPlayer() {
|
||||
val list: MutableList<VideoOptionModel> = ArrayList()
|
||||
list.add(VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "reconnect", 3))
|
||||
GSYVideoManager.instance().optionModelList = list
|
||||
GSYVideoType.setShowType(GSYVideoType.SCREEN_TYPE_16_9)
|
||||
PlayerFactory.setPlayManager(IjkPlayerManager::class.java)
|
||||
roadCrossLivePlayer.outLinePixel = 12f
|
||||
roadCrossLivePlayer.setPlayListener(object : SimpleVideoPlayer.PlayListener {
|
||||
override fun onPlayEvent(event: Int) {
|
||||
CallerLogger.d("$M_HMI$TAG", "onPlayEvent: event is:$event")
|
||||
when (event) {
|
||||
SimpleVideoPlayer.PLAY_EVT_PLAY_LOADING -> {
|
||||
// 会出现临时中断后又可以继续播放,需要停掉倒计时
|
||||
}
|
||||
|
||||
SimpleVideoPlayer.PLAY_EVT_PLAY_BEGIN -> {
|
||||
roadCrossLivePB.visibility = View.GONE
|
||||
roadCrossLivePlayer.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
else -> {
|
||||
CallerLogger.w("$M_HMI$TAG", "播放视频异常,event is:$event")
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
CallerMapRoadListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
override fun onRoadChange(cross: Boolean, roadCross: RoadCross?) {
|
||||
super.onRoadChange(cross, roadCross)
|
||||
// 离开路口,进入路段,发送handler3秒后隐藏播放器
|
||||
if (!cross) {
|
||||
handler.sendEmptyMessageDelayed(0, CLOSE_VIEW_DELAY_TIME)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onRoadCrossClick() {
|
||||
super.onRoadCrossClick()
|
||||
if (this.visibility == View.VISIBLE) {
|
||||
return
|
||||
}
|
||||
resetView()
|
||||
}
|
||||
|
||||
override fun onCrossLiveInfo(info: RoadCameraLive) {
|
||||
super.onCrossLiveInfo(info)
|
||||
if (curLiveDevice != null && curLiveDevice == info.ip) {
|
||||
CallerLogger.w("$M_HMI$TAG", "播放视频异常,当前播放设备与上次相同,ip:${info.ip}")
|
||||
return
|
||||
}
|
||||
curLiveDevice = info.ip
|
||||
ThreadUtils.runOnUiThread {
|
||||
HmiActionLog.hmiAction("触发marker点击,播放路侧视频流", info.toString())
|
||||
gsyVideoPlay(info.imageUrl, info.liveUrl)
|
||||
}
|
||||
}
|
||||
|
||||
private fun gsyVideoPlay(img: String, live: String) {
|
||||
resetView()
|
||||
gsyVideoOptionBuilder.setUrl(live)
|
||||
.setCacheWithPlay(false)
|
||||
.setAutoFullWithSize(false)
|
||||
.setIsTouchWigetFull(false)
|
||||
.setIsTouchWiget(false)
|
||||
.setPlayTag(TAG).build(roadCrossLivePlayer)
|
||||
roadCrossLivePlayer.startButton.performClick()
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置视图,播放下一个
|
||||
*/
|
||||
private fun resetView() {
|
||||
this.visibility = View.VISIBLE
|
||||
roadCrossLivePB.visibility = View.VISIBLE
|
||||
roadCrossLivePlayer.onVideoReset()
|
||||
}
|
||||
|
||||
/**
|
||||
* 隐藏view,释放视频控制器
|
||||
*/
|
||||
private fun closeView() {
|
||||
this.visibility = View.GONE
|
||||
roadCrossLivePlayer.visibility = View.GONE
|
||||
curLiveDevice = null
|
||||
GSYVideoManager.releaseAllVideos()
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerMapRoadListenerManager.removeListener(TAG)
|
||||
closeView()
|
||||
}
|
||||
}
|
||||
@@ -419,8 +419,6 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
* 状态中心
|
||||
*/
|
||||
tbStatusCenter.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||
val cross = RoadCross()
|
||||
// CallerMapRoadListenerManager.invokeRoadChange(0, cross)
|
||||
if (isChecked) {
|
||||
buttonView.setCompoundDrawables(null, null, iconDown, null)
|
||||
//展示状态中心
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||
<corners android:radius="@dimen/dp_12"/>
|
||||
<solid android:color="@color/color_252B3F"/>
|
||||
</shape>
|
||||
|
After Width: | Height: | Size: 100 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 7.0 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
@@ -1,6 +1,82 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/bg_road_cross_live">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/roadCrossLiveBg"
|
||||
android:layout_width="@dimen/dp_760"
|
||||
android:layout_height="@dimen/dp_428"
|
||||
android:layout_margin="@dimen/dp_20"
|
||||
android:background="@drawable/bg_road_cross_empty"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/bg_road_cross_logo"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<com.mogo.eagle.core.widget.media.video.SimpleVideoPlayer
|
||||
android:id="@+id/roadCrossLivePlayer"
|
||||
android:layout_width="@dimen/dp_760"
|
||||
android:layout_height="@dimen/dp_428"
|
||||
android:layout_margin="@dimen/dp_20"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.core.widget.ContentLoadingProgressBar
|
||||
android:id="@+id/roadCrossLivePB"
|
||||
style="?android:attr/progressBarStyleSmall"
|
||||
android:layout_width="@dimen/dp_55"
|
||||
android:layout_height="@dimen/dp_55"
|
||||
android:layout_marginTop="@dimen/dp_214"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/roadCrossLiveClose"
|
||||
android:layout_width="@dimen/dp_70"
|
||||
android:layout_height="@dimen/dp_70"
|
||||
android:src="@drawable/bg_road_cross_live_close"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_63"
|
||||
android:layout_height="@dimen/dp_46"
|
||||
android:layout_marginStart="@dimen/dp_20"
|
||||
android:layout_marginTop="@dimen/dp_480"
|
||||
android:src="@drawable/bg_road_cross_xiaozhi"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_90"
|
||||
android:layout_marginTop="@dimen/dp_473"
|
||||
android:text="@string/road_cross_live_tip"
|
||||
android:textColor="@color/color_50E8E4"
|
||||
android:textSize="@dimen/dp_30"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -23,6 +23,8 @@
|
||||
<color name="color_2C2E30">#2C2E30</color>
|
||||
<color name="color_2D3E5F">#2D3E5F</color>
|
||||
<color name="color_D4D8DC">#D4D8DC</color>
|
||||
<color name="color_50E8E4">#50E8E4</color>
|
||||
<color name="color_252B3F">#252B3F</color>
|
||||
<color name="color_27FFFFFF">#27FFFFFF</color>
|
||||
<color name="color_1E111111">#1E111111</color>
|
||||
<color name="color_FF213757">#FF213757</color>
|
||||
|
||||
@@ -127,4 +127,6 @@
|
||||
<string name="exploration_title">正在为您探查前方道路</string>
|
||||
<string name="exploration_close">自动探索关闭按钮</string>
|
||||
|
||||
|
||||
<string name="road_cross_live_tip">蘑菇为您实时护航中,请放心驾驶!</string>
|
||||
</resources>
|
||||
|
||||
@@ -70,6 +70,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.androidxroomktx
|
||||
implementation rootProject.ext.dependencies.view_model_scope
|
||||
implementation rootProject.ext.dependencies.lifecycle_extension
|
||||
implementation rootProject.ext.dependencies.androidxrecyclerview
|
||||
|
||||
implementation project(':foudations:mogo-commons')
|
||||
implementation project(':core:mogo-core-res')
|
||||
|
||||
@@ -2,7 +2,9 @@ package com.mogo.eagle.core.function.business.roadcross
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.os.Message
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant
|
||||
import com.mogo.eagle.core.data.road.CameraDeviceInfo
|
||||
@@ -14,6 +16,7 @@ import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||
import com.mogo.eagle.core.function.view.CameraMarkerView
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAP
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.map.overlay.core.Level
|
||||
import com.mogo.map.overlay.point.Point
|
||||
@@ -26,6 +29,7 @@ class RoadCrossCameraManager : IMoGoMapRoadListener {
|
||||
companion object {
|
||||
|
||||
private const val TAG = "RoadCrossCameraManager"
|
||||
private const val REMOVE_MARKER_DELAY_TIME = 10_000L
|
||||
|
||||
val instance: RoadCrossCameraManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
|
||||
RoadCrossCameraManager()
|
||||
@@ -42,18 +46,24 @@ class RoadCrossCameraManager : IMoGoMapRoadListener {
|
||||
|
||||
private val overlayManager = CallerMapUIServiceManager.getOverlayManager()
|
||||
|
||||
private val handler = object :Handler(Looper.getMainLooper()){
|
||||
override fun handleMessage(msg: Message) {
|
||||
super.handleMessage(msg)
|
||||
overlayManager?.removeAllPointsInOwner(TAG)
|
||||
}
|
||||
}
|
||||
|
||||
fun init(context: Context?) {
|
||||
mContext = context
|
||||
CallerMapRoadListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
//todo 记录方法执行时间
|
||||
private var distance: Double by Delegates.observable(0.0) { _, _, newV ->
|
||||
if (!isCameraRequest && newV < 100) {
|
||||
isCameraRequest = true
|
||||
val roadCrossEnd = CallerMapRoadListenerManager.getCrossInfo()?.cross_id_end
|
||||
Log.d(
|
||||
"emArrow",
|
||||
val roadCrossEnd = CallerMapRoadListenerManager.getCrossEndInfo()
|
||||
CallerLogger.d(
|
||||
"$M_MAP$TAG",
|
||||
"触发接口调用 dis: $distance , roadCrossEnd: ${roadCrossEnd ?: "null"} "
|
||||
)
|
||||
if (roadCrossEnd != null) {
|
||||
@@ -69,8 +79,10 @@ class RoadCrossCameraManager : IMoGoMapRoadListener {
|
||||
}
|
||||
roadCrossCameraList = it.deviceInfoList
|
||||
// 地图上打marker(注意marker方向),marker点击获取对应ip
|
||||
it.deviceInfoList.forEach { deviceInfo ->
|
||||
addCameraDeviceMarker(deviceInfo)
|
||||
ThreadUtils.runOnUiThread {
|
||||
it.deviceInfoList.forEach { deviceInfo ->
|
||||
addCameraDeviceMarker(deviceInfo)
|
||||
}
|
||||
}
|
||||
},
|
||||
onError = {
|
||||
@@ -80,12 +92,12 @@ class RoadCrossCameraManager : IMoGoMapRoadListener {
|
||||
traceError("roadCross is null")
|
||||
}
|
||||
} else {
|
||||
Log.d("emArrow", "distance:$distance")
|
||||
CallerLogger.d("$M_MAP$TAG", "distance:$distance")
|
||||
}
|
||||
}
|
||||
|
||||
private fun addCameraDeviceMarker(cameraDeviceInfo: CameraDeviceInfo) {
|
||||
Log.d("emArrow","add marker:${cameraDeviceInfo.deviceIp}")
|
||||
CallerLogger.d("$M_MAP$TAG", "add marker:${cameraDeviceInfo.deviceIp}")
|
||||
mContext?.let {
|
||||
val builder =
|
||||
Point.Options.Builder(TAG, Level.MAP_MARKER)
|
||||
@@ -100,16 +112,16 @@ class RoadCrossCameraManager : IMoGoMapRoadListener {
|
||||
.longitude(cameraDeviceInfo.lon)
|
||||
.latitude(cameraDeviceInfo.lat)
|
||||
.onClick { id ->
|
||||
Log.d("emArrow", "Marker click :$id")
|
||||
CallerLogger.d("$M_MAP$TAG", "Marker click :$id")
|
||||
CallerMapRoadListenerManager.invokeRoadCrossClick()
|
||||
ndeRoadCameraNetWorkModel.singleRequestCrossLive(id,
|
||||
onSuccess = { live ->
|
||||
CallerMapRoadListenerManager.invokeRoadCrossLive(live)
|
||||
},
|
||||
onError = {errorMsg ->
|
||||
onError = { errorMsg ->
|
||||
traceError(" ${cameraDeviceInfo.deviceIp} click request error :$errorMsg")
|
||||
})
|
||||
}
|
||||
CallerLogger.d("$M_MAP$TAG", "new road cross camera=$overlayManager")
|
||||
overlayManager?.showOrUpdatePoint(builder.build())
|
||||
}
|
||||
}
|
||||
@@ -135,32 +147,21 @@ class RoadCrossCameraManager : IMoGoMapRoadListener {
|
||||
|
||||
override fun onRoadChange(cross: Boolean, roadCross: RoadCross?) {
|
||||
super.onRoadChange(cross, roadCross)
|
||||
val data = CameraDeviceInfo("172.18.1.60", 112.582913287, 26.9320508672) //todo emArrow test
|
||||
addCameraDeviceMarker(data)
|
||||
val data1 = CameraDeviceInfo("172.18.1.42", 112.582947017, 26.9328373092)
|
||||
addCameraDeviceMarker(data1)
|
||||
val data2 = CameraDeviceInfo("172.18.1.72", 112.582421, 26.932519)
|
||||
addCameraDeviceMarker(data2)
|
||||
|
||||
// 出路口
|
||||
if (!cross) {
|
||||
// 停止请求摄像头数据
|
||||
ndeRoadCameraNetWorkModel.cancelRequest("roadCross")
|
||||
// 清除marker
|
||||
roadCrossCameraList?.let {
|
||||
it.forEach { camera ->
|
||||
Log.d("emArrow","remove marker:${camera.deviceIp}")
|
||||
overlayManager?.removePoint(camera.deviceIp)
|
||||
}
|
||||
}
|
||||
CallerLogger.d("$M_MAP$TAG", "remove marker")
|
||||
handler.sendEmptyMessageDelayed(0, REMOVE_MARKER_DELAY_TIME)
|
||||
// 释放控制
|
||||
isCameraRequest = false
|
||||
Log.d("emArrow", "经过路口,释放控制")
|
||||
CallerLogger.d("$M_MAP$TAG", "经过路口,释放控制")
|
||||
}
|
||||
}
|
||||
|
||||
private fun traceError(msg: String) {
|
||||
if(DebugConfig.isDebug()){
|
||||
if (DebugConfig.isDebug()) {
|
||||
ToastUtils.showLong(msg)
|
||||
}
|
||||
val loc = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
|
||||
|
||||
@@ -23,7 +23,8 @@ interface INDERoadCameraApiService {
|
||||
@Header("MogoReqTime") time: String,
|
||||
@Query("roadUniqueId") roadId: String,
|
||||
@Query("lon") lon: Double,
|
||||
@Query("lat") lat: Double
|
||||
@Query("lat") lat: Double,
|
||||
@Query("cityCode") cityCode: String
|
||||
): BaseResponse<List<RoadCrossCamera>>
|
||||
|
||||
// 单ip查询设备直播流与缩略图
|
||||
@@ -33,7 +34,8 @@ interface INDERoadCameraApiService {
|
||||
@Header("MogoReqTime") time: String,
|
||||
@Query("ip") ip: String,
|
||||
@Query("lon") lon: Double,
|
||||
@Query("lat") lat: Double
|
||||
@Query("lat") lat: Double,
|
||||
@Query("cityCode") cityCode: String
|
||||
): BaseResponse<RoadCameraLive>
|
||||
|
||||
// 批量ip查询设备直播流与缩略图
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.mogo.eagle.core.data.BaseResponse
|
||||
import com.mogo.eagle.core.data.road.RoadCameraLive
|
||||
import com.mogo.eagle.core.data.road.RoadCrossCamera
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||
import com.mogo.eagle.core.network.apiCall
|
||||
import com.mogo.eagle.core.network.cancel
|
||||
@@ -40,14 +41,15 @@ class NDERoadCameraNetWorkModel private constructor() {
|
||||
pair.second,
|
||||
crossID,
|
||||
loc.longitude,
|
||||
loc.latitude
|
||||
loc.latitude,
|
||||
CallerMapUIServiceManager.getCityCode() ?: ""
|
||||
)
|
||||
}
|
||||
}
|
||||
onSuccess {
|
||||
if(it.result.isNotEmpty()){
|
||||
if (it.result.isNotEmpty()) {
|
||||
onSuccess.invoke(it.result[0])
|
||||
}else{
|
||||
} else {
|
||||
onError.invoke("getRoadCrossInfo empty camera info")
|
||||
}
|
||||
}
|
||||
@@ -71,7 +73,8 @@ class NDERoadCameraNetWorkModel private constructor() {
|
||||
pair.second,
|
||||
ip,
|
||||
loc.longitude,
|
||||
loc.latitude
|
||||
loc.latitude,
|
||||
CallerMapUIServiceManager.getCityCode() ?: ""
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -92,10 +95,12 @@ class NDERoadCameraNetWorkModel private constructor() {
|
||||
loader {
|
||||
apiCall {
|
||||
val loc = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
|
||||
val cityCode = CallerMapUIServiceManager.getCityCode() ?: ""
|
||||
val map = mutableMapOf(
|
||||
"lon" to loc.longitude,
|
||||
"lat" to loc.latitude,
|
||||
"ipList" to list
|
||||
"ipList" to list,
|
||||
"cityCode" to cityCode
|
||||
)
|
||||
val pair = getAuth(BATCH_LIVE)
|
||||
getNetWorkApi().cameraLiveBatchRequest(pair.first, pair.second, map)
|
||||
|
||||
@@ -172,9 +172,9 @@ public class RouteOverlayDrawer {
|
||||
}
|
||||
double lon = CallerChassisLocationWGS84ListenerManager.INSTANCE.getChassisLocationWGS84().getLongitude();
|
||||
double lat = CallerChassisLocationWGS84ListenerManager.INSTANCE.getChassisLocationWGS84().getLatitude();
|
||||
if (points.size() > 0) {
|
||||
if (!points.isEmpty()) {
|
||||
MogoLatLng top = null;
|
||||
while (points.size() != 0) {
|
||||
while (!points.isEmpty()) {
|
||||
MogoLatLng first = points.peek();
|
||||
if (first == null) {
|
||||
continue;
|
||||
@@ -194,7 +194,7 @@ public class RouteOverlayDrawer {
|
||||
}
|
||||
top = first;
|
||||
}
|
||||
if (points.size() == 0) {
|
||||
if (points.isEmpty()) {
|
||||
isExcept = true;
|
||||
return;
|
||||
}
|
||||
@@ -251,7 +251,7 @@ public class RouteOverlayDrawer {
|
||||
if (isExcept) {
|
||||
setVisible(false);
|
||||
}
|
||||
if (points.size() > 0) {
|
||||
if (!points.isEmpty()) {
|
||||
for (int i = 0; i < points.size(); i++) {
|
||||
MogoLatLng latLng = points.get(i);
|
||||
if (latLng == null) {
|
||||
|
||||
@@ -4,9 +4,9 @@ import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.ViewGroup
|
||||
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
|
||||
import com.mogo.eagle.core.function.call.setting.CallerMoGoUiSettingManager
|
||||
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
|
||||
import com.mogo.eagle.core.function.map.R
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ class CameraMarkerView(context: Context, attrs: AttributeSet? = null, defStyleAt
|
||||
)
|
||||
)
|
||||
}
|
||||
modeChange(CallerMoGoUiSettingManager.getDayMode())
|
||||
modeChange(CallerSkinModeListenerManager.getMode())
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
@@ -36,7 +36,9 @@ class CameraMarkerView(context: Context, attrs: AttributeSet? = null, defStyleAt
|
||||
}
|
||||
|
||||
override fun onSkinModeChange(skinMode: Int) {
|
||||
modeChange(skinMode)
|
||||
ThreadUtils.runOnUiThread {
|
||||
modeChange(skinMode)
|
||||
}
|
||||
}
|
||||
|
||||
private fun modeChange(mode: Int) {
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84Lis
|
||||
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAP
|
||||
import com.mogo.map.MogoMap
|
||||
import com.mogo.map.MogoMapView
|
||||
import com.mogo.map.overlay.line.Polyline
|
||||
import com.mogo.map.overlay.point.Point
|
||||
@@ -59,10 +60,14 @@ class MapBizView(context: Context?, attrs: AttributeSet?) : MogoMapView(context,
|
||||
//设置倾斜手势是否可用。
|
||||
it.setTiltGesturesEnabled(false)
|
||||
//设置双指缩放手势是否可用。
|
||||
it.setZoomGesturesEnabled(false) //true todo emArrow test
|
||||
it.setZoomGesturesEnabled(false)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getInstanceTag(): String {
|
||||
return MogoMap.DEFAULT
|
||||
}
|
||||
|
||||
fun getUI(): IMogoMapUIController? {
|
||||
return map?.uiController
|
||||
}
|
||||
@@ -109,10 +114,7 @@ class MapBizView(context: Context?, attrs: AttributeSet?) : MogoMapView(context,
|
||||
}
|
||||
|
||||
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
|
||||
// 跟新地图控件 112.582776,26.931655
|
||||
// gnssInfo.longitude = 112.582776
|
||||
// gnssInfo.latitude = 26.931655 //todo emArrow test
|
||||
// gnssInfo.heading = 15.0
|
||||
// 跟新地图控件
|
||||
setExtraGPSData(gnssInfo)
|
||||
accLimit = gnssInfo.acceleration < accThreshold
|
||||
}
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
package com.mogo.eagle.core.function.view
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import androidx.lifecycle.LifecycleObserver
|
||||
import com.mogo.eagle.core.function.api.map.road.IMoGoMapRoadListener
|
||||
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager
|
||||
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
|
||||
import com.mogo.eagle.core.widget.media.video.TextureVideoViewOutlineProvider
|
||||
import com.mogo.map.MogoMap.Companion.MAP_ROAM
|
||||
import com.mogo.map.MogoMapView
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController
|
||||
import com.mogo.map.uicontroller.VisualAngleMode
|
||||
|
||||
|
||||
class MapRoamView(context: Context?, attrs: AttributeSet?) : MogoMapView(context, attrs),
|
||||
IMoGoSkinModeChangeListener,
|
||||
LifecycleObserver, IMoGoMapRoadListener {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "MapRoamView"
|
||||
}
|
||||
|
||||
override fun onCreate(bundle: Bundle?) {
|
||||
super.onCreate(bundle)
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
initMapView()
|
||||
CallerSkinModeListenerManager.addListener(TAG, this)
|
||||
CallerMapRoadListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
private fun initMapView() {
|
||||
map?.uiController?.showMyLocation(false)
|
||||
map?.uiSettings?.let {
|
||||
it.setAllGesturesEnabled(false)
|
||||
//设置指南针是否可见。
|
||||
it.setCompassEnabled(false)
|
||||
//设置室内地图楼层切换控件是否可见。
|
||||
it.setIndoorSwitchEnabled(false)
|
||||
//设置定位按钮是否可见。
|
||||
it.setMyLocationButtonEnabled(false)
|
||||
//设置比例尺控件是否可见
|
||||
it.setScaleControlsEnabled(false)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getInstanceTag(): String {
|
||||
return MAP_ROAM
|
||||
}
|
||||
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
super.onSaveInstanceState(outState)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
}
|
||||
|
||||
private fun getUI(): IMogoMapUIController? {
|
||||
return map?.uiController
|
||||
}
|
||||
|
||||
override fun onSkinModeChange(skinMode: Int) {
|
||||
if (skinMode == 0) {
|
||||
getUI()?.stepInDayMode(false)
|
||||
} else if (skinMode == 1) {
|
||||
getUI()?.stepInDayMode(true)
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("ObsoleteSdkInt")
|
||||
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
|
||||
super.onSizeChanged(w, h, oldw, oldh)
|
||||
this.outlineProvider = TextureVideoViewOutlineProvider(12f)
|
||||
this.clipToOutline = true
|
||||
}
|
||||
|
||||
fun openRoam() {
|
||||
this.onResume()
|
||||
// 更新地图视角 - 高视角
|
||||
getUI()?.changeMapVisualAngle(VisualAngleMode.MAP_STYLE_VR_ANGLE_TOP, null)
|
||||
// 更新路口位置
|
||||
val latLng = CallerMapRoadListenerManager.getStopLineLatLng()
|
||||
Log.i("emArrow","$TAG 开始漫游 latLng:${latLng.toString()}")
|
||||
latLng?.let {
|
||||
val loc = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
|
||||
loc.latitude = latLng.first
|
||||
loc.longitude = latLng.second
|
||||
setExtraGPSData(loc)
|
||||
}
|
||||
// 开始漫游
|
||||
|
||||
}
|
||||
|
||||
fun closeRoam(){
|
||||
this.onPause()
|
||||
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
// 先取消注册数据,再onDestroy
|
||||
CallerSkinModeListenerManager.removeListener(TAG)
|
||||
CallerMapRoadListenerManager.removeListener(TAG)
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.mogo.eagle.core.function.view
|
||||
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import android.widget.ProgressBar
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.eagle.core.function.map.R
|
||||
import kotlin.random.Random
|
||||
|
||||
|
||||
class RoadCrossRoamListAdapter(private val mContext: Context) : RecyclerView.Adapter<RoadCrossRoamListAdapter.ViewHolder>() {
|
||||
|
||||
private val items: MutableList<String> = mutableListOf()
|
||||
|
||||
init {
|
||||
items.add("前方路况拥堵分析")
|
||||
items.add("路口危险车辆分析")
|
||||
items.add("路口交通事故分析")
|
||||
items.add("路口行人碰撞分析")
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
val view: View = LayoutInflater.from(mContext).inflate(R.layout.item_road_cross_roam_tip, parent, false)
|
||||
return ViewHolder(view)
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return items.size
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
val item = items[position]
|
||||
holder.textView.text = item
|
||||
// 随机决定是否显示ProgressBar
|
||||
// if (Random.nextBoolean()) { // 50%的几率显示ProgressBar
|
||||
holder.progressBar.visibility = View.VISIBLE
|
||||
holder.checkIcon.visibility = View.GONE
|
||||
|
||||
val r = Random.nextInt(1,6)
|
||||
// 模拟加载完成
|
||||
holder.itemView.postDelayed({
|
||||
holder.progressBar.visibility = View.GONE
|
||||
holder.checkIcon.visibility = View.VISIBLE
|
||||
},r * 1000L)
|
||||
// } else {
|
||||
// holder.progressBar.visibility = View.GONE
|
||||
// holder.checkIcon.visibility = View.VISIBLE
|
||||
// }
|
||||
}
|
||||
|
||||
class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
var textView: TextView = itemView.findViewById(R.id.tvRoadItemTip)
|
||||
var progressBar: ProgressBar = itemView.findViewById(R.id.pbRoadItemTip)
|
||||
var checkIcon: ImageView = itemView.findViewById(R.id.ivRoadItemTip)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
package com.mogo.eagle.core.function.view
|
||||
|
||||
import android.animation.ObjectAnimator
|
||||
import android.animation.ValueAnimator
|
||||
import android.content.Context
|
||||
import android.graphics.Rect
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.eagle.core.function.api.map.road.IMoGoMapRoadListener
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager
|
||||
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
|
||||
import com.mogo.eagle.core.function.map.R
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.zhidaoauto.map.data.road.StopLine
|
||||
import kotlinx.android.synthetic.main.view_road_cross_roam.view.ivCoverRoam
|
||||
import kotlinx.android.synthetic.main.view_road_cross_roam.view.ivRoadRoamClose
|
||||
import kotlinx.android.synthetic.main.view_road_cross_roam.view.lvRoadCrossRoamTip
|
||||
import kotlinx.android.synthetic.main.view_road_cross_roam.view.mapRoamView
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
class RoadCrossRoamView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoMapRoadListener {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "RoadCrossRoamView"
|
||||
}
|
||||
|
||||
private var showState by Delegates.observable(false) { _, oldV, newV ->
|
||||
if (oldV != newV) {
|
||||
updateView(newV)
|
||||
}
|
||||
}
|
||||
|
||||
private var animator: ObjectAnimator? = null
|
||||
|
||||
init {
|
||||
val res = when (CallerSkinModeListenerManager.getMode()) {
|
||||
0 -> R.layout.view_road_cross_roam
|
||||
1 -> R.layout.view_road_cross_roam_light
|
||||
else -> R.layout.view_road_cross_roam
|
||||
}
|
||||
LayoutInflater.from(context).inflate(res, this, true)
|
||||
lvRoadCrossRoamTip.layoutManager = LinearLayoutManager(context)
|
||||
lvRoadCrossRoamTip.addItemDecoration(object : RecyclerView.ItemDecoration() {
|
||||
override fun getItemOffsets(
|
||||
outRect: Rect,
|
||||
view: View,
|
||||
parent: RecyclerView,
|
||||
state: RecyclerView.State
|
||||
) {
|
||||
super.getItemOffsets(outRect, view, parent, state)
|
||||
outRect.bottom = 24
|
||||
}
|
||||
})
|
||||
ivRoadRoamClose.setOnClickListener {
|
||||
detachView()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
CallerMapRoadListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
private fun updateView(state: Boolean) {
|
||||
// 切换线程
|
||||
ThreadUtils.runOnUiThread {
|
||||
if (state) {
|
||||
attachView()
|
||||
} else {
|
||||
detachView()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStopLineInfo(info: StopLine) {
|
||||
super.onStopLineInfo(info)
|
||||
showState = info.distance < 200 && info.distance > 100
|
||||
Log.i("emArrow","showState $showState , distance:${info.distance}")
|
||||
}
|
||||
|
||||
private fun attachView() {
|
||||
this.visibility = View.VISIBLE
|
||||
mapRoamView.openRoam()
|
||||
lvRoadCrossRoamTip.adapter = RoadCrossRoamListAdapter(context)
|
||||
// 创建横向移动的动画
|
||||
if (animator == null) {
|
||||
animator =
|
||||
ObjectAnimator.ofFloat(
|
||||
ivCoverRoam,
|
||||
"translationX",
|
||||
-120f,
|
||||
540f
|
||||
)
|
||||
}
|
||||
animator?.duration = 1500 // 设置动画持续时间,单位为毫秒
|
||||
animator?.repeatCount = ValueAnimator.INFINITE // 设置动画无限重复
|
||||
animator?.repeatMode = ValueAnimator.RESTART // 设置动画来回移动
|
||||
animator?.start()
|
||||
}
|
||||
|
||||
private fun detachView() {
|
||||
mapRoamView.closeRoam()
|
||||
lvRoadCrossRoamTip.adapter = null
|
||||
animator?.cancel()
|
||||
this.visibility = View.GONE
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
animator?.cancel()
|
||||
CallerMapRoadListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
After Width: | Height: | Size: 377 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 77 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 996 B |
|
After Width: | Height: | Size: 1.4 KiB |
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_30">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvRoadItemTip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:textSize="@dimen/dp_22"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/pbRoadItemTip"
|
||||
android:layout_width="@dimen/dp_30"
|
||||
android:layout_height="@dimen/dp_30"
|
||||
android:progressDrawable="@drawable/icon_road_roam_progress"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivRoadItemTip"
|
||||
android:layout_width="@dimen/dp_30"
|
||||
android:layout_height="@dimen/dp_30"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/icon_road_roam_tip"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="ContentDescription" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,79 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/bg_road_cross_roam">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivRoadRoamClose"
|
||||
android:layout_width="@dimen/dp_50"
|
||||
android:layout_height="@dimen/dp_50"
|
||||
android:src="@drawable/icon_road_roam_close"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivZhiRoadRoamView"
|
||||
android:layout_width="@dimen/dp_120"
|
||||
android:layout_height="@dimen/dp_120"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:layout_marginTop="@dimen/dp_16"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/bg_road_roam_xiaozhi"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_20"
|
||||
android:layout_marginTop="@dimen/dp_24"
|
||||
android:text="@string/road_cross_roam_tip"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/dp_30"
|
||||
app:layout_constraintLeft_toRightOf="@id/ivZhiRoadRoamView"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.mogo.eagle.core.function.view.MapRoamView
|
||||
android:id="@+id/mapRoamView"
|
||||
android:layout_width="@dimen/dp_540"
|
||||
android:layout_height="@dimen/dp_300"
|
||||
android:layout_marginTop="@dimen/dp_160"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="@dimen/dp_540"
|
||||
android:layout_height="@dimen/dp_300"
|
||||
android:layout_marginTop="@dimen/dp_160"
|
||||
android:layout_marginStart="@dimen/dp_32"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivCoverRoam"
|
||||
android:layout_width="@dimen/dp_120"
|
||||
android:layout_height="@dimen/dp_300"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:src="@drawable/icon_cover_road_roam"
|
||||
tools:ignore="ContentDescription" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/lvRoadCrossRoamTip"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_200"
|
||||
android:layout_marginTop="@dimen/dp_30"
|
||||
android:layout_marginLeft="@dimen/dp_30"
|
||||
android:layout_marginRight="@dimen/dp_30"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/mapRoamView" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,3 +1,4 @@
|
||||
<resources>
|
||||
<string name="app_name">mogo-core-function-map</string>
|
||||
<string name="road_cross_roam_tip">前方即将进入全息路口\n为您全面扫描潜在风险</string>
|
||||
</resources>
|
||||
|
||||
@@ -17,5 +17,6 @@ interface IMoGoMapRoadListener {
|
||||
|
||||
fun onCrossLiveInfo(info: RoadCameraLive) {}
|
||||
|
||||
fun onRoadCrossClick() {}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mogo.eagle.core.function.call.map
|
||||
|
||||
import android.util.Log
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant
|
||||
import com.mogo.eagle.core.data.road.RoadCameraLive
|
||||
import com.mogo.eagle.core.function.api.map.road.IMoGoMapRoadListener
|
||||
@@ -38,7 +39,7 @@ object CallerMapRoadListenerManager : CallerBase<IMoGoMapRoadListener>() {
|
||||
mStopLine?.let {
|
||||
listener.onStopLineInfo(it)
|
||||
}
|
||||
if(mCross != -1 && mRoadCross != null){
|
||||
if (mCross != -1 && mRoadCross != null) {
|
||||
listener.onRoadChange(mRoadChange, mRoadCross)
|
||||
}
|
||||
}
|
||||
@@ -57,8 +58,16 @@ object CallerMapRoadListenerManager : CallerBase<IMoGoMapRoadListener>() {
|
||||
}
|
||||
}
|
||||
|
||||
fun getCrossInfo(): RoadCross? {
|
||||
return mRoadCross
|
||||
fun getCrossEndInfo(): String? {
|
||||
return mRoadCross?.cross_id_end
|
||||
}
|
||||
|
||||
fun getStopLineLatLng(): Pair<Double, Double>? {
|
||||
return if (mStopLine == null) {
|
||||
null
|
||||
} else {
|
||||
Pair(mStopLine!!.points[0].latitude, mStopLine!!.points[0].longitude)
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
@@ -77,13 +86,19 @@ object CallerMapRoadListenerManager : CallerBase<IMoGoMapRoadListener>() {
|
||||
|
||||
}
|
||||
|
||||
fun invokeRoadCrossClick() {
|
||||
M_LISTENERS.forEach { entry ->
|
||||
entry.value.onRoadCrossClick()
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkChainLog = ChainConstant.CHAIN_TYPE_STATUS,
|
||||
linkCode = ChainConstant.CHAIN_SOURCE_MAP,
|
||||
nodeAliasCode = ChainConstant.CHAIN_CODE_HD_MAP_ROAD_LIVE,
|
||||
paramIndexes = [0]
|
||||
)
|
||||
fun invokeRoadCrossLive(info: RoadCameraLive){
|
||||
fun invokeRoadCrossLive(info: RoadCameraLive) {
|
||||
M_LISTENERS.forEach { entry ->
|
||||
entry.value.onCrossLiveInfo(info)
|
||||
}
|
||||
|
||||
@@ -25,4 +25,8 @@ object CallerSkinModeListenerManager : CallerBase<IMoGoSkinModeChangeListener>()
|
||||
}
|
||||
}
|
||||
|
||||
fun getMode():Int{
|
||||
return CallerMoGoUiSettingManager.getDayMode()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -42,6 +42,11 @@ class SimpleVideoPlayer : StandardGSYVideoPlayer {
|
||||
*/
|
||||
var enableshowProgressDialog = true
|
||||
|
||||
/**
|
||||
* 圆角尺寸
|
||||
*/
|
||||
var outLinePixel = 0f
|
||||
|
||||
interface PlayListener {
|
||||
fun onPlayEvent(event: Int)
|
||||
}
|
||||
@@ -152,10 +157,10 @@ class SimpleVideoPlayer : StandardGSYVideoPlayer {
|
||||
}
|
||||
|
||||
@Suppress("SENSELESS_COMPARISON")
|
||||
private var runnable = object :Runnable {
|
||||
private var runnable = object : Runnable {
|
||||
override fun run() {
|
||||
// 外层对象倍回收 延时继续运行 慎重删除
|
||||
if(this@SimpleVideoPlayer==null){
|
||||
if (this@SimpleVideoPlayer == null) {
|
||||
return
|
||||
}
|
||||
updateTimer++
|
||||
@@ -216,22 +221,42 @@ class SimpleVideoPlayer : StandardGSYVideoPlayer {
|
||||
}
|
||||
|
||||
override fun touchDoubleUp() {
|
||||
if(enableDoubleClick) {
|
||||
if (enableDoubleClick) {
|
||||
super.touchDoubleUp()
|
||||
}
|
||||
}
|
||||
|
||||
override fun showProgressDialog(deltaX: Float, seekTime: String?, seekTimePosition: Int, totalTime: String?, totalTimeDuration: Int) {
|
||||
if(enableshowProgressDialog) {
|
||||
super.showProgressDialog(deltaX, seekTime, seekTimePosition, totalTime, totalTimeDuration)
|
||||
override fun showProgressDialog(
|
||||
deltaX: Float,
|
||||
seekTime: String?,
|
||||
seekTimePosition: Int,
|
||||
totalTime: String?,
|
||||
totalTimeDuration: Int
|
||||
) {
|
||||
if (enableshowProgressDialog) {
|
||||
super.showProgressDialog(
|
||||
deltaX,
|
||||
seekTime,
|
||||
seekTimePosition,
|
||||
totalTime,
|
||||
totalTimeDuration
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun dismissProgressDialog() {
|
||||
if(enableshowProgressDialog) {
|
||||
if (enableshowProgressDialog) {
|
||||
super.dismissProgressDialog()
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("ObsoleteSdkInt")
|
||||
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
|
||||
super.onSizeChanged(w, h, oldw, oldh)
|
||||
if (!mIfCurrentIsFullscreen && outLinePixel > 0) {
|
||||
this.outlineProvider = TextureVideoViewOutlineProvider(outLinePixel)
|
||||
this.clipToOutline = true
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -45,6 +45,7 @@ class MyLocationStyle(
|
||||
private var is3D: Boolean = false
|
||||
private var carId: Int = 0
|
||||
private var isDisplayAnim: Boolean = true
|
||||
private var showSelfMarker:Boolean = true // 前置调用/或后置更新draw
|
||||
private var mMarker: Marker? = null
|
||||
|
||||
private var lastExecuteTime = -1L
|
||||
@@ -236,6 +237,9 @@ class MyLocationStyle(
|
||||
options.animMarkerRes(guangquanResId, mMapController)
|
||||
}
|
||||
mMarker = mMarkerController?.addSelfCar(options)
|
||||
if(!showSelfMarker){
|
||||
mMarker?.setVisible(false)
|
||||
}
|
||||
carId = resId
|
||||
if (CompileConfig.DEBUG) {
|
||||
Log.i(
|
||||
@@ -335,10 +339,12 @@ class MyLocationStyle(
|
||||
|
||||
|
||||
fun hideCar() {
|
||||
showSelfMarker = false
|
||||
mMarker?.setVisible(false)
|
||||
}
|
||||
|
||||
fun showCar() {
|
||||
showSelfMarker = true
|
||||
mMarker?.setVisible(true)
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ object BitmapDescriptorFactory {
|
||||
View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)
|
||||
)
|
||||
view.layout(0, 0, view.measuredWidth, view.measuredHeight)
|
||||
val bitmap = Bitmap.createBitmap(view.width, view.height, Bitmap.Config.ARGB_8888);
|
||||
val bitmap = Bitmap.createBitmap(view.width, view.height, Bitmap.Config.ARGB_8888)
|
||||
val canvas = Canvas(bitmap)
|
||||
// canvas.drawColor(Color.WHITE);
|
||||
view.draw(canvas);
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.mogo.map
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.map.entities.Lane
|
||||
import com.mogo.map.entities.RoadInfo
|
||||
import com.zhidaoauto.map.data.road.CenterLine
|
||||
|
||||
interface IMogoData {
|
||||
@@ -90,4 +92,13 @@ interface IMogoData {
|
||||
*/
|
||||
fun cancelDownloadCacheData()
|
||||
|
||||
/**
|
||||
* 根据坐标和朝向获取位置所在的道路信息
|
||||
*/
|
||||
fun getRoadInfo(lon: Double, lat: Double, angle: Float): RoadInfo
|
||||
|
||||
/**
|
||||
* 根据瓦片Id和道路Id获取车道数据
|
||||
*/
|
||||
fun getLaneInfo(tileId: Long, roadId: Int): List<Lane>
|
||||
}
|
||||
@@ -10,6 +10,7 @@ class MogoMap private constructor() {
|
||||
private const val TAG = "MogoMap"
|
||||
|
||||
const val DEFAULT = "Default"
|
||||
const val MAP_ROAM = "MapRoam" //漫游地图实例
|
||||
|
||||
@JvmStatic
|
||||
val mapInstance by lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
package com.mogo.map.entities
|
||||
|
||||
data class Lane(val id: Int, val width: Float, val points: List<Pair<Double, Double>>)
|
||||
@@ -0,0 +1,3 @@
|
||||
package com.mogo.map.entities
|
||||
|
||||
data class RoadInfo(val code: Int, val tileId: Long, val roadId: Int, val roadName: String)
|
||||
@@ -36,7 +36,6 @@ import com.mogo.map.listener.MogoMapListenerHandler.Companion.mogoMapListenerHan
|
||||
import com.mogo.map.uicontroller.*
|
||||
import com.mogo.map.uicontroller.VisualAngleMode.MODE_MEDIUM_SIGHT
|
||||
import com.mogo.map.utils.MapTraceUtil
|
||||
import com.mogo.map.utils.MogoMapUtils
|
||||
import com.mogo.map.utils.MogoMapUtils.getLatLngBounds
|
||||
import com.mogo.map.utils.ObjectUtils
|
||||
import com.zhidaoauto.map.data.point.LonLatPoint
|
||||
@@ -387,18 +386,22 @@ class AMapViewWrapper(mMapView: MapAutoView) : IMogoMapView, IMogoMapUIControlle
|
||||
override fun showMyLocation(visible: Boolean) {
|
||||
d(M_MAP + TAG, "showMyLocation1 $visible")
|
||||
// 如果是VR模式
|
||||
if (isVrMold) {
|
||||
return
|
||||
}
|
||||
// if (isVrMold) {
|
||||
// return
|
||||
// }
|
||||
// 不是VR模式情况强制刷新下
|
||||
if (checkAMapView()) {
|
||||
val style = mMapView.getMapAutoViewHelper()!!
|
||||
.getMyLocationStyle()
|
||||
if (visible) {
|
||||
// 强制刷新一遍车标
|
||||
style!!.myLocationIcon(mCarCursorOption!!.carCursorRes)
|
||||
style?.let {
|
||||
if (visible) {
|
||||
// 强制刷新一遍车标
|
||||
it.myLocationIcon(mCarCursorOption!!.carCursorRes)
|
||||
}else{
|
||||
it.hideCar()
|
||||
}
|
||||
mMapView.getMapAutoViewHelper()!!.setMyLocationStyle(style)
|
||||
}
|
||||
mMapView.getMapAutoViewHelper()!!.setMyLocationStyle(style!!)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ class AMapWrapper(map: MapAutoViewHelper?, mapView: MapAutoView, controller: IMo
|
||||
return AMapPolylineWrapper(options.id, delegate, mMapView)
|
||||
}
|
||||
|
||||
var batchMarkerOptions = BatchMarkerOptions()
|
||||
private val batchMarkerOptions = BatchMarkerOptions()
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
override fun updateBatchMarkerPosition(optionsArrayList: HashMap<String, TrackedObject>?) {
|
||||
|
||||
@@ -2,11 +2,14 @@ package com.mogo.map
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.i
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAP
|
||||
import com.mogo.map.MogoData.Companion.mogoMapData
|
||||
import com.mogo.map.entities.Lane
|
||||
import com.mogo.map.location.GDLocationClient.Companion.gdLocationClient
|
||||
import com.mogo.map.utils.HDMapUtils.getHDCityCode
|
||||
import com.zhidaoauto.map.data.road.CenterLine
|
||||
import com.zhidaoauto.map.data.road.RoadNameInfo
|
||||
import com.zhidaoauto.map.data.road.RoadRectInfos
|
||||
import com.zhidaoauto.map.data.routeinfo.RoadInfo
|
||||
import com.zhidaoauto.map.sdk.open.MapAutoApi
|
||||
@@ -14,6 +17,7 @@ import com.zhidaoauto.map.sdk.open.abs.IResult
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnHdDataDownByCityListener
|
||||
import com.zhidaoauto.map.sdk.open.data.CityInfo
|
||||
import com.zhidaoauto.map.sdk.open.data.MapDataApi
|
||||
import java.util.concurrent.CountDownLatch
|
||||
|
||||
/**
|
||||
* 地图数据工具,涉及到数据调用可能会有耗时,建议IO操作
|
||||
@@ -243,5 +247,31 @@ object MapDataWrapper : IMogoData {
|
||||
MapDataApi.cancelCacheHDData()
|
||||
}
|
||||
|
||||
override fun getRoadInfo(
|
||||
lon: Double,
|
||||
lat: Double,
|
||||
angle: Float
|
||||
): com.mogo.map.entities.RoadInfo {
|
||||
val latch = CountDownLatch(1)
|
||||
var tempCode: Int = Int.MIN_VALUE
|
||||
var tempData: RoadNameInfo? = null
|
||||
Logger.d(TAG, "getRoadInfo --- 1 ---")
|
||||
MapDataApi.getRoadName(lon, lat, angle, object : IResult<RoadNameInfo> {
|
||||
override fun result(code: Int, result: RoadNameInfo?) {
|
||||
Logger.d(TAG, "getRoadInfo ==> code: $code, result: $result")
|
||||
tempCode = code
|
||||
tempData = result
|
||||
latch.countDown()
|
||||
}
|
||||
})
|
||||
latch.await()
|
||||
Logger.d(TAG, "getRoadInfo --- 2 ---: code -> $tempCode, data -> $tempData")
|
||||
return com.mogo.map.entities.RoadInfo(tempCode, tempData?.tile_id?.toLong()?:0L, tempData?.road_id?.toInt() ?: 0, tempData?.road_name ?: "")
|
||||
}
|
||||
|
||||
override fun getLaneInfo(tileId: Long, roadId: Int): List<Lane> {
|
||||
return MapDataApi.getLaneInfo(tileId, roadId)?.map { itx ->
|
||||
Lane(itx.laneId, itx.laneWidth, itx.laneLatLonPoints.map { Pair(it.longitude, it.latitude) })
|
||||
} ?: emptyList()
|
||||
}
|
||||
}
|
||||
@@ -52,6 +52,10 @@ open class MogoMapView : MogoBaseMapView, ILifeCycle {
|
||||
}
|
||||
}
|
||||
|
||||
override fun getInstanceTag(): String {
|
||||
return ""
|
||||
}
|
||||
|
||||
/**
|
||||
* 子类实现
|
||||
* 代码StyleParams和XML初始化设置同时仅支持一种
|
||||
@@ -61,10 +65,6 @@ open class MogoMapView : MogoBaseMapView, ILifeCycle {
|
||||
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")
|
||||
|
||||