diff --git a/OCH/bus/driver/src/main/res/layout/bus_base_fragment.xml b/OCH/bus/driver/src/main/res/layout/bus_base_fragment.xml index a32dea82da..0bab6f9d11 100644 --- a/OCH/bus/driver/src/main/res/layout/bus_base_fragment.xml +++ b/OCH/bus/driver/src/main/res/layout/bus_base_fragment.xml @@ -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" /> + app:layout_constraintEnd_toEndOf="@+id/viewLimitingVelocity" + app:layout_constraintTop_toBottomOf="@+id/viewLimitingVelocity" + app:layout_goneMarginEnd="40dp" + app:layout_goneMarginTop="@dimen/dp_236" /> + + + + + + @@ -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" /> + app:layout_constraintLeft_toRightOf="@id/module_mogo_och_arrived_tv" /> + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintLeft_toRightOf="@id/toolsView" /> + app:layout_constraintLeft_toRightOf="@id/switch_visual_view" /> @@ -305,7 +324,7 @@ + android:layout_height="match_parent" /> + app:layout_constraintStart_toStartOf="parent" /> \ No newline at end of file diff --git a/OCH/taxi/driver/src/main/java/com/mogo/och/taxi/ui/BaseTaxiTabFragment.java b/OCH/taxi/driver/src/main/java/com/mogo/och/taxi/ui/BaseTaxiTabFragment.java index 54049cdb98..f4ce741997 100644 --- a/OCH/taxi/driver/src/main/java/com/mogo/och/taxi/ui/BaseTaxiTabFragment.java +++ b/OCH/taxi/driver/src/main/java/com/mogo/och/taxi/ui/BaseTaxiTabFragment.java @@ -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 + app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintTop_toBottomOf="@+id/taxi_speed_contain"> + app:layout_constraintEnd_toEndOf="@+id/viewLimitingVelocity" + app:layout_constraintTop_toBottomOf="@+id/viewLimitingVelocity" + app:layout_goneMarginEnd="40dp" + app:layout_goneMarginTop="@dimen/dp_236" /> + + + + + + + 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" /> + app:layout_constraintLeft_toRightOf="@id/module_mogo_och_operation_status" /> + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintLeft_toRightOf="@id/toolsView" /> + app:layout_constraintLeft_toRightOf="@id/switch_visual_view" /> @@ -349,7 +368,7 @@ + android:layout_height="match_parent" /> + app:layout_constraintStart_toStartOf="parent" /> \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 0cdd1b7736..f238912b93 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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") } diff --git a/app/src/androidTest/assets/polygon.txt b/app/src/androidTest/assets/polygon.txt new file mode 100644 index 0000000000..a935bc5e02 --- /dev/null +++ b/app/src/androidTest/assets/polygon.txt @@ -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 \ No newline at end of file diff --git a/app/src/androidTest/java/com/mogo/functions/test/RoadAITest.kt b/app/src/androidTest/java/com/mogo/functions/test/RoadAITest.kt index 9c8abe8e7d..28484dd9e8 100644 --- a/app/src/androidTest/java/com/mogo/functions/test/RoadAITest.kt +++ b/app/src/androidTest/java/com/mogo/functions/test/RoadAITest.kt @@ -1,180 +1,180 @@ -//package com.mogo.functions.test -// -//import android.os.* -//import androidx.test.core.app.* -//import androidx.test.ext.junit.runners.* -//import androidx.test.filters.* -//import com.mogo.eagle.core.data.v2x.V2XEvent -//import com.mogo.eagle.core.function.hmi.ui.* -//import com.mogo.eagle.core.function.main.* -//import com.mogo.eagle.core.data.v2x.V2XRoadXData -//import com.mogo.eagle.core.utilcode.util.GsonUtils -//import com.mogo.eagle.function.biz.v2x.v2n.V2XEventManager -//import kotlinx.coroutines.* -//import org.junit.* -//import org.junit.runner.* -//import roadwork.Road.* -//import java.util.concurrent.* -//import java.util.concurrent.TimeUnit.MILLISECONDS -//import java.util.concurrent.TimeUnit.SECONDS -//import kotlin.Result -// -//@RunWith(AndroidJUnit4::class) -//@LargeTest -//class RoadAITest { -// -// lateinit var launch: ActivityScenario -// -// @Before -// fun before() { -// launch = ActivityScenario.launch(MainLauncherActivity::class.java) -// } -// -// @Test -// fun test() = runBlocking(Dispatchers.Default) { -// // ensureMoGoHmiFragmentShow() -// val nanos = System.nanoTime() -// val child = -// RW_PB -// .newBuilder() -// .setHeader( -// Header -// .newBuilder() -// .setFrameId("rw") -// .setModuleName("ai_cloud") -// .setStamp(Time.newBuilder() -// .setSec(TimeUnit.NANOSECONDS.convert(nanos, SECONDS).toInt()) -// .setNsec(180000000) -// .build()) -// .build()) -// .setRoadwork( -// Roadwork_PB -// .newBuilder() -// .setId("4e47e17d-4950-4c80-9b02-29a450e54b50") -// .setScore(95) -// .setDetectTime(nanos) -// .setPoiType(100061) -// .setType(1006) -// .setCenter( -// Center_PB -// .newBuilder() -// .setRoad(Road_PB -// .newBuilder() -// .setRoadId("200091") -// .setLaneNo("-2") -// .setTileId("556834853") -// .setBearing(90) -// .build()) -// .setPoint(GPSPoint_PB -// .newBuilder() -// .setLat(40.20313763799314) -// .setLon(116.72844402744953) -// .build()) -// .build()) -// .addPolygon(0, GPSPoint_PB +package com.mogo.functions.test + +import android.os.* +import androidx.test.core.app.* +import androidx.test.ext.junit.runners.* +import androidx.test.filters.* +import com.mogo.eagle.core.data.v2x.V2XEvent +import com.mogo.eagle.core.function.hmi.ui.* +import com.mogo.eagle.core.function.main.* +import com.mogo.eagle.core.data.v2x.V2XRoadXData +import com.mogo.eagle.core.utilcode.util.GsonUtils +import com.mogo.eagle.function.biz.v2x.v2n.V2XEventManager +import kotlinx.coroutines.* +import org.junit.* +import org.junit.runner.* +import roadwork.Road.* +import java.util.concurrent.* +import java.util.concurrent.TimeUnit.MILLISECONDS +import java.util.concurrent.TimeUnit.SECONDS +import kotlin.Result + +@RunWith(AndroidJUnit4::class) +@LargeTest +class RoadAITest { + + lateinit var launch: ActivityScenario + + @Before + fun before() { + launch = ActivityScenario.launch(MainLauncherActivity::class.java) + } + + @Test + fun test() = runBlocking(Dispatchers.Default) { + // ensureMoGoHmiFragmentShow() + val nanos = System.nanoTime() + val child = + RW_PB + .newBuilder() + .setHeader( + Header + .newBuilder() + .setFrameId("rw") + .setModuleName("ai_cloud") + .setStamp(Time.newBuilder() + .setSec(TimeUnit.NANOSECONDS.convert(nanos, SECONDS).toInt()) + .setNsec(180000000) + .build()) + .build()) + .setRoadwork( + Roadwork_PB + .newBuilder() + .setId("4e47e17d-4950-4c80-9b02-29a450e54b50") + .setScore(95) + .setDetectTime(nanos) + .setPoiType(100061) + .setType(1006) + .setCenter( + Center_PB + .newBuilder() + .setRoad(Road_PB + .newBuilder() + .setRoadId("200091") + .setLaneNo("-2") + .setTileId("556834853") + .setBearing(90) + .build()) + .setPoint(GPSPoint_PB + .newBuilder() + .setLat(40.20313763799314) + .setLon(116.72844402744953) + .build()) + .build()) + .addPolygon(0, GPSPoint_PB + .newBuilder() + .setLat(40.20314863899314) + .setLon(116.72844412744953) + .build()) + .addPolygon(1, GPSPoint_PB + .newBuilder() + .setLat(40.20314563819314) + .setLon(116.72844412744953) + .build()) + .addPolygon(2, GPSPoint_PB + .newBuilder() + .setLat(40.20312263869314) + .setLon(116.72844401744953) + .build()) + .addPolygon(3, GPSPoint_PB + .newBuilder() + .setLat(40.20322763889314) + .setLon(116.7284381644953) + .build()) +// .addPolygon(4, GPSPoint_PB // .newBuilder() -// .setLat(40.20314863899314) -// .setLon(116.72844412744953) +// .setLat(26.819521911807858) +// .setLon(112.57508983920647) // .build()) -// .addPolygon(1, GPSPoint_PB +// .addPolygon(5, GPSPoint_PB // .newBuilder() -// .setLat(40.20314563819314) -// .setLon(116.72844412744953) +// .setLat(26.819535210732194) +// .setLon(112.57509174248064) // .build()) -// .addPolygon(2, GPSPoint_PB +// .addPolygon(6, GPSPoint_PB // .newBuilder() -// .setLat(40.20312263869314) -// .setLon(116.72844401744953) +// .setLat(26.81954428950259) +// .setLon(112.5750796303722) // .build()) -// .addPolygon(3, GPSPoint_PB +// .addPolygon(7, GPSPoint_PB // .newBuilder() -// .setLat(40.20322763889314) -// .setLon(116.7284381644953) +// .setLat(26.819549148117684) +// .setLon(112.57505350287552) // .build()) -//// .addPolygon(4, GPSPoint_PB -//// .newBuilder() -//// .setLat(26.819521911807858) -//// .setLon(112.57508983920647) -//// .build()) -//// .addPolygon(5, GPSPoint_PB -//// .newBuilder() -//// .setLat(26.819535210732194) -//// .setLon(112.57509174248064) -//// .build()) -//// .addPolygon(6, GPSPoint_PB -//// .newBuilder() -//// .setLat(26.81954428950259) -//// .setLon(112.5750796303722) -//// .build()) -//// .addPolygon(7, GPSPoint_PB -//// .newBuilder() -//// .setLat(26.819549148117684) -//// .setLon(112.57505350287552) -//// .build()) -// .addRoad(0, Road_PB -// .newBuilder() -// .setRoadId("200090") -// .setLaneNo("-2") -// .setTileId("556834853") -// .setBearing(154) -// .build()) -// .addRoad(1, Road_PB -// .newBuilder() -// .setRoadId("200091") -// .setLaneNo("-2") -// .setTileId("556834853") -// .setBearing(156) -// .build()) -// .build()) -// .build() -// val event = V2XEvent.RoadAI(data = child) -// while (true) { -// delay(1000) -// V2XEventManager.onAck(event) -// } -// -// } -// -//// private suspend fun ensureMoGoHmiFragmentShow(): MoGoHmiProvider = suspendCancellableCoroutine { -//// launch.onActivity { itx -> -//// val executor = Executors.newSingleThreadScheduledExecutor() -//// executor.scheduleAtFixedRate({ -//// var find = -//// itx.supportFragmentManager.fragments.find { it is MoGoHmiProvider } as? MoGoHmiProvider -//// while (find == null) { -//// find = -//// itx.supportFragmentManager.fragments.find { it is MoGoHmiProvider } as? MoGoHmiProvider -//// } -//// while (!find.isResumed) { -//// Thread.sleep(500) -//// } -//// it.resumeWith(Result.success(find)) -//// try { -//// Thread.sleep(500) -//// executor.shutdownNow() -//// } catch (e: Throwable) { -//// e.printStackTrace() -//// } -//// }, 50, 500, MILLISECONDS) -//// } -//// } -// -// -// @Test -// fun testRoadAI() = runBlocking { -// //ensureMoGoHmiFragmentShow() -// val shigu = "{\"poiType\":\"100321\",\"receiveTime\":1673506266967,\"detectTime\":1673506266924,\"id\":\"f7b1df85-895a-41c1-b05d-7356955c1c91\",\"index\":\"636136931493454271\",\"polygon\":[{\"lon\":112.57321291454436,\"lat\":26.823070465392494},{\"lon\":112.573215006931,\"lat\":26.8230675990919},{\"lon\":112.573219106955,\"lat\":26.823061914715},{\"lon\":112.573223182233,\"lat\":26.8230562153801},{\"lon\":112.573227231639,\"lat\":26.8230505007471},{\"lon\":112.573231254048,\"lat\":26.8230447704754},{\"lon\":112.573235248336,\"lat\":26.8230390242245},{\"lon\":112.573239213377,\"lat\":26.8230332616541},{\"lon\":112.573243148045,\"lat\":26.8230274824236},{\"lon\":112.573247051217,\"lat\":26.8230216861928},{\"lon\":112.573250921765,\"lat\":26.823015872621},{\"lon\":112.573254758566,\"lat\":26.823010041368},{\"lon\":112.573258560494,\"lat\":26.8230041920932},{\"lon\":112.573262326424,\"lat\":26.8229983244562},{\"lon\":112.573266055231,\"lat\":26.8229924381166},{\"lon\":112.573269779025,\"lat\":26.8229864802436},{\"lon\":112.573273466,\"lat\":26.8229805039295},{\"lon\":112.573277118207,\"lat\":26.8229745102999},{\"lon\":112.573280737695,\"lat\":26.8229685004807},{\"lon\":112.573284326516,\"lat\":26.8229624755973},{\"lon\":112.57328788672,\"lat\":26.8229564367755},{\"lon\":112.573291420358,\"lat\":26.822950385141},{\"lon\":112.573294929481,\"lat\":26.8229443218192},{\"lon\":112.573298416139,\"lat\":26.822938247936},{\"lon\":112.573301882384,\"lat\":26.822932164617},{\"lon\":112.573305330265,\"lat\":26.8229260729878},{\"lon\":112.573308761833,\"lat\":26.8229199741741},{\"lon\":112.57331217914,\"lat\":26.8229138693015},{\"lon\":112.573315584235,\"lat\":26.8229077594956},{\"lon\":112.573318940869,\"lat\":26.8229017005891},{\"lon\":112.57332227685,\"lat\":26.8228956326057},{\"lon\":112.573325593901,\"lat\":26.8228895563037},{\"lon\":112.573328893742,\"lat\":26.8228834724414},{\"lon\":112.573332178097,\"lat\":26.8228773817772},{\"lon\":112.573335448685,\"lat\":26.8228712850694},{\"lon\":112.573338707228,\"lat\":26.8228651830762},{\"lon\":112.573341955449,\"lat\":26.822859076556},{\"lon\":112.573345195068,\"lat\":26.8228529662671},{\"lon\":112.573348427807,\"lat\":26.8228468529679},{\"lon\":112.573351655387,\"lat\":26.8228407374165},{\"lon\":112.57335487953,\"lat\":26.8228346203714},{\"lon\":112.573358101958,\"lat\":26.8228285025908},{\"lon\":112.573361324391,\"lat\":26.8228223848331},{\"lon\":112.573364548551,\"lat\":26.8228162678566},{\"lon\":112.573367776161,\"lat\":26.8228101524196},{\"lon\":112.57337100894,\"lat\":26.8228040392803},{\"lon\":112.573374248612,\"lat\":26.8227979291972},{\"lon\":112.573377570805,\"lat\":26.8227916708447},{\"lon\":112.573380890942,\"lat\":26.8227854119249},{\"lon\":112.573384209049,\"lat\":26.8227791523835},{\"lon\":112.573387525157,\"lat\":26.8227728921664},{\"lon\":112.573390839291,\"lat\":26.8227666312191},{\"lon\":112.573394151482,\"lat\":26.8227603694874},{\"lon\":112.573397461756,\"lat\":26.8227541069172},{\"lon\":112.573400770143,\"lat\":26.822747843454},{\"lon\":112.573404076669,\"lat\":26.8227415790437},{\"lon\":112.573407381363,\"lat\":26.822735313632},{\"lon\":112.573410684254,\"lat\":26.8227290471645},{\"lon\":112.57341398537,\"lat\":26.8227227795872},{\"lon\":112.573417284738,\"lat\":26.8227165108456},{\"lon\":112.573420582386,\"lat\":26.8227102408855},{\"lon\":112.573423878344,\"lat\":26.8227039696526},{\"lon\":112.573427172639,\"lat\":26.8226976970928},{\"lon\":112.573430465298,\"lat\":26.8226914231516},{\"lon\":112.5736541921437,\"lat\":26.822260937315143},{\"lon\":112.57362367177457,\"lat\":26.822244991227713},{\"lon\":112.573399937477,\"lat\":26.822675492918},{\"lon\":112.573396691977,\"lat\":26.8226816946351},{\"lon\":112.573393403264,\"lat\":26.8226879586397},{\"lon\":112.573390112889,\"lat\":26.8226942213535},{\"lon\":112.573386820836,\"lat\":26.8227004828209},{\"lon\":112.573383527072,\"lat\":26.822706742987},{\"lon\":112.573380231507,\"lat\":26.8227130021005},{\"lon\":112.573376934206,\"lat\":26.8227192599775},{\"lon\":112.573373635113,\"lat\":26.8227255169308},{\"lon\":112.573370334197,\"lat\":26.8227317727439},{\"lon\":112.573367031403,\"lat\":26.8227380276418},{\"lon\":112.573363726739,\"lat\":26.822744281759},{\"lon\":112.573360420141,\"lat\":26.8227505349933},{\"lon\":112.573357111541,\"lat\":26.8227567875221},{\"lon\":112.573353801054,\"lat\":26.8227630392523},{\"lon\":112.573350488563,\"lat\":26.8227692902611},{\"lon\":112.573347174021,\"lat\":26.8227755406808},{\"lon\":112.573343849991,\"lat\":26.8227818018286},{\"lon\":112.57334059532,\"lat\":26.8227879346295},{\"lon\":112.573337344447,\"lat\":26.8227940752481},{\"lon\":112.57333410391,\"lat\":26.8228002103548},{\"lon\":112.573330872,\"lat\":26.8228063391622},{\"lon\":112.573327646909,\"lat\":26.8228124609577},{\"lon\":112.573324426983,\"lat\":26.8228185749099},{\"lon\":112.573321210588,\"lat\":26.8228246801823},{\"lon\":112.573317995803,\"lat\":26.8228307762173},{\"lon\":112.573314781099,\"lat\":26.8228368621259},{\"lon\":112.573311564666,\"lat\":26.8228429372788},{\"lon\":112.573308344862,\"lat\":26.822849000878},{\"lon\":112.573305119998,\"lat\":26.8228550522037},{\"lon\":112.573301888377,\"lat\":26.8228610905445},{\"lon\":112.573298648327,\"lat\":26.8228671151949},{\"lon\":112.573295398165,\"lat\":26.8228731254473},{\"lon\":112.573292136233,\"lat\":26.822879120603},{\"lon\":112.573288860863,\"lat\":26.8228850999821},{\"lon\":112.573285560822,\"lat\":26.8228910767817},{\"lon\":112.573282199005,\"lat\":26.822897124157},{\"lon\":112.573278821808,\"lat\":26.8229031714324},{\"lon\":112.573275437073,\"lat\":26.8229092033326},{\"lon\":112.573272042813,\"lat\":26.8229152188038},{\"lon\":112.573268637042,\"lat\":26.8229212167948},{\"lon\":112.573265217788,\"lat\":26.8229271962611},{\"lon\":112.573261783086,\"lat\":26.8229331561851},{\"lon\":112.573258330982,\"lat\":26.8229390955283},{\"lon\":112.573254859519,\"lat\":26.8229450132931},{\"lon\":112.573251366753,\"lat\":26.8229509084733},{\"lon\":112.573247850743,\"lat\":26.8229567800818},{\"lon\":112.57324430955,\"lat\":26.8229626271411},{\"lon\":112.573240741245,\"lat\":26.8229684486883},{\"lon\":112.573237142704,\"lat\":26.8229742453022},{\"lon\":112.573233541124,\"lat\":26.8229799700034},{\"lon\":112.573229900299,\"lat\":26.8229856807403},{\"lon\":112.573226220729,\"lat\":26.8229913784753},{\"lon\":112.573222503466,\"lat\":26.8229970634612},{\"lon\":112.573218749581,\"lat\":26.8230027359391},{\"lon\":112.573214960128,\"lat\":26.8230083961865},{\"lon\":112.573211136192,\"lat\":26.8230140444302},{\"lon\":112.573207278832,\"lat\":26.8230196809522},{\"lon\":112.573203389132,\"lat\":26.8230253060135},{\"lon\":112.573199468169,\"lat\":26.8230309198603},{\"lon\":112.573195517033,\"lat\":26.8230365227693},{\"lon\":112.573191536797,\"lat\":26.8230421150085},{\"lon\":112.573187548559,\"lat\":26.8230476745161},{\"lon\":112.57318546455338,\"lat\":26.823050549063097}],\"polygonRoads\":[{\"tileId\":556834853,\"roadId\":\"130372\",\"laneNo\":-1,\"bearing\":152,\"roadName\":\"雁鸣路\"},{\"tileId\":556834853,\"roadId\":\"130372\",\"laneNo\":-2,\"bearing\":152,\"roadName\":\"雁鸣路\"},{\"tileId\":556834853,\"roadId\":\"130372\",\"laneNo\":-3,\"bearing\":152,\"roadName\":\"雁鸣路\"}],\"center\":{\"lon\":112.57320982521519,\"lat\":26.82306821019599},\"centerRoad\":{\"tileId\":556834853,\"roadId\":\"130372\",\"laneNo\":-2,\"bearing\":152,\"roadName\":\"雁鸣路\"},\"obstacles\":[{\"id\":0,\"type\":1,\"score\":95,\"polygon\":[{\"lon\":112.57321361221982,\"lat\":26.823054701276522},{\"lon\":112.57321254435868,\"lat\":26.823070134384093},{\"lon\":112.57320704440468,\"lat\":26.823066238995114},{\"lon\":112.57320772757787,\"lat\":26.823050237509577}],\"boundBox\":[{\"x\":2979.852783203125,\"y\":929.4248657226562},{\"x\":3031.54296875,\"y\":929.4248657226562},{\"x\":3031.54296875,\"y\":977.5980834960938},{\"x\":2979.852783203125,\"y\":977.5980834960938}],\"center\":{\"lon\":112.57320982521519,\"lat\":26.82306821019599}}],\"imgUrl\":\"http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/roadwork_image/2023-01-12/f7b1df85-895a-41c1-b05d-7356955c1c91_172_18_24_62.jpg?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%26q-sign-time%3D1673506267%3B1673513467%26q-key-time%3D1673506267%3B1673513467%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3Db6b2911110c9941471cfc447d7704b9caa57a0e1\",\"ip\":\"172.18.24.62\",\"score\":95,\"radius\":0,\"type\":2,\"trianglePolygon\":[[{\"lon\":112.57321291454436,\"lat\":26.823070465392494},{\"lon\":112.573215006931,\"lat\":26.8230675990919},{\"lon\":112.573219106955,\"lat\":26.823061914715},{\"lon\":112.573223182233,\"lat\":26.8230562153801},{\"lon\":112.573227231639,\"lat\":26.8230505007471},{\"lon\":112.573231254048,\"lat\":26.8230447704754},{\"lon\":112.573235248336,\"lat\":26.8230390242245},{\"lon\":112.573239213377,\"lat\":26.8230332616541},{\"lon\":112.573243148045,\"lat\":26.8230274824236},{\"lon\":112.573247051217,\"lat\":26.8230216861928},{\"lon\":112.573250921765,\"lat\":26.823015872621},{\"lon\":112.573254758566,\"lat\":26.823010041368},{\"lon\":112.573258560494,\"lat\":26.8230041920932},{\"lon\":112.573262326424,\"lat\":26.8229983244562},{\"lon\":112.573266055231,\"lat\":26.8229924381166},{\"lon\":112.573269779025,\"lat\":26.8229864802436},{\"lon\":112.573273466,\"lat\":26.8229805039295},{\"lon\":112.573277118207,\"lat\":26.8229745102999},{\"lon\":112.573280737695,\"lat\":26.8229685004807},{\"lon\":112.573284326516,\"lat\":26.8229624755973},{\"lon\":112.57328788672,\"lat\":26.8229564367755},{\"lon\":112.573291420358,\"lat\":26.822950385141},{\"lon\":112.573294929481,\"lat\":26.8229443218192},{\"lon\":112.573298416139,\"lat\":26.822938247936},{\"lon\":112.573301882384,\"lat\":26.822932164617},{\"lon\":112.573305330265,\"lat\":26.8229260729878},{\"lon\":112.573308761833,\"lat\":26.8229199741741},{\"lon\":112.57331217914,\"lat\":26.8229138693015},{\"lon\":112.573315584235,\"lat\":26.8229077594956},{\"lon\":112.573318940869,\"lat\":26.8229017005891},{\"lon\":112.57332227685,\"lat\":26.8228956326057},{\"lon\":112.573325593901,\"lat\":26.8228895563037},{\"lon\":112.573328893742,\"lat\":26.8228834724414},{\"lon\":112.573332178097,\"lat\":26.8228773817772},{\"lon\":112.573335448685,\"lat\":26.8228712850694},{\"lon\":112.573338707228,\"lat\":26.8228651830762},{\"lon\":112.573341955449,\"lat\":26.822859076556},{\"lon\":112.573345195068,\"lat\":26.8228529662671},{\"lon\":112.573348427807,\"lat\":26.8228468529679},{\"lon\":112.573351655387,\"lat\":26.8228407374165},{\"lon\":112.57335487953,\"lat\":26.8228346203714},{\"lon\":112.573358101958,\"lat\":26.8228285025908},{\"lon\":112.573361324391,\"lat\":26.8228223848331},{\"lon\":112.573364548551,\"lat\":26.8228162678566},{\"lon\":112.573367776161,\"lat\":26.8228101524196},{\"lon\":112.57337100894,\"lat\":26.8228040392803},{\"lon\":112.573374248612,\"lat\":26.8227979291972},{\"lon\":112.573377570805,\"lat\":26.8227916708447},{\"lon\":112.573380890942,\"lat\":26.8227854119249},{\"lon\":112.573384209049,\"lat\":26.8227791523835},{\"lon\":112.573387525157,\"lat\":26.8227728921664},{\"lon\":112.573390839291,\"lat\":26.8227666312191},{\"lon\":112.573394151482,\"lat\":26.8227603694874},{\"lon\":112.573397461756,\"lat\":26.8227541069172},{\"lon\":112.573400770143,\"lat\":26.822747843454},{\"lon\":112.573404076669,\"lat\":26.8227415790437},{\"lon\":112.573407381363,\"lat\":26.822735313632},{\"lon\":112.573410684254,\"lat\":26.8227290471645},{\"lon\":112.57341398537,\"lat\":26.8227227795872},{\"lon\":112.573417284738,\"lat\":26.8227165108456},{\"lon\":112.573420582386,\"lat\":26.8227102408855},{\"lon\":112.573423878344,\"lat\":26.8227039696526},{\"lon\":112.573427172639,\"lat\":26.8226976970928},{\"lon\":112.573430465298,\"lat\":26.8226914231516},{\"lon\":112.5736541921437,\"lat\":26.822260937315143},{\"lon\":112.57362367177457,\"lat\":26.822244991227713},{\"lon\":112.573399937477,\"lat\":26.822675492918},{\"lon\":112.573396691977,\"lat\":26.8226816946351},{\"lon\":112.573393403264,\"lat\":26.8226879586397},{\"lon\":112.573390112889,\"lat\":26.8226942213535},{\"lon\":112.573386820836,\"lat\":26.8227004828209},{\"lon\":112.573383527072,\"lat\":26.822706742987},{\"lon\":112.573380231507,\"lat\":26.8227130021005},{\"lon\":112.573376934206,\"lat\":26.8227192599775},{\"lon\":112.573373635113,\"lat\":26.8227255169308},{\"lon\":112.573370334197,\"lat\":26.8227317727439},{\"lon\":112.573367031403,\"lat\":26.8227380276418},{\"lon\":112.573363726739,\"lat\":26.822744281759},{\"lon\":112.573360420141,\"lat\":26.8227505349933},{\"lon\":112.573357111541,\"lat\":26.8227567875221},{\"lon\":112.573353801054,\"lat\":26.8227630392523},{\"lon\":112.573350488563,\"lat\":26.8227692902611},{\"lon\":112.573347174021,\"lat\":26.8227755406808},{\"lon\":112.573343849991,\"lat\":26.8227818018286},{\"lon\":112.57334059532,\"lat\":26.8227879346295},{\"lon\":112.573337344447,\"lat\":26.8227940752481},{\"lon\":112.57333410391,\"lat\":26.8228002103548},{\"lon\":112.573330872,\"lat\":26.8228063391622},{\"lon\":112.573327646909,\"lat\":26.8228124609577},{\"lon\":112.573324426983,\"lat\":26.8228185749099},{\"lon\":112.573321210588,\"lat\":26.8228246801823},{\"lon\":112.573317995803,\"lat\":26.8228307762173},{\"lon\":112.573314781099,\"lat\":26.8228368621259},{\"lon\":112.573311564666,\"lat\":26.8228429372788},{\"lon\":112.573308344862,\"lat\":26.822849000878},{\"lon\":112.573305119998,\"lat\":26.8228550522037},{\"lon\":112.573301888377,\"lat\":26.8228610905445},{\"lon\":112.573298648327,\"lat\":26.8228671151949},{\"lon\":112.573295398165,\"lat\":26.8228731254473},{\"lon\":112.573292136233,\"lat\":26.822879120603},{\"lon\":112.573288860863,\"lat\":26.8228850999821},{\"lon\":112.573285560822,\"lat\":26.8228910767817},{\"lon\":112.573282199005,\"lat\":26.822897124157},{\"lon\":112.573278821808,\"lat\":26.8229031714324},{\"lon\":112.573275437073,\"lat\":26.8229092033326},{\"lon\":112.573272042813,\"lat\":26.8229152188038},{\"lon\":112.573268637042,\"lat\":26.8229212167948},{\"lon\":112.573265217788,\"lat\":26.8229271962611},{\"lon\":112.573261783086,\"lat\":26.8229331561851},{\"lon\":112.573258330982,\"lat\":26.8229390955283},{\"lon\":112.573254859519,\"lat\":26.8229450132931},{\"lon\":112.573251366753,\"lat\":26.8229509084733},{\"lon\":112.573247850743,\"lat\":26.8229567800818},{\"lon\":112.57324430955,\"lat\":26.8229626271411},{\"lon\":112.573240741245,\"lat\":26.8229684486883},{\"lon\":112.573237142704,\"lat\":26.8229742453022},{\"lon\":112.573233541124,\"lat\":26.8229799700034},{\"lon\":112.573229900299,\"lat\":26.8229856807403},{\"lon\":112.573226220729,\"lat\":26.8229913784753},{\"lon\":112.573222503466,\"lat\":26.8229970634612},{\"lon\":112.573218749581,\"lat\":26.8230027359391},{\"lon\":112.573214960128,\"lat\":26.8230083961865},{\"lon\":112.573211136192,\"lat\":26.8230140444302},{\"lon\":112.573207278832,\"lat\":26.8230196809522},{\"lon\":112.573203389132,\"lat\":26.8230253060135},{\"lon\":112.573199468169,\"lat\":26.8230309198603},{\"lon\":112.573195517033,\"lat\":26.8230365227693},{\"lon\":112.573191536797,\"lat\":26.8230421150085},{\"lon\":112.573187548559,\"lat\":26.8230476745161},{\"lon\":112.57318546455338,\"lat\":26.823050549063097}]],\"obstaclePoint\":[{\"lon\":112.573443,\"lat\":26.822538},{\"lon\":112.573691,\"lat\":26.822676},{\"lon\":112.573021,\"lat\":26.823149},{\"lon\":112.572974,\"lat\":26.823199}],\"createTime\":1673506267760,\"createTimeStr\":\"2023-01-12 14:51:07\"}" -// val road1 = "{\"poiType\":\"100061\",\"receiveTime\":1673509755649,\"detectTime\":1673509755637,\"id\":\"86447e30-2dfc-4a27-8d01-41ffe9a9a7fe\",\"index\":\"636136931493457343\",\"polygon\":[{\"lon\":112.57337137520945,\"lat\":26.822950000610152},{\"lon\":112.5733703998375,\"lat\":26.82294943400411},{\"lon\":112.57336923793872,\"lat\":26.82294944578748},{\"lon\":112.57336827709125,\"lat\":26.82295003202963},{\"lon\":112.57336786590433,\"lat\":26.822950822795498},{\"lon\":112.57332583348149,\"lat\":26.823144415135413},{\"lon\":112.57332583904886,\"lat\":26.823145130116597},{\"lon\":112.57332615359141,\"lat\":26.82314578706645},{\"lon\":112.57332672775591,\"lat\":26.823146282906478},{\"lon\":112.57332747145331,\"lat\":26.823146539837108},{\"lon\":112.57332807078356,\"lat\":26.823146549872188},{\"lon\":112.57332882464814,\"lat\":26.82314631801647},{\"lon\":112.57332941903356,\"lat\":26.823145841742402},{\"lon\":112.57332970267485,\"lat\":26.82314536795171},{\"lon\":112.57339652767452,\"lat\":26.82297757920771},{\"lon\":112.57339644737766,\"lat\":26.82297673161999},{\"lon\":112.57339607387638,\"lat\":26.822976136665098},{\"lon\":112.57337137520945,\"lat\":26.822950000610152}],\"polygonRoads\":[{\"tileId\":556834853,\"roadId\":\"130314\",\"laneNo\":-1,\"bearing\":330,\"roadName\":\"雁鸣路\"},{\"tileId\":556834853,\"roadId\":\"130314\",\"laneNo\":-2,\"bearing\":330,\"roadName\":\"雁鸣路\"},{\"tileId\":556834853,\"roadId\":\"130314\",\"laneNo\":-3,\"bearing\":330,\"roadName\":\"雁鸣路\"},{\"tileId\":556834853,\"roadId\":\"130583\",\"laneNo\":-1,\"bearing\":278}],\"center\":{\"lon\":112.57336404707121,\"lat\":26.823024407262803},\"centerRoad\":{\"tileId\":556834853,\"roadId\":\"130314\",\"laneNo\":-2,\"bearing\":330,\"roadName\":\"雁鸣路\"},\"obstacles\":[{\"id\":0,\"type\":1,\"score\":88,\"polygon\":[{\"lon\":112.57334137965555,\"lat\":26.82313245733589},{\"lon\":112.573329020958,\"lat\":26.823145531571242},{\"lon\":112.57332663570918,\"lat\":26.823144025991855},{\"lon\":112.57333875695714,\"lat\":26.823130823353114}],\"boundBox\":[{\"x\":1439.8624267578125,\"y\":893.4229736328125},{\"x\":1474.45361328125,\"y\":893.4229736328125},{\"x\":1474.45361328125,\"y\":966.433837890625},{\"x\":1439.8624267578125,\"y\":966.433837890625}],\"center\":{\"lon\":112.57332779256919,\"lat\":26.823144756804734}},{\"id\":1,\"type\":1,\"score\":87,\"polygon\":[{\"lon\":112.57339986657128,\"lat\":26.822898951544797},{\"lon\":112.5733716620538,\"lat\":26.822952992001163},{\"lon\":112.57336786188131,\"lat\":26.822949186370185},{\"lon\":112.57339561566401,\"lat\":26.822894141465785}],\"boundBox\":[{\"x\":2085.054443359375,\"y\":503.0662841796875},{\"x\":2116.11865234375,\"y\":503.0662841796875},{\"x\":2116.11865234375,\"y\":559.9113159179688},{\"x\":2085.054443359375,\"y\":559.9113159179688}],\"center\":{\"lon\":112.5733698249888,\"lat\":26.822951164464232}},{\"id\":2,\"type\":1,\"score\":71,\"polygon\":[{\"lon\":112.57342641528835,\"lat\":26.82293191667262},{\"lon\":112.57339610867105,\"lat\":26.82297860774548},{\"lon\":112.5733928192764,\"lat\":26.822975877911627},{\"lon\":112.57342270277888,\"lat\":26.822928610829003}],\"boundBox\":[{\"x\":1873.2490234375,\"y\":507.2391357421875},{\"x\":1900.5283203125,\"y\":507.2391357421875},{\"x\":1900.5283203125,\"y\":562.299560546875},{\"x\":1873.2490234375,\"y\":562.299560546875}],\"center\":{\"lon\":112.57339452365564,\"lat\":26.822977300519444}}],\"imgUrl\":\"http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/roadwork_image/2023-01-12/86447e30-2dfc-4a27-8d01-41ffe9a9a7fe_172_18_24_62.jpg?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%26q-sign-time%3D1673509757%3B1673516957%26q-key-time%3D1673509757%3B1673516957%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3D557de14ddfb999d35ddef9e23b3532d9d299c62f\",\"ip\":\"172.18.24.62\",\"score\":82,\"radius\":0,\"type\":1,\"createTime\":1673509757496,\"createTimeStr\":\"2023-01-12 15:49:17\"}" -// //val road2 = "{\"poiType\":\"100061\",\"receiveTime\":1673509756306,\"detectTime\":1673509756290,\"id\":\"be6a2000-a96c-42c8-a7ef-f83388d84858\",\"index\":\"636136931493532287\",\"polygon\":[{\"lon\":112.5733515539896,\"lat\":26.823143145432386},{\"lon\":112.57335140084462,\"lat\":26.823142454672727},{\"lon\":112.57335096472467,\"lat\":26.823141869074952},{\"lon\":112.57335031202503,\"lat\":26.82314147779103},{\"lon\":112.57334954211333,\"lat\":26.82314134039038},{\"lon\":112.57334877220161,\"lat\":26.82314147779103},{\"lon\":112.573348119502,\"lat\":26.823141869074952},{\"lon\":112.57334768338202,\"lat\":26.823142454672727},{\"lon\":112.57334753023707,\"lat\":26.823143145432386},{\"lon\":112.57334768338202,\"lat\":26.82314383619207},{\"lon\":112.57334811950196,\"lat\":26.82314442178987},{\"lon\":112.5733487722016,\"lat\":26.823144813073792},{\"lon\":112.57334954211333,\"lat\":26.823144950474443},{\"lon\":112.57335031202504,\"lat\":26.823144813073792},{\"lon\":112.57335096472468,\"lat\":26.82314442178987},{\"lon\":112.57335140084464,\"lat\":26.82314383619207},{\"lon\":112.5733515539896,\"lat\":26.823143145432386}],\"polygonRoads\":[{\"tileId\":556834853,\"roadId\":\"130314\",\"laneNo\":-4,\"bearing\":332,\"roadName\":\"雁鸣路\"}],\"center\":{\"lon\":112.57334952644263,\"lat\":26.823143141971546},\"centerRoad\":{\"tileId\":556834853,\"roadId\":\"130314\",\"laneNo\":-4,\"bearing\":332,\"roadName\":\"雁鸣路\"},\"obstacles\":[{\"id\":0,\"type\":1,\"score\":72,\"polygon\":[{\"lon\":112.57341760772391,\"lat\":26.823104379136176},{\"lon\":112.57335121413183,\"lat\":26.82314367391432},{\"lon\":112.57334751791018,\"lat\":26.823142500693834},{\"lon\":112.57341321183773,\"lat\":26.82310322131963}],\"boundBox\":[{\"x\":1551.2252197265625,\"y\":352.58837890625},{\"x\":1562.4649658203125,\"y\":352.58837890625},{\"x\":1562.4649658203125,\"y\":376.17327880859375},{\"x\":1551.2252197265625,\"y\":376.17327880859375}],\"center\":{\"lon\":112.57334952644263,\"lat\":26.823143141971546}}],\"imgUrl\":\"http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/roadwork_image/2023-01-12/be6a2000-a96c-42c8-a7ef-f83388d84858_172_18_24_42.jpg?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%26q-sign-time%3D1673509758%3B1673516958%26q-key-time%3D1673509758%3B1673516958%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3Db2682464078ae53eae6e87f924abe17fa7c04ac8\",\"ip\":\"172.18.24.42\",\"score\":72,\"radius\":0,\"type\":1,\"createTime\":1673509758511,\"createTimeStr\":\"2023-01-12 15:49:18\"}" -// val jingzhi1 = "{\"poiType\":\"100321\",\"detectTime\":1673506266924,\"id\":\"f7b1df85-895a-41c1-b05d-7356955c1c91\",\"index\":\"636136931493454271\",\"polygon\":[],\"center\":{\"lon\":112.57320982521519,\"lat\":26.82306821019599},\"centerRoad\":{\"tileId\":556834853,\"laneNo\":-2,\"bearing\":152},\"score\":95,\"radius\":0,\"type\":2}" -// val jingzhi2 = "{\"poiType\":\"100321\",\"detectTime\":1673506266924,\"id\":\"f7b1df85-895a-41c1-b05d-7356955c1c91\",\"index\":\"636136931493454271\",\"polygon\":[],\"center\":{\"lon\":112.57320982521519,\"lat\":26.82306821019599},\"centerRoad\":{\"tileId\":556834853,\"laneNo\":-2,\"bearing\":152},\"score\":95,\"radius\":0,\"type\":2}" -// val jingzhi3 = "{\"poiType\":\"100321\",\"detectTime\":1673506266924,\"id\":\"f7b1df85-895a-41c1-b05d-7356955c1c91\",\"index\":\"636136931493454271\",\"polygon\":[],\"center\":{\"lon\":112.57320982521519,\"lat\":26.82306821019599},\"centerRoad\":{\"tileId\":556834853,\"laneNo\":-2,\"bearing\":152},\"score\":95,\"radius\":0,\"type\":2}" -// while (true) { -// delay(1000) -// //V2XEventManager.onAck(V2XEvent.RoadEventX(data = GsonUtils.fromJson(shigu, V2XRoadXData::class.java))) -// V2XEventManager.onAck(V2XEvent.RoadEventX(data = GsonUtils.fromJson(road1, V2XRoadXData::class.java))) -// // V2XEventManager.onAck(V2XEvent.RoadEventX(data = GsonUtils.fromJson(road2, V2XRoadXData::class.java))) + .addRoad(0, Road_PB + .newBuilder() + .setRoadId("200090") + .setLaneNo("-2") + .setTileId("556834853") + .setBearing(154) + .build()) + .addRoad(1, Road_PB + .newBuilder() + .setRoadId("200091") + .setLaneNo("-2") + .setTileId("556834853") + .setBearing(156) + .build()) + .build()) + .build() + val event = V2XEvent.RoadAI(data = child) + while (true) { + delay(1000) + V2XEventManager.onAck(event) + } + + } + +// private suspend fun ensureMoGoHmiFragmentShow(): MoGoHmiProvider = suspendCancellableCoroutine { +// launch.onActivity { itx -> +// val executor = Executors.newSingleThreadScheduledExecutor() +// executor.scheduleAtFixedRate({ +// var find = +// itx.supportFragmentManager.fragments.find { it is MoGoHmiProvider } as? MoGoHmiProvider +// while (find == null) { +// find = +// itx.supportFragmentManager.fragments.find { it is MoGoHmiProvider } as? MoGoHmiProvider +// } +// while (!find.isResumed) { +// Thread.sleep(500) +// } +// it.resumeWith(Result.success(find)) +// try { +// Thread.sleep(500) +// executor.shutdownNow() +// } catch (e: Throwable) { +// e.printStackTrace() +// } +// }, 50, 500, MILLISECONDS) // } // } -// -//} \ No newline at end of file + + + @Test + fun testRoadAI() = runBlocking { + //ensureMoGoHmiFragmentShow() + val shigu = "{\"poiType\":\"100321\",\"receiveTime\":1673506266967,\"detectTime\":1673506266924,\"id\":\"f7b1df85-895a-41c1-b05d-7356955c1c91\",\"index\":\"636136931493454271\",\"polygon\":[{\"lon\":112.57321291454436,\"lat\":26.823070465392494},{\"lon\":112.573215006931,\"lat\":26.8230675990919},{\"lon\":112.573219106955,\"lat\":26.823061914715},{\"lon\":112.573223182233,\"lat\":26.8230562153801},{\"lon\":112.573227231639,\"lat\":26.8230505007471},{\"lon\":112.573231254048,\"lat\":26.8230447704754},{\"lon\":112.573235248336,\"lat\":26.8230390242245},{\"lon\":112.573239213377,\"lat\":26.8230332616541},{\"lon\":112.573243148045,\"lat\":26.8230274824236},{\"lon\":112.573247051217,\"lat\":26.8230216861928},{\"lon\":112.573250921765,\"lat\":26.823015872621},{\"lon\":112.573254758566,\"lat\":26.823010041368},{\"lon\":112.573258560494,\"lat\":26.8230041920932},{\"lon\":112.573262326424,\"lat\":26.8229983244562},{\"lon\":112.573266055231,\"lat\":26.8229924381166},{\"lon\":112.573269779025,\"lat\":26.8229864802436},{\"lon\":112.573273466,\"lat\":26.8229805039295},{\"lon\":112.573277118207,\"lat\":26.8229745102999},{\"lon\":112.573280737695,\"lat\":26.8229685004807},{\"lon\":112.573284326516,\"lat\":26.8229624755973},{\"lon\":112.57328788672,\"lat\":26.8229564367755},{\"lon\":112.573291420358,\"lat\":26.822950385141},{\"lon\":112.573294929481,\"lat\":26.8229443218192},{\"lon\":112.573298416139,\"lat\":26.822938247936},{\"lon\":112.573301882384,\"lat\":26.822932164617},{\"lon\":112.573305330265,\"lat\":26.8229260729878},{\"lon\":112.573308761833,\"lat\":26.8229199741741},{\"lon\":112.57331217914,\"lat\":26.8229138693015},{\"lon\":112.573315584235,\"lat\":26.8229077594956},{\"lon\":112.573318940869,\"lat\":26.8229017005891},{\"lon\":112.57332227685,\"lat\":26.8228956326057},{\"lon\":112.573325593901,\"lat\":26.8228895563037},{\"lon\":112.573328893742,\"lat\":26.8228834724414},{\"lon\":112.573332178097,\"lat\":26.8228773817772},{\"lon\":112.573335448685,\"lat\":26.8228712850694},{\"lon\":112.573338707228,\"lat\":26.8228651830762},{\"lon\":112.573341955449,\"lat\":26.822859076556},{\"lon\":112.573345195068,\"lat\":26.8228529662671},{\"lon\":112.573348427807,\"lat\":26.8228468529679},{\"lon\":112.573351655387,\"lat\":26.8228407374165},{\"lon\":112.57335487953,\"lat\":26.8228346203714},{\"lon\":112.573358101958,\"lat\":26.8228285025908},{\"lon\":112.573361324391,\"lat\":26.8228223848331},{\"lon\":112.573364548551,\"lat\":26.8228162678566},{\"lon\":112.573367776161,\"lat\":26.8228101524196},{\"lon\":112.57337100894,\"lat\":26.8228040392803},{\"lon\":112.573374248612,\"lat\":26.8227979291972},{\"lon\":112.573377570805,\"lat\":26.8227916708447},{\"lon\":112.573380890942,\"lat\":26.8227854119249},{\"lon\":112.573384209049,\"lat\":26.8227791523835},{\"lon\":112.573387525157,\"lat\":26.8227728921664},{\"lon\":112.573390839291,\"lat\":26.8227666312191},{\"lon\":112.573394151482,\"lat\":26.8227603694874},{\"lon\":112.573397461756,\"lat\":26.8227541069172},{\"lon\":112.573400770143,\"lat\":26.822747843454},{\"lon\":112.573404076669,\"lat\":26.8227415790437},{\"lon\":112.573407381363,\"lat\":26.822735313632},{\"lon\":112.573410684254,\"lat\":26.8227290471645},{\"lon\":112.57341398537,\"lat\":26.8227227795872},{\"lon\":112.573417284738,\"lat\":26.8227165108456},{\"lon\":112.573420582386,\"lat\":26.8227102408855},{\"lon\":112.573423878344,\"lat\":26.8227039696526},{\"lon\":112.573427172639,\"lat\":26.8226976970928},{\"lon\":112.573430465298,\"lat\":26.8226914231516},{\"lon\":112.5736541921437,\"lat\":26.822260937315143},{\"lon\":112.57362367177457,\"lat\":26.822244991227713},{\"lon\":112.573399937477,\"lat\":26.822675492918},{\"lon\":112.573396691977,\"lat\":26.8226816946351},{\"lon\":112.573393403264,\"lat\":26.8226879586397},{\"lon\":112.573390112889,\"lat\":26.8226942213535},{\"lon\":112.573386820836,\"lat\":26.8227004828209},{\"lon\":112.573383527072,\"lat\":26.822706742987},{\"lon\":112.573380231507,\"lat\":26.8227130021005},{\"lon\":112.573376934206,\"lat\":26.8227192599775},{\"lon\":112.573373635113,\"lat\":26.8227255169308},{\"lon\":112.573370334197,\"lat\":26.8227317727439},{\"lon\":112.573367031403,\"lat\":26.8227380276418},{\"lon\":112.573363726739,\"lat\":26.822744281759},{\"lon\":112.573360420141,\"lat\":26.8227505349933},{\"lon\":112.573357111541,\"lat\":26.8227567875221},{\"lon\":112.573353801054,\"lat\":26.8227630392523},{\"lon\":112.573350488563,\"lat\":26.8227692902611},{\"lon\":112.573347174021,\"lat\":26.8227755406808},{\"lon\":112.573343849991,\"lat\":26.8227818018286},{\"lon\":112.57334059532,\"lat\":26.8227879346295},{\"lon\":112.573337344447,\"lat\":26.8227940752481},{\"lon\":112.57333410391,\"lat\":26.8228002103548},{\"lon\":112.573330872,\"lat\":26.8228063391622},{\"lon\":112.573327646909,\"lat\":26.8228124609577},{\"lon\":112.573324426983,\"lat\":26.8228185749099},{\"lon\":112.573321210588,\"lat\":26.8228246801823},{\"lon\":112.573317995803,\"lat\":26.8228307762173},{\"lon\":112.573314781099,\"lat\":26.8228368621259},{\"lon\":112.573311564666,\"lat\":26.8228429372788},{\"lon\":112.573308344862,\"lat\":26.822849000878},{\"lon\":112.573305119998,\"lat\":26.8228550522037},{\"lon\":112.573301888377,\"lat\":26.8228610905445},{\"lon\":112.573298648327,\"lat\":26.8228671151949},{\"lon\":112.573295398165,\"lat\":26.8228731254473},{\"lon\":112.573292136233,\"lat\":26.822879120603},{\"lon\":112.573288860863,\"lat\":26.8228850999821},{\"lon\":112.573285560822,\"lat\":26.8228910767817},{\"lon\":112.573282199005,\"lat\":26.822897124157},{\"lon\":112.573278821808,\"lat\":26.8229031714324},{\"lon\":112.573275437073,\"lat\":26.8229092033326},{\"lon\":112.573272042813,\"lat\":26.8229152188038},{\"lon\":112.573268637042,\"lat\":26.8229212167948},{\"lon\":112.573265217788,\"lat\":26.8229271962611},{\"lon\":112.573261783086,\"lat\":26.8229331561851},{\"lon\":112.573258330982,\"lat\":26.8229390955283},{\"lon\":112.573254859519,\"lat\":26.8229450132931},{\"lon\":112.573251366753,\"lat\":26.8229509084733},{\"lon\":112.573247850743,\"lat\":26.8229567800818},{\"lon\":112.57324430955,\"lat\":26.8229626271411},{\"lon\":112.573240741245,\"lat\":26.8229684486883},{\"lon\":112.573237142704,\"lat\":26.8229742453022},{\"lon\":112.573233541124,\"lat\":26.8229799700034},{\"lon\":112.573229900299,\"lat\":26.8229856807403},{\"lon\":112.573226220729,\"lat\":26.8229913784753},{\"lon\":112.573222503466,\"lat\":26.8229970634612},{\"lon\":112.573218749581,\"lat\":26.8230027359391},{\"lon\":112.573214960128,\"lat\":26.8230083961865},{\"lon\":112.573211136192,\"lat\":26.8230140444302},{\"lon\":112.573207278832,\"lat\":26.8230196809522},{\"lon\":112.573203389132,\"lat\":26.8230253060135},{\"lon\":112.573199468169,\"lat\":26.8230309198603},{\"lon\":112.573195517033,\"lat\":26.8230365227693},{\"lon\":112.573191536797,\"lat\":26.8230421150085},{\"lon\":112.573187548559,\"lat\":26.8230476745161},{\"lon\":112.57318546455338,\"lat\":26.823050549063097}],\"polygonRoads\":[{\"tileId\":556834853,\"roadId\":\"130372\",\"laneNo\":-1,\"bearing\":152,\"roadName\":\"雁鸣路\"},{\"tileId\":556834853,\"roadId\":\"130372\",\"laneNo\":-2,\"bearing\":152,\"roadName\":\"雁鸣路\"},{\"tileId\":556834853,\"roadId\":\"130372\",\"laneNo\":-3,\"bearing\":152,\"roadName\":\"雁鸣路\"}],\"center\":{\"lon\":112.57320982521519,\"lat\":26.82306821019599},\"centerRoad\":{\"tileId\":556834853,\"roadId\":\"130372\",\"laneNo\":-2,\"bearing\":152,\"roadName\":\"雁鸣路\"},\"obstacles\":[{\"id\":0,\"type\":1,\"score\":95,\"polygon\":[{\"lon\":112.57321361221982,\"lat\":26.823054701276522},{\"lon\":112.57321254435868,\"lat\":26.823070134384093},{\"lon\":112.57320704440468,\"lat\":26.823066238995114},{\"lon\":112.57320772757787,\"lat\":26.823050237509577}],\"boundBox\":[{\"x\":2979.852783203125,\"y\":929.4248657226562},{\"x\":3031.54296875,\"y\":929.4248657226562},{\"x\":3031.54296875,\"y\":977.5980834960938},{\"x\":2979.852783203125,\"y\":977.5980834960938}],\"center\":{\"lon\":112.57320982521519,\"lat\":26.82306821019599}}],\"imgUrl\":\"http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/roadwork_image/2023-01-12/f7b1df85-895a-41c1-b05d-7356955c1c91_172_18_24_62.jpg?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%26q-sign-time%3D1673506267%3B1673513467%26q-key-time%3D1673506267%3B1673513467%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3Db6b2911110c9941471cfc447d7704b9caa57a0e1\",\"ip\":\"172.18.24.62\",\"score\":95,\"radius\":0,\"type\":2,\"trianglePolygon\":[[{\"lon\":112.57321291454436,\"lat\":26.823070465392494},{\"lon\":112.573215006931,\"lat\":26.8230675990919},{\"lon\":112.573219106955,\"lat\":26.823061914715},{\"lon\":112.573223182233,\"lat\":26.8230562153801},{\"lon\":112.573227231639,\"lat\":26.8230505007471},{\"lon\":112.573231254048,\"lat\":26.8230447704754},{\"lon\":112.573235248336,\"lat\":26.8230390242245},{\"lon\":112.573239213377,\"lat\":26.8230332616541},{\"lon\":112.573243148045,\"lat\":26.8230274824236},{\"lon\":112.573247051217,\"lat\":26.8230216861928},{\"lon\":112.573250921765,\"lat\":26.823015872621},{\"lon\":112.573254758566,\"lat\":26.823010041368},{\"lon\":112.573258560494,\"lat\":26.8230041920932},{\"lon\":112.573262326424,\"lat\":26.8229983244562},{\"lon\":112.573266055231,\"lat\":26.8229924381166},{\"lon\":112.573269779025,\"lat\":26.8229864802436},{\"lon\":112.573273466,\"lat\":26.8229805039295},{\"lon\":112.573277118207,\"lat\":26.8229745102999},{\"lon\":112.573280737695,\"lat\":26.8229685004807},{\"lon\":112.573284326516,\"lat\":26.8229624755973},{\"lon\":112.57328788672,\"lat\":26.8229564367755},{\"lon\":112.573291420358,\"lat\":26.822950385141},{\"lon\":112.573294929481,\"lat\":26.8229443218192},{\"lon\":112.573298416139,\"lat\":26.822938247936},{\"lon\":112.573301882384,\"lat\":26.822932164617},{\"lon\":112.573305330265,\"lat\":26.8229260729878},{\"lon\":112.573308761833,\"lat\":26.8229199741741},{\"lon\":112.57331217914,\"lat\":26.8229138693015},{\"lon\":112.573315584235,\"lat\":26.8229077594956},{\"lon\":112.573318940869,\"lat\":26.8229017005891},{\"lon\":112.57332227685,\"lat\":26.8228956326057},{\"lon\":112.573325593901,\"lat\":26.8228895563037},{\"lon\":112.573328893742,\"lat\":26.8228834724414},{\"lon\":112.573332178097,\"lat\":26.8228773817772},{\"lon\":112.573335448685,\"lat\":26.8228712850694},{\"lon\":112.573338707228,\"lat\":26.8228651830762},{\"lon\":112.573341955449,\"lat\":26.822859076556},{\"lon\":112.573345195068,\"lat\":26.8228529662671},{\"lon\":112.573348427807,\"lat\":26.8228468529679},{\"lon\":112.573351655387,\"lat\":26.8228407374165},{\"lon\":112.57335487953,\"lat\":26.8228346203714},{\"lon\":112.573358101958,\"lat\":26.8228285025908},{\"lon\":112.573361324391,\"lat\":26.8228223848331},{\"lon\":112.573364548551,\"lat\":26.8228162678566},{\"lon\":112.573367776161,\"lat\":26.8228101524196},{\"lon\":112.57337100894,\"lat\":26.8228040392803},{\"lon\":112.573374248612,\"lat\":26.8227979291972},{\"lon\":112.573377570805,\"lat\":26.8227916708447},{\"lon\":112.573380890942,\"lat\":26.8227854119249},{\"lon\":112.573384209049,\"lat\":26.8227791523835},{\"lon\":112.573387525157,\"lat\":26.8227728921664},{\"lon\":112.573390839291,\"lat\":26.8227666312191},{\"lon\":112.573394151482,\"lat\":26.8227603694874},{\"lon\":112.573397461756,\"lat\":26.8227541069172},{\"lon\":112.573400770143,\"lat\":26.822747843454},{\"lon\":112.573404076669,\"lat\":26.8227415790437},{\"lon\":112.573407381363,\"lat\":26.822735313632},{\"lon\":112.573410684254,\"lat\":26.8227290471645},{\"lon\":112.57341398537,\"lat\":26.8227227795872},{\"lon\":112.573417284738,\"lat\":26.8227165108456},{\"lon\":112.573420582386,\"lat\":26.8227102408855},{\"lon\":112.573423878344,\"lat\":26.8227039696526},{\"lon\":112.573427172639,\"lat\":26.8226976970928},{\"lon\":112.573430465298,\"lat\":26.8226914231516},{\"lon\":112.5736541921437,\"lat\":26.822260937315143},{\"lon\":112.57362367177457,\"lat\":26.822244991227713},{\"lon\":112.573399937477,\"lat\":26.822675492918},{\"lon\":112.573396691977,\"lat\":26.8226816946351},{\"lon\":112.573393403264,\"lat\":26.8226879586397},{\"lon\":112.573390112889,\"lat\":26.8226942213535},{\"lon\":112.573386820836,\"lat\":26.8227004828209},{\"lon\":112.573383527072,\"lat\":26.822706742987},{\"lon\":112.573380231507,\"lat\":26.8227130021005},{\"lon\":112.573376934206,\"lat\":26.8227192599775},{\"lon\":112.573373635113,\"lat\":26.8227255169308},{\"lon\":112.573370334197,\"lat\":26.8227317727439},{\"lon\":112.573367031403,\"lat\":26.8227380276418},{\"lon\":112.573363726739,\"lat\":26.822744281759},{\"lon\":112.573360420141,\"lat\":26.8227505349933},{\"lon\":112.573357111541,\"lat\":26.8227567875221},{\"lon\":112.573353801054,\"lat\":26.8227630392523},{\"lon\":112.573350488563,\"lat\":26.8227692902611},{\"lon\":112.573347174021,\"lat\":26.8227755406808},{\"lon\":112.573343849991,\"lat\":26.8227818018286},{\"lon\":112.57334059532,\"lat\":26.8227879346295},{\"lon\":112.573337344447,\"lat\":26.8227940752481},{\"lon\":112.57333410391,\"lat\":26.8228002103548},{\"lon\":112.573330872,\"lat\":26.8228063391622},{\"lon\":112.573327646909,\"lat\":26.8228124609577},{\"lon\":112.573324426983,\"lat\":26.8228185749099},{\"lon\":112.573321210588,\"lat\":26.8228246801823},{\"lon\":112.573317995803,\"lat\":26.8228307762173},{\"lon\":112.573314781099,\"lat\":26.8228368621259},{\"lon\":112.573311564666,\"lat\":26.8228429372788},{\"lon\":112.573308344862,\"lat\":26.822849000878},{\"lon\":112.573305119998,\"lat\":26.8228550522037},{\"lon\":112.573301888377,\"lat\":26.8228610905445},{\"lon\":112.573298648327,\"lat\":26.8228671151949},{\"lon\":112.573295398165,\"lat\":26.8228731254473},{\"lon\":112.573292136233,\"lat\":26.822879120603},{\"lon\":112.573288860863,\"lat\":26.8228850999821},{\"lon\":112.573285560822,\"lat\":26.8228910767817},{\"lon\":112.573282199005,\"lat\":26.822897124157},{\"lon\":112.573278821808,\"lat\":26.8229031714324},{\"lon\":112.573275437073,\"lat\":26.8229092033326},{\"lon\":112.573272042813,\"lat\":26.8229152188038},{\"lon\":112.573268637042,\"lat\":26.8229212167948},{\"lon\":112.573265217788,\"lat\":26.8229271962611},{\"lon\":112.573261783086,\"lat\":26.8229331561851},{\"lon\":112.573258330982,\"lat\":26.8229390955283},{\"lon\":112.573254859519,\"lat\":26.8229450132931},{\"lon\":112.573251366753,\"lat\":26.8229509084733},{\"lon\":112.573247850743,\"lat\":26.8229567800818},{\"lon\":112.57324430955,\"lat\":26.8229626271411},{\"lon\":112.573240741245,\"lat\":26.8229684486883},{\"lon\":112.573237142704,\"lat\":26.8229742453022},{\"lon\":112.573233541124,\"lat\":26.8229799700034},{\"lon\":112.573229900299,\"lat\":26.8229856807403},{\"lon\":112.573226220729,\"lat\":26.8229913784753},{\"lon\":112.573222503466,\"lat\":26.8229970634612},{\"lon\":112.573218749581,\"lat\":26.8230027359391},{\"lon\":112.573214960128,\"lat\":26.8230083961865},{\"lon\":112.573211136192,\"lat\":26.8230140444302},{\"lon\":112.573207278832,\"lat\":26.8230196809522},{\"lon\":112.573203389132,\"lat\":26.8230253060135},{\"lon\":112.573199468169,\"lat\":26.8230309198603},{\"lon\":112.573195517033,\"lat\":26.8230365227693},{\"lon\":112.573191536797,\"lat\":26.8230421150085},{\"lon\":112.573187548559,\"lat\":26.8230476745161},{\"lon\":112.57318546455338,\"lat\":26.823050549063097}]],\"obstaclePoint\":[{\"lon\":112.573443,\"lat\":26.822538},{\"lon\":112.573691,\"lat\":26.822676},{\"lon\":112.573021,\"lat\":26.823149},{\"lon\":112.572974,\"lat\":26.823199}],\"createTime\":1673506267760,\"createTimeStr\":\"2023-01-12 14:51:07\"}" + val road1 = "{\"poiType\":\"100061\",\"receiveTime\":1673509755649,\"detectTime\":1673509755637,\"id\":\"86447e30-2dfc-4a27-8d01-41ffe9a9a7fe\",\"index\":\"636136931493457343\",\"polygon\":[{\"lon\":112.57337137520945,\"lat\":26.822950000610152},{\"lon\":112.5733703998375,\"lat\":26.82294943400411},{\"lon\":112.57336923793872,\"lat\":26.82294944578748},{\"lon\":112.57336827709125,\"lat\":26.82295003202963},{\"lon\":112.57336786590433,\"lat\":26.822950822795498},{\"lon\":112.57332583348149,\"lat\":26.823144415135413},{\"lon\":112.57332583904886,\"lat\":26.823145130116597},{\"lon\":112.57332615359141,\"lat\":26.82314578706645},{\"lon\":112.57332672775591,\"lat\":26.823146282906478},{\"lon\":112.57332747145331,\"lat\":26.823146539837108},{\"lon\":112.57332807078356,\"lat\":26.823146549872188},{\"lon\":112.57332882464814,\"lat\":26.82314631801647},{\"lon\":112.57332941903356,\"lat\":26.823145841742402},{\"lon\":112.57332970267485,\"lat\":26.82314536795171},{\"lon\":112.57339652767452,\"lat\":26.82297757920771},{\"lon\":112.57339644737766,\"lat\":26.82297673161999},{\"lon\":112.57339607387638,\"lat\":26.822976136665098},{\"lon\":112.57337137520945,\"lat\":26.822950000610152}],\"polygonRoads\":[{\"tileId\":556834853,\"roadId\":\"130314\",\"laneNo\":-1,\"bearing\":330,\"roadName\":\"雁鸣路\"},{\"tileId\":556834853,\"roadId\":\"130314\",\"laneNo\":-2,\"bearing\":330,\"roadName\":\"雁鸣路\"},{\"tileId\":556834853,\"roadId\":\"130314\",\"laneNo\":-3,\"bearing\":330,\"roadName\":\"雁鸣路\"},{\"tileId\":556834853,\"roadId\":\"130583\",\"laneNo\":-1,\"bearing\":278}],\"center\":{\"lon\":112.57336404707121,\"lat\":26.823024407262803},\"centerRoad\":{\"tileId\":556834853,\"roadId\":\"130314\",\"laneNo\":-2,\"bearing\":330,\"roadName\":\"雁鸣路\"},\"obstacles\":[{\"id\":0,\"type\":1,\"score\":88,\"polygon\":[{\"lon\":112.57334137965555,\"lat\":26.82313245733589},{\"lon\":112.573329020958,\"lat\":26.823145531571242},{\"lon\":112.57332663570918,\"lat\":26.823144025991855},{\"lon\":112.57333875695714,\"lat\":26.823130823353114}],\"boundBox\":[{\"x\":1439.8624267578125,\"y\":893.4229736328125},{\"x\":1474.45361328125,\"y\":893.4229736328125},{\"x\":1474.45361328125,\"y\":966.433837890625},{\"x\":1439.8624267578125,\"y\":966.433837890625}],\"center\":{\"lon\":112.57332779256919,\"lat\":26.823144756804734}},{\"id\":1,\"type\":1,\"score\":87,\"polygon\":[{\"lon\":112.57339986657128,\"lat\":26.822898951544797},{\"lon\":112.5733716620538,\"lat\":26.822952992001163},{\"lon\":112.57336786188131,\"lat\":26.822949186370185},{\"lon\":112.57339561566401,\"lat\":26.822894141465785}],\"boundBox\":[{\"x\":2085.054443359375,\"y\":503.0662841796875},{\"x\":2116.11865234375,\"y\":503.0662841796875},{\"x\":2116.11865234375,\"y\":559.9113159179688},{\"x\":2085.054443359375,\"y\":559.9113159179688}],\"center\":{\"lon\":112.5733698249888,\"lat\":26.822951164464232}},{\"id\":2,\"type\":1,\"score\":71,\"polygon\":[{\"lon\":112.57342641528835,\"lat\":26.82293191667262},{\"lon\":112.57339610867105,\"lat\":26.82297860774548},{\"lon\":112.5733928192764,\"lat\":26.822975877911627},{\"lon\":112.57342270277888,\"lat\":26.822928610829003}],\"boundBox\":[{\"x\":1873.2490234375,\"y\":507.2391357421875},{\"x\":1900.5283203125,\"y\":507.2391357421875},{\"x\":1900.5283203125,\"y\":562.299560546875},{\"x\":1873.2490234375,\"y\":562.299560546875}],\"center\":{\"lon\":112.57339452365564,\"lat\":26.822977300519444}}],\"imgUrl\":\"http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/roadwork_image/2023-01-12/86447e30-2dfc-4a27-8d01-41ffe9a9a7fe_172_18_24_62.jpg?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%26q-sign-time%3D1673509757%3B1673516957%26q-key-time%3D1673509757%3B1673516957%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3D557de14ddfb999d35ddef9e23b3532d9d299c62f\",\"ip\":\"172.18.24.62\",\"score\":82,\"radius\":0,\"type\":1,\"createTime\":1673509757496,\"createTimeStr\":\"2023-01-12 15:49:17\"}" + //val road2 = "{\"poiType\":\"100061\",\"receiveTime\":1673509756306,\"detectTime\":1673509756290,\"id\":\"be6a2000-a96c-42c8-a7ef-f83388d84858\",\"index\":\"636136931493532287\",\"polygon\":[{\"lon\":112.5733515539896,\"lat\":26.823143145432386},{\"lon\":112.57335140084462,\"lat\":26.823142454672727},{\"lon\":112.57335096472467,\"lat\":26.823141869074952},{\"lon\":112.57335031202503,\"lat\":26.82314147779103},{\"lon\":112.57334954211333,\"lat\":26.82314134039038},{\"lon\":112.57334877220161,\"lat\":26.82314147779103},{\"lon\":112.573348119502,\"lat\":26.823141869074952},{\"lon\":112.57334768338202,\"lat\":26.823142454672727},{\"lon\":112.57334753023707,\"lat\":26.823143145432386},{\"lon\":112.57334768338202,\"lat\":26.82314383619207},{\"lon\":112.57334811950196,\"lat\":26.82314442178987},{\"lon\":112.5733487722016,\"lat\":26.823144813073792},{\"lon\":112.57334954211333,\"lat\":26.823144950474443},{\"lon\":112.57335031202504,\"lat\":26.823144813073792},{\"lon\":112.57335096472468,\"lat\":26.82314442178987},{\"lon\":112.57335140084464,\"lat\":26.82314383619207},{\"lon\":112.5733515539896,\"lat\":26.823143145432386}],\"polygonRoads\":[{\"tileId\":556834853,\"roadId\":\"130314\",\"laneNo\":-4,\"bearing\":332,\"roadName\":\"雁鸣路\"}],\"center\":{\"lon\":112.57334952644263,\"lat\":26.823143141971546},\"centerRoad\":{\"tileId\":556834853,\"roadId\":\"130314\",\"laneNo\":-4,\"bearing\":332,\"roadName\":\"雁鸣路\"},\"obstacles\":[{\"id\":0,\"type\":1,\"score\":72,\"polygon\":[{\"lon\":112.57341760772391,\"lat\":26.823104379136176},{\"lon\":112.57335121413183,\"lat\":26.82314367391432},{\"lon\":112.57334751791018,\"lat\":26.823142500693834},{\"lon\":112.57341321183773,\"lat\":26.82310322131963}],\"boundBox\":[{\"x\":1551.2252197265625,\"y\":352.58837890625},{\"x\":1562.4649658203125,\"y\":352.58837890625},{\"x\":1562.4649658203125,\"y\":376.17327880859375},{\"x\":1551.2252197265625,\"y\":376.17327880859375}],\"center\":{\"lon\":112.57334952644263,\"lat\":26.823143141971546}}],\"imgUrl\":\"http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/roadwork_image/2023-01-12/be6a2000-a96c-42c8-a7ef-f83388d84858_172_18_24_42.jpg?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%26q-sign-time%3D1673509758%3B1673516958%26q-key-time%3D1673509758%3B1673516958%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3Db2682464078ae53eae6e87f924abe17fa7c04ac8\",\"ip\":\"172.18.24.42\",\"score\":72,\"radius\":0,\"type\":1,\"createTime\":1673509758511,\"createTimeStr\":\"2023-01-12 15:49:18\"}" + val jingzhi1 = "{\"poiType\":\"100321\",\"detectTime\":1673506266924,\"id\":\"f7b1df85-895a-41c1-b05d-7356955c1c91\",\"index\":\"636136931493454271\",\"polygon\":[],\"center\":{\"lon\":112.57320982521519,\"lat\":26.82306821019599},\"centerRoad\":{\"tileId\":556834853,\"laneNo\":-2,\"bearing\":152},\"score\":95,\"radius\":0,\"type\":2}" + val jingzhi2 = "{\"poiType\":\"100321\",\"detectTime\":1673506266924,\"id\":\"f7b1df85-895a-41c1-b05d-7356955c1c91\",\"index\":\"636136931493454271\",\"polygon\":[],\"center\":{\"lon\":112.57320982521519,\"lat\":26.82306821019599},\"centerRoad\":{\"tileId\":556834853,\"laneNo\":-2,\"bearing\":152},\"score\":95,\"radius\":0,\"type\":2}" + val jingzhi3 = "{\"poiType\":\"100321\",\"detectTime\":1673506266924,\"id\":\"f7b1df85-895a-41c1-b05d-7356955c1c91\",\"index\":\"636136931493454271\",\"polygon\":[],\"center\":{\"lon\":112.57320982521519,\"lat\":26.82306821019599},\"centerRoad\":{\"tileId\":556834853,\"laneNo\":-2,\"bearing\":152},\"score\":95,\"radius\":0,\"type\":2}" + while (true) { + delay(1000) + //V2XEventManager.onAck(V2XEvent.RoadEventX(data = GsonUtils.fromJson(shigu, V2XRoadXData::class.java))) + V2XEventManager.onAck(V2XEvent.RoadEventX(data = GsonUtils.fromJson(road1, V2XRoadXData::class.java))) + // V2XEventManager.onAck(V2XEvent.RoadEventX(data = GsonUtils.fromJson(road2, V2XRoadXData::class.java))) + } + } + +} \ No newline at end of file diff --git a/app/src/androidTest/java/com/mogo/functions/test/RoadInfoTest.kt b/app/src/androidTest/java/com/mogo/functions/test/RoadInfoTest.kt new file mode 100644 index 0000000000..fbe4b68732 --- /dev/null +++ b/app/src/androidTest/java/com/mogo/functions/test/RoadInfoTest.kt @@ -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 + + @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> { + 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>() + var first = 0.0 + for ((index, data) in items.withIndex()) { + if ((index % 2) == 0) { + first = data + } else { + result.add(Pair(first, data)) + } + } + result + } + } +} diff --git a/config.gradle b/config.gradle index a7817ebe15..da325d0232 100644 --- a/config.gradle +++ b/config.gradle @@ -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", diff --git a/core/function-impl/mogo-core-function-biz/build.gradle b/core/function-impl/mogo-core-function-biz/build.gradle index b3d65170dc..84336e0873 100644 --- a/core/function-impl/mogo-core-function-biz/build.gradle +++ b/core/function-impl/mogo-core-function-biz/build.gradle @@ -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') diff --git a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/pnc/V2NIdentifyDrawer.kt b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/pnc/V2NIdentifyDrawer.kt index 8b908447c1..99908311bd 100644 --- a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/pnc/V2NIdentifyDrawer.kt +++ b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/pnc/V2NIdentifyDrawer.kt @@ -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().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().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): Int { + val left = occupy.first() + return if (laneId <= left.id) { + 1 + } else { + -1 + } + } + + private fun computeBestLane(laneId: Int, occupy: List, total: List): kotlin.Pair { + if (occupy.size == total.size) { + return kotlin.Pair(Int.MIN_VALUE, "更换路线") + } + val map = HashMap() + 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 -> { diff --git a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/scenario/scene/airoad/AiRoadMarker.kt b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/scenario/scene/airoad/AiRoadMarker.kt index 76679558ab..042caeb471 100644 --- a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/scenario/scene/airoad/AiRoadMarker.kt +++ b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/scenario/scene/airoad/AiRoadMarker.kt @@ -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}") } } diff --git a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/utils/V2NUtils.kt b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/utils/V2NUtils.kt new file mode 100644 index 0000000000..e233531b36 --- /dev/null +++ b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/utils/V2NUtils.kt @@ -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, point: Triple ,polygon: List>): 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() + 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, val occupy: List) +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/camera/CameraListAdapter.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/camera/CameraListAdapter.kt index 1086700744..bc6654f8f2 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/camera/CameraListAdapter.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/camera/CameraListAdapter.kt @@ -27,7 +27,7 @@ class CameraListAdapter : Adapter { } 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) } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/camera/RoadCrossLiveView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/camera/RoadCrossLiveView.kt index 4c6a5645e1..e2458d54fc 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/camera/RoadCrossLiveView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/camera/RoadCrossLiveView.kt @@ -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 = 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() } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt index 734ef44762..2f91d7394b 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt @@ -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) //展示状态中心 diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_cross_empty.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_cross_empty.xml new file mode 100644 index 0000000000..8e1b504558 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_cross_empty.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_cross_live.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_cross_live.png new file mode 100644 index 0000000000..42af8a287b Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_cross_live.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_cross_live_close.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_cross_live_close.png new file mode 100644 index 0000000000..d592593a94 Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_cross_live_close.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_cross_logo.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_cross_logo.png new file mode 100644 index 0000000000..77e13291f0 Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_cross_logo.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_cross_xiaozhi.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_cross_xiaozhi.png new file mode 100644 index 0000000000..09be529bb4 Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_cross_xiaozhi.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_road_cross_live.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_road_cross_live.xml index 77d9ef65f8..2b14e7825f 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_road_cross_live.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_road_cross_live.xml @@ -1,6 +1,82 @@ + android:layout_height="match_parent" + android:background="@drawable/bg_road_cross_live"> + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_road_cross_live_light.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_road_cross_live_light.xml new file mode 100644 index 0000000000..77d9ef65f8 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_road_cross_live_light.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml index 6fc9b21ea4..3c93ad9148 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml @@ -23,6 +23,8 @@ #2C2E30 #2D3E5F #D4D8DC + #50E8E4 + #252B3F #27FFFFFF #1E111111 #FF213757 diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/values/strings.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/values/strings.xml index 89388ccc15..12e5014d93 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/values/strings.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/values/strings.xml @@ -127,4 +127,6 @@ 正在为您探查前方道路 自动探索关闭按钮 + + 蘑菇为您实时护航中,请放心驾驶! diff --git a/core/function-impl/mogo-core-function-map/build.gradle b/core/function-impl/mogo-core-function-map/build.gradle index 98174911b9..fc45801307 100644 --- a/core/function-impl/mogo-core-function-map/build.gradle +++ b/core/function-impl/mogo-core-function-map/build.gradle @@ -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') diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/roadcross/RoadCrossCameraManager.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/roadcross/RoadCrossCameraManager.kt index d543ce1d30..75c4f9b6e8 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/roadcross/RoadCrossCameraManager.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/roadcross/RoadCrossCameraManager.kt @@ -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() diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/roadcross/net/INDERoadCameraApiService.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/roadcross/net/INDERoadCameraApiService.kt index 2b85b89edb..32b7724535 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/roadcross/net/INDERoadCameraApiService.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/roadcross/net/INDERoadCameraApiService.kt @@ -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> // 单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 // 批量ip查询设备直播流与缩略图 diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/roadcross/net/NDERoadCameraNetWorkModel.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/roadcross/net/NDERoadCameraNetWorkModel.kt index 299ab9e6c9..5a406db1cf 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/roadcross/net/NDERoadCameraNetWorkModel.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/roadcross/net/NDERoadCameraNetWorkModel.kt @@ -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) diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/routeoverlay/RouteOverlayDrawer.java b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/routeoverlay/RouteOverlayDrawer.java index e162b3eadd..0c7fc24dde 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/routeoverlay/RouteOverlayDrawer.java +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/routeoverlay/RouteOverlayDrawer.java @@ -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) { diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/CameraMarkerView.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/CameraMarkerView.kt index 75bb869254..0a75e46c92 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/CameraMarkerView.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/CameraMarkerView.kt @@ -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) { diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/MapBizView.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/MapBizView.kt index b084403520..2785c8369c 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/MapBizView.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/MapBizView.kt @@ -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 } diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/MapRoamView.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/MapRoamView.kt new file mode 100644 index 0000000000..6928c87050 --- /dev/null +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/MapRoamView.kt @@ -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() + } + +} diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/RoadCrossRoamListAdapter.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/RoadCrossRoamListAdapter.kt new file mode 100644 index 0000000000..4549e9f24f --- /dev/null +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/RoadCrossRoamListAdapter.kt @@ -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() { + + private val items: MutableList = 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) + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/RoadCrossRoamView.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/RoadCrossRoamView.kt new file mode 100644 index 0000000000..fd7f563fcd --- /dev/null +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/RoadCrossRoamView.kt @@ -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) + } + + +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-map/src/main/res/drawable-nodpi/bg_road_cross_roam.png b/core/function-impl/mogo-core-function-map/src/main/res/drawable-nodpi/bg_road_cross_roam.png new file mode 100644 index 0000000000..205b0efaae Binary files /dev/null and b/core/function-impl/mogo-core-function-map/src/main/res/drawable-nodpi/bg_road_cross_roam.png differ diff --git a/core/function-impl/mogo-core-function-map/src/main/res/drawable-nodpi/bg_road_roam_xiaozhi.png b/core/function-impl/mogo-core-function-map/src/main/res/drawable-nodpi/bg_road_roam_xiaozhi.png new file mode 100644 index 0000000000..5380e77405 Binary files /dev/null and b/core/function-impl/mogo-core-function-map/src/main/res/drawable-nodpi/bg_road_roam_xiaozhi.png differ diff --git a/core/function-impl/mogo-core-function-map/src/main/res/drawable-nodpi/icon_cover_road_roam.png b/core/function-impl/mogo-core-function-map/src/main/res/drawable-nodpi/icon_cover_road_roam.png new file mode 100644 index 0000000000..7e10b9506c Binary files /dev/null and b/core/function-impl/mogo-core-function-map/src/main/res/drawable-nodpi/icon_cover_road_roam.png differ diff --git a/core/function-impl/mogo-core-function-map/src/main/res/drawable-nodpi/icon_road_roam_close.png b/core/function-impl/mogo-core-function-map/src/main/res/drawable-nodpi/icon_road_roam_close.png new file mode 100644 index 0000000000..3e9242089b Binary files /dev/null and b/core/function-impl/mogo-core-function-map/src/main/res/drawable-nodpi/icon_road_roam_close.png differ diff --git a/core/function-impl/mogo-core-function-map/src/main/res/drawable-nodpi/icon_road_roam_progress.png b/core/function-impl/mogo-core-function-map/src/main/res/drawable-nodpi/icon_road_roam_progress.png new file mode 100644 index 0000000000..e77f8fb2b5 Binary files /dev/null and b/core/function-impl/mogo-core-function-map/src/main/res/drawable-nodpi/icon_road_roam_progress.png differ diff --git a/core/function-impl/mogo-core-function-map/src/main/res/drawable-nodpi/icon_road_roam_tip.png b/core/function-impl/mogo-core-function-map/src/main/res/drawable-nodpi/icon_road_roam_tip.png new file mode 100644 index 0000000000..f678d1bdb4 Binary files /dev/null and b/core/function-impl/mogo-core-function-map/src/main/res/drawable-nodpi/icon_road_roam_tip.png differ diff --git a/core/function-impl/mogo-core-function-map/src/main/res/layout/item_road_cross_roam_tip.xml b/core/function-impl/mogo-core-function-map/src/main/res/layout/item_road_cross_roam_tip.xml new file mode 100644 index 0000000000..ea672c1bd6 --- /dev/null +++ b/core/function-impl/mogo-core-function-map/src/main/res/layout/item_road_cross_roam_tip.xml @@ -0,0 +1,37 @@ + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-map/src/main/res/layout/view_road_cross_roam.xml b/core/function-impl/mogo-core-function-map/src/main/res/layout/view_road_cross_roam.xml new file mode 100644 index 0000000000..e7a728e41a --- /dev/null +++ b/core/function-impl/mogo-core-function-map/src/main/res/layout/view_road_cross_roam.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-map/src/main/res/layout/view_road_cross_roam_light.xml b/core/function-impl/mogo-core-function-map/src/main/res/layout/view_road_cross_roam_light.xml new file mode 100644 index 0000000000..77d9ef65f8 --- /dev/null +++ b/core/function-impl/mogo-core-function-map/src/main/res/layout/view_road_cross_roam_light.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-map/src/main/res/values/strings.xml b/core/function-impl/mogo-core-function-map/src/main/res/values/strings.xml index d32a85d33b..8a72f3e813 100644 --- a/core/function-impl/mogo-core-function-map/src/main/res/values/strings.xml +++ b/core/function-impl/mogo-core-function-map/src/main/res/values/strings.xml @@ -1,3 +1,4 @@ mogo-core-function-map + 前方即将进入全息路口\n为您全面扫描潜在风险 diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/road/IMoGoMapRoadListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/road/IMoGoMapRoadListener.kt index 1110d437a1..43f8394d74 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/road/IMoGoMapRoadListener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/road/IMoGoMapRoadListener.kt @@ -17,5 +17,6 @@ interface IMoGoMapRoadListener { fun onCrossLiveInfo(info: RoadCameraLive) {} + fun onRoadCrossClick() {} } \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapRoadListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapRoadListenerManager.kt index 4cd26da1c5..17c4344fcd 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapRoadListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapRoadListenerManager.kt @@ -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() { 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() { } } - fun getCrossInfo(): RoadCross? { - return mRoadCross + fun getCrossEndInfo(): String? { + return mRoadCross?.cross_id_end + } + + fun getStopLineLatLng(): Pair? { + return if (mStopLine == null) { + null + } else { + Pair(mStopLine!!.points[0].latitude, mStopLine!!.points[0].longitude) + } } @ChainLog( @@ -77,13 +86,19 @@ object CallerMapRoadListenerManager : CallerBase() { } + 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) } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/setting/CallerSkinModeListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/setting/CallerSkinModeListenerManager.kt index a103e18f3f..e3776ecf71 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/setting/CallerSkinModeListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/setting/CallerSkinModeListenerManager.kt @@ -25,4 +25,8 @@ object CallerSkinModeListenerManager : CallerBase() } } + fun getMode():Int{ + return CallerMoGoUiSettingManager.getDayMode() + } + } \ No newline at end of file diff --git a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/media/video/SimpleVideoPlayer.kt b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/media/video/SimpleVideoPlayer.kt index b86812d443..1a001491fb 100644 --- a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/media/video/SimpleVideoPlayer.kt +++ b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/media/video/SimpleVideoPlayer.kt @@ -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 + } + } } \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/logics/location/MyLocationStyle.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/logics/location/MyLocationStyle.kt index 003b407bde..9c6dcc51f4 100644 --- a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/logics/location/MyLocationStyle.kt +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/logics/location/MyLocationStyle.kt @@ -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) } diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/renders/marker/BitmapDescriptorFactory.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/renders/marker/BitmapDescriptorFactory.kt index 78c0d6e665..c3558c4288 100644 --- a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/renders/marker/BitmapDescriptorFactory.kt +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/renders/marker/BitmapDescriptorFactory.kt @@ -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); diff --git a/libraries/mogo-map-api/src/main/java/com/mogo/map/IMogoData.kt b/libraries/mogo-map-api/src/main/java/com/mogo/map/IMogoData.kt index 7600780ab9..f955786acf 100644 --- a/libraries/mogo-map-api/src/main/java/com/mogo/map/IMogoData.kt +++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/IMogoData.kt @@ -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 } \ No newline at end of file diff --git a/libraries/mogo-map-api/src/main/java/com/mogo/map/MogoMap.kt b/libraries/mogo-map-api/src/main/java/com/mogo/map/MogoMap.kt index da6ff519fa..e26b3a4341 100644 --- a/libraries/mogo-map-api/src/main/java/com/mogo/map/MogoMap.kt +++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/MogoMap.kt @@ -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) { diff --git a/libraries/mogo-map-api/src/main/java/com/mogo/map/entities/Lane.kt b/libraries/mogo-map-api/src/main/java/com/mogo/map/entities/Lane.kt new file mode 100644 index 0000000000..35127751f0 --- /dev/null +++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/entities/Lane.kt @@ -0,0 +1,3 @@ +package com.mogo.map.entities + +data class Lane(val id: Int, val width: Float, val points: List>) diff --git a/libraries/mogo-map-api/src/main/java/com/mogo/map/entities/RoadInfo.kt b/libraries/mogo-map-api/src/main/java/com/mogo/map/entities/RoadInfo.kt new file mode 100644 index 0000000000..7724537a6e --- /dev/null +++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/entities/RoadInfo.kt @@ -0,0 +1,3 @@ +package com.mogo.map.entities + +data class RoadInfo(val code: Int, val tileId: Long, val roadId: Int, val roadName: String) diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.kt b/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.kt index ea1b279ba8..78b3717fd5 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.kt +++ b/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.kt @@ -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!!) } } diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/AMapWrapper.kt b/libraries/mogo-map/src/main/java/com/mogo/map/AMapWrapper.kt index 4d7c0a0c29..bebd043d44 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/AMapWrapper.kt +++ b/libraries/mogo-map/src/main/java/com/mogo/map/AMapWrapper.kt @@ -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?) { diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/MapDataWrapper.kt b/libraries/mogo-map/src/main/java/com/mogo/map/MapDataWrapper.kt index 95e34456e1..f3cc47865a 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/MapDataWrapper.kt +++ b/libraries/mogo-map/src/main/java/com/mogo/map/MapDataWrapper.kt @@ -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 { + 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 { + return MapDataApi.getLaneInfo(tileId, roadId)?.map { itx -> + Lane(itx.laneId, itx.laneWidth, itx.laneLatLonPoints.map { Pair(it.longitude, it.latitude) }) + } ?: emptyList() + } } \ No newline at end of file diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapView.kt b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapView.kt index 36e0efdfca..ff227c23ef 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapView.kt +++ b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapView.kt @@ -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") diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/uicontroller/AMapUIController.java b/libraries/mogo-map/src/main/java/com/mogo/map/uicontroller/AMapUIController.java deleted file mode 100644 index e69de29bb2..0000000000