From 1f06c9a89e2a3f293edaebcc18a19a4983a8a150 Mon Sep 17 00:00:00 2001 From: renwj Date: Thu, 27 Jun 2024 16:56:21 +0800 Subject: [PATCH] =?UTF-8?q?[6.5.0][=E9=81=93=E8=B7=AF=E4=BA=8B=E4=BB=B6]?= =?UTF-8?q?=20=E9=83=A8=E5=88=86=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 1 + app/src/androidTest/assets/polygon.txt | 1 + .../com/mogo/functions/test/RoadAITest.kt | 340 +++++++++--------- .../com/mogo/functions/test/RoadInfoTest.kt | 113 ++++++ config.gradle | 5 +- .../mogo-core-function-biz/build.gradle | 3 +- .../biz/v2x/v2n/pnc/V2NIdentifyDrawer.kt | 140 ++++++-- .../v2n/scenario/scene/airoad/AiRoadMarker.kt | 9 +- .../function/biz/v2x/v2n/utils/V2NUtils.kt | 45 +++ .../routeoverlay/RouteOverlayDrawer.java | 8 +- .../src/main/java/com/mogo/map/IMogoData.kt | 11 + .../main/java/com/mogo/map/entities/Lane.kt | 3 + .../java/com/mogo/map/entities/RoadInfo.kt | 3 + .../main/java/com/mogo/map/MapDataWrapper.kt | 30 ++ 14 files changed, 505 insertions(+), 207 deletions(-) create mode 100644 app/src/androidTest/assets/polygon.txt create mode 100644 app/src/androidTest/java/com/mogo/functions/test/RoadInfoTest.kt create mode 100644 core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/utils/V2NUtils.kt create mode 100644 libraries/mogo-map-api/src/main/java/com/mogo/map/entities/Lane.kt create mode 100644 libraries/mogo-map-api/src/main/java/com/mogo/map/entities/RoadInfo.kt diff --git a/app/build.gradle b/app/build.gradle index 0cdd1b7736..b56c984701 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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-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/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/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/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