From fb789814d36ddd7595db259002dec5df94089700 Mon Sep 17 00:00:00 2001 From: xiaoyan Date: Thu, 28 Sep 2023 14:31:17 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E7=AE=AD=E5=A4=B4?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E5=86=85=E8=BE=B9=E8=B7=9D=EF=BC=8C=E9=83=A8?= =?UTF-8?q?=E5=88=86=E8=A7=A3=E5=86=B3=E5=87=BA=E7=8E=B0=E5=BC=82=E5=BD=A2?= =?UTF-8?q?=E5=BD=A2=E7=8A=B6=E6=97=B6=E8=B4=B4=E5=9B=BE=E4=B8=8D=E5=AE=8C?= =?UTF-8?q?=E5=85=A8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- collect-library/src/main/assets/omdb/arrowDirection/1.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/10.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/1025.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/1026.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/1027.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/1028.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/1029.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/1032.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/11.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/12.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/128.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/13.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/14.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/1536.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/16.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/17.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/2.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/2048.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/256.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/3.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/32.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/4.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/4096.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/5.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/513.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/514.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/515.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/516.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/517.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/520.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/6.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/64.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/65.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/66.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/69.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/7.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/8.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/9.svg | 2 +- collect-library/src/main/assets/omdb/arrowDirection/test.svg | 2 +- vtm | 2 +- 40 files changed, 40 insertions(+), 40 deletions(-) diff --git a/collect-library/src/main/assets/omdb/arrowDirection/1.svg b/collect-library/src/main/assets/omdb/arrowDirection/1.svg index b6309773..ab21f09b 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/1.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/1.svg @@ -10,7 +10,7 @@ - + diff --git a/collect-library/src/main/assets/omdb/arrowDirection/10.svg b/collect-library/src/main/assets/omdb/arrowDirection/10.svg index 997e5a2c..6d29fbe8 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/10.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/10.svg @@ -6,7 +6,7 @@ - + diff --git a/collect-library/src/main/assets/omdb/arrowDirection/1025.svg b/collect-library/src/main/assets/omdb/arrowDirection/1025.svg index f5d83583..04372e47 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/1025.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/1025.svg @@ -6,7 +6,7 @@ - + diff --git a/collect-library/src/main/assets/omdb/arrowDirection/1026.svg b/collect-library/src/main/assets/omdb/arrowDirection/1026.svg index 47afaa40..66074edd 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/1026.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/1026.svg @@ -6,7 +6,7 @@ - + diff --git a/collect-library/src/main/assets/omdb/arrowDirection/1027.svg b/collect-library/src/main/assets/omdb/arrowDirection/1027.svg index 0332107e..50f51569 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/1027.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/1027.svg @@ -6,7 +6,7 @@ - + diff --git a/collect-library/src/main/assets/omdb/arrowDirection/1028.svg b/collect-library/src/main/assets/omdb/arrowDirection/1028.svg index f950ad4a..87a5b5b1 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/1028.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/1028.svg @@ -6,7 +6,7 @@ - + diff --git a/collect-library/src/main/assets/omdb/arrowDirection/1029.svg b/collect-library/src/main/assets/omdb/arrowDirection/1029.svg index ca19abf8..bcf69af1 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/1029.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/1029.svg @@ -6,7 +6,7 @@ - + diff --git a/collect-library/src/main/assets/omdb/arrowDirection/1032.svg b/collect-library/src/main/assets/omdb/arrowDirection/1032.svg index 71fcf524..57d2e275 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/1032.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/1032.svg @@ -6,7 +6,7 @@ - + diff --git a/collect-library/src/main/assets/omdb/arrowDirection/11.svg b/collect-library/src/main/assets/omdb/arrowDirection/11.svg index 776dec2f..1675ca4d 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/11.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/11.svg @@ -10,7 +10,7 @@ - + diff --git a/collect-library/src/main/assets/omdb/arrowDirection/12.svg b/collect-library/src/main/assets/omdb/arrowDirection/12.svg index 2808334e..500eb5aa 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/12.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/12.svg @@ -6,7 +6,7 @@ - + diff --git a/collect-library/src/main/assets/omdb/arrowDirection/128.svg b/collect-library/src/main/assets/omdb/arrowDirection/128.svg index ef00f92a..b349fadf 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/128.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/128.svg @@ -6,7 +6,7 @@ - + diff --git a/collect-library/src/main/assets/omdb/arrowDirection/13.svg b/collect-library/src/main/assets/omdb/arrowDirection/13.svg index 2f52b5d9..40db1c91 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/13.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/13.svg @@ -10,7 +10,7 @@ - + diff --git a/collect-library/src/main/assets/omdb/arrowDirection/14.svg b/collect-library/src/main/assets/omdb/arrowDirection/14.svg index 34714d8d..4e0bbba8 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/14.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/14.svg @@ -6,7 +6,7 @@ - + diff --git a/collect-library/src/main/assets/omdb/arrowDirection/1536.svg b/collect-library/src/main/assets/omdb/arrowDirection/1536.svg index da36d14d..11c8efe8 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/1536.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/1536.svg @@ -6,7 +6,7 @@ - + diff --git a/collect-library/src/main/assets/omdb/arrowDirection/16.svg b/collect-library/src/main/assets/omdb/arrowDirection/16.svg index fa97503c..f0a543d3 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/16.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/16.svg @@ -6,7 +6,7 @@ - + diff --git a/collect-library/src/main/assets/omdb/arrowDirection/17.svg b/collect-library/src/main/assets/omdb/arrowDirection/17.svg index 67721acd..0aa4f8f8 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/17.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/17.svg @@ -6,7 +6,7 @@ - + diff --git a/collect-library/src/main/assets/omdb/arrowDirection/2.svg b/collect-library/src/main/assets/omdb/arrowDirection/2.svg index 51b45c35..a6a178e3 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/2.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/2.svg @@ -6,7 +6,7 @@ - + diff --git a/collect-library/src/main/assets/omdb/arrowDirection/2048.svg b/collect-library/src/main/assets/omdb/arrowDirection/2048.svg index 4c36bca5..722a6f0a 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/2048.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/2048.svg @@ -6,7 +6,7 @@ - + diff --git a/collect-library/src/main/assets/omdb/arrowDirection/256.svg b/collect-library/src/main/assets/omdb/arrowDirection/256.svg index 8b9d0506..f18d7501 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/256.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/256.svg @@ -6,7 +6,7 @@ - + diff --git a/collect-library/src/main/assets/omdb/arrowDirection/3.svg b/collect-library/src/main/assets/omdb/arrowDirection/3.svg index 70d151fa..50906d77 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/3.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/3.svg @@ -10,7 +10,7 @@ - + diff --git a/collect-library/src/main/assets/omdb/arrowDirection/32.svg b/collect-library/src/main/assets/omdb/arrowDirection/32.svg index 76982ae0..9efde649 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/32.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/32.svg @@ -6,7 +6,7 @@ - + diff --git a/collect-library/src/main/assets/omdb/arrowDirection/4.svg b/collect-library/src/main/assets/omdb/arrowDirection/4.svg index af5b7770..7169274e 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/4.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/4.svg @@ -6,7 +6,7 @@ - + diff --git a/collect-library/src/main/assets/omdb/arrowDirection/4096.svg b/collect-library/src/main/assets/omdb/arrowDirection/4096.svg index 4fea3c82..5a4c38f0 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/4096.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/4096.svg @@ -6,7 +6,7 @@ - + X diff --git a/collect-library/src/main/assets/omdb/arrowDirection/5.svg b/collect-library/src/main/assets/omdb/arrowDirection/5.svg index 69b2dc1d..78b63583 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/5.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/5.svg @@ -6,7 +6,7 @@ - + diff --git a/collect-library/src/main/assets/omdb/arrowDirection/513.svg b/collect-library/src/main/assets/omdb/arrowDirection/513.svg index e807a30a..565001c0 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/513.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/513.svg @@ -6,7 +6,7 @@ - + diff --git a/collect-library/src/main/assets/omdb/arrowDirection/514.svg b/collect-library/src/main/assets/omdb/arrowDirection/514.svg index b8009126..4f9969f1 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/514.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/514.svg @@ -6,7 +6,7 @@ - + diff --git a/collect-library/src/main/assets/omdb/arrowDirection/515.svg b/collect-library/src/main/assets/omdb/arrowDirection/515.svg index b6a8529e..e70c0ef5 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/515.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/515.svg @@ -6,7 +6,7 @@ - + diff --git a/collect-library/src/main/assets/omdb/arrowDirection/516.svg b/collect-library/src/main/assets/omdb/arrowDirection/516.svg index 47e7e825..65695e59 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/516.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/516.svg @@ -5,7 +5,7 @@ Created with Sketch. - + diff --git a/collect-library/src/main/assets/omdb/arrowDirection/517.svg b/collect-library/src/main/assets/omdb/arrowDirection/517.svg index 3c06e6cd..5953b621 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/517.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/517.svg @@ -6,7 +6,7 @@ - + diff --git a/collect-library/src/main/assets/omdb/arrowDirection/520.svg b/collect-library/src/main/assets/omdb/arrowDirection/520.svg index dc201de2..6c91c9f7 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/520.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/520.svg @@ -6,7 +6,7 @@ - + diff --git a/collect-library/src/main/assets/omdb/arrowDirection/6.svg b/collect-library/src/main/assets/omdb/arrowDirection/6.svg index ee40261a..437f8629 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/6.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/6.svg @@ -6,7 +6,7 @@ - + diff --git a/collect-library/src/main/assets/omdb/arrowDirection/64.svg b/collect-library/src/main/assets/omdb/arrowDirection/64.svg index 402f065a..afdc3810 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/64.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/64.svg @@ -6,7 +6,7 @@ - + diff --git a/collect-library/src/main/assets/omdb/arrowDirection/65.svg b/collect-library/src/main/assets/omdb/arrowDirection/65.svg index 1d20e061..1aa1162a 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/65.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/65.svg @@ -12,7 +12,7 @@ - + diff --git a/collect-library/src/main/assets/omdb/arrowDirection/66.svg b/collect-library/src/main/assets/omdb/arrowDirection/66.svg index a2fa5046..dcb6e509 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/66.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/66.svg @@ -6,7 +6,7 @@ - + diff --git a/collect-library/src/main/assets/omdb/arrowDirection/69.svg b/collect-library/src/main/assets/omdb/arrowDirection/69.svg index aeb0ab3c..23fe2c52 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/69.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/69.svg @@ -6,7 +6,7 @@ - + diff --git a/collect-library/src/main/assets/omdb/arrowDirection/7.svg b/collect-library/src/main/assets/omdb/arrowDirection/7.svg index 3cb83ead..db22dd9a 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/7.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/7.svg @@ -11,7 +11,7 @@ - + diff --git a/collect-library/src/main/assets/omdb/arrowDirection/8.svg b/collect-library/src/main/assets/omdb/arrowDirection/8.svg index d9e21f19..71538c78 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/8.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/8.svg @@ -9,7 +9,7 @@ - + diff --git a/collect-library/src/main/assets/omdb/arrowDirection/9.svg b/collect-library/src/main/assets/omdb/arrowDirection/9.svg index 8e6c6b3b..dcc39cb2 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/9.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/9.svg @@ -9,7 +9,7 @@ - + diff --git a/collect-library/src/main/assets/omdb/arrowDirection/test.svg b/collect-library/src/main/assets/omdb/arrowDirection/test.svg index ef91d67e..3c3f985c 100644 --- a/collect-library/src/main/assets/omdb/arrowDirection/test.svg +++ b/collect-library/src/main/assets/omdb/arrowDirection/test.svg @@ -6,7 +6,7 @@ - + diff --git a/vtm b/vtm index c046e788..50f7b028 160000 --- a/vtm +++ b/vtm @@ -1 +1 @@ -Subproject commit c046e788f5c739612a31c308639fca2de639669a +Subproject commit 50f7b028e7f3934a8c330ea8a54046d7d368682d From fc92cebe4aea4ae2e37119c1c4298351e9481d5d Mon Sep 17 00:00:00 2001 From: squallzhjch Date: Mon, 9 Oct 2023 10:44:42 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AF=BC=E6=B5=81?= =?UTF-8?q?=E5=8C=BA=E8=AF=A6=E6=83=85=E5=B1=95=E7=A4=BA=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=95=B0=E6=8D=AE=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=20=E4=BF=AE=E6=94=B9=E6=95=B0=E6=8D=AE=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E5=8A=A8=E6=80=81=E5=8F=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/navinfo/omqs/db/RealmOperateHelper.kt | 46 +++-- .../omqs/ui/activity/map/MainViewModel.kt | 34 ++-- .../EvaluationResultViewModel.kt | 5 +- .../personalcenter/PersonalCenterViewModel.kt | 6 +- .../omqs/ui/fragment/tasklist/TaskFragment.kt | 6 + .../ui/fragment/tasklist/TaskListAdapter.kt | 21 +- .../ui/fragment/tasklist/TaskViewModel.kt | 184 ++++++++---------- .../java/com/navinfo/omqs/util/SignUtil.kt | 22 +++ 8 files changed, 170 insertions(+), 154 deletions(-) diff --git a/app/src/main/java/com/navinfo/omqs/db/RealmOperateHelper.kt b/app/src/main/java/com/navinfo/omqs/db/RealmOperateHelper.kt index ad64e48f..b00471db 100644 --- a/app/src/main/java/com/navinfo/omqs/db/RealmOperateHelper.kt +++ b/app/src/main/java/com/navinfo/omqs/db/RealmOperateHelper.kt @@ -39,6 +39,7 @@ class RealmOperateHelper() { * */ @RequiresApi(Build.VERSION_CODES.N) suspend fun queryLink( + realm: Realm, point: GeoPoint, buffer: Double = DEFAULT_BUFFER, bufferType: BUFFER_TYPE = DEFAULT_BUFFER_TYPE, @@ -63,9 +64,9 @@ class RealmOperateHelper() { val yStart = tileYSet.stream().min(Comparator.naturalOrder()).orElse(null) val yEnd = tileYSet.stream().max(Comparator.naturalOrder()).orElse(null) // 查询realm中对应tile号的数据 - val realm = getSelectTaskRealmInstance() +// val realm = getSelectTaskRealmInstance() val realmList = - getSelectTaskRealmTools(RenderEntity::class.java, false) + getSelectTaskRealmTools(realm, RenderEntity::class.java, false) .equalTo("table", DataCodeEnum.OMDB_LINK_DIRECT.name) .greaterThanOrEqualTo("tileX", xStart) .lessThanOrEqualTo("tileX", xEnd) @@ -74,7 +75,7 @@ class RealmOperateHelper() { .findAll() // 将获取到的数据和查询的polygon做相交,只返回相交的数据 val dataList = realm.copyFromRealm(realmList) - realm.close() +// realm.close() val queryResult = dataList?.stream()?.filter { polygon.intersects(it.wkt) @@ -132,7 +133,7 @@ class RealmOperateHelper() { val yEnd = tileYSet.stream().max(Comparator.naturalOrder()).orElse(null) // 查询realm中对应tile号的数据 val realm = getSelectTaskRealmInstance() - val realmList = getSelectTaskRealmTools(RenderEntity::class.java, true) + val realmList = getSelectTaskRealmTools(realm, RenderEntity::class.java, true) .equalTo("table", table) .greaterThanOrEqualTo("tileX", xStart) .lessThanOrEqualTo("tileX", xEnd) @@ -228,12 +229,14 @@ class RealmOperateHelper() { return qsRecordBean } - suspend fun queryLinkToMutableRenderEntityList(linkPid: String): MutableList? { + suspend fun queryLinkToMutableRenderEntityList( + realm: Realm, + linkPid: String + ): MutableList? { val resultList = mutableListOf() +// val realm = getSelectTaskRealmInstance() - val realm = getSelectTaskRealmInstance() - - val realmR = getSelectTaskRealmTools(RenderEntity::class.java, true) + val realmR = getSelectTaskRealmTools(realm, RenderEntity::class.java, true) .equalTo("properties['${LinkTable.linkPid}']", linkPid).findAll() val dataList = realm.copyFromRealm(realmR) @@ -242,7 +245,7 @@ class RealmOperateHelper() { resultList.add(it) } - realm.close() +// realm.close() return resultList } @@ -280,7 +283,7 @@ class RealmOperateHelper() { val yEnd = tileYSet.stream().max(Comparator.naturalOrder()).orElse(null) val realm = getSelectTaskRealmInstance() var realmList = mutableListOf() - val realmQuery = getSelectTaskRealmTools(RenderEntity::class.java, false) + val realmQuery = getSelectTaskRealmTools(realm, RenderEntity::class.java, false) .greaterThanOrEqualTo("tileX", xStart) .lessThanOrEqualTo("tileX", xEnd) .greaterThanOrEqualTo("tileY", yStart) @@ -299,10 +302,12 @@ class RealmOperateHelper() { } // 将获取到的数据和查询的polygon做相交,只返回相交的数据 val queryResult = realmList?.stream()?.filter { - if(Constant.MapCatchLine){ - polygon.intersects(it.wkt) && it.wkt?.geometryType?.uppercase().equals("LINESTRING")||it.wkt?.geometryType?.uppercase().equals("POLYGON") - }else{ - polygon.intersects(it.wkt) && it.wkt?.geometryType?.uppercase().equals("POINT")||it.wkt?.geometryType?.uppercase().equals("POLYGON") + if (Constant.MapCatchLine) { + polygon.intersects(it.wkt) && it.wkt?.geometryType?.uppercase() + .equals("LINESTRING") || it.wkt?.geometryType?.uppercase().equals("POLYGON") + } else { + polygon.intersects(it.wkt) && it.wkt?.geometryType?.uppercase() + .equals("POINT") || it.wkt?.geometryType?.uppercase().equals("POLYGON") } }?.toList() queryResult?.let { @@ -323,15 +328,13 @@ class RealmOperateHelper() { * @param bufferType 点位外扩距离的单位: 米-Meter,像素-PIXEL * @param sort 是否需要排序 * */ - suspend fun queryLinkByLinkPid(linkPid: String): MutableList { + suspend fun queryLinkByLinkPid(realm: Realm,linkPid: String): MutableList { val result = mutableListOf() - val realm = getSelectTaskRealmInstance() - val realmList = getSelectTaskRealmTools(RenderEntity::class.java, false) + val realmList = getSelectTaskRealmTools(realm, RenderEntity::class.java, false) .notEqualTo("table", DataCodeEnum.OMDB_RD_LINK.name) .equalTo("properties['${LinkTable.linkPid}']", linkPid) .findAll() result.addAll(realm.copyFromRealm(realmList)) - realm.close() return result } @@ -426,19 +429,20 @@ class RealmOperateHelper() { fun getSelectTaskRealmTools( + realm: Realm, clazz: Class, enableSql: Boolean ): RealmQuery { - var realmQuery = getSelectTaskRealmInstance().where(clazz) + val realmQuery = realm.where(clazz) if (MapParamUtils.getDataLayerEnum() != null) { if (enableSql) { var sql = " enable${MapParamUtils.getDataLayerEnum().sql}" - getSelectTaskRealmInstance().where(clazz).rawPredicate(sql) + realm.where(clazz).rawPredicate(sql) } } - if(clazz.name==RenderEntity::class.jvmName){ + if (clazz.name == RenderEntity::class.jvmName) { // 筛选不显示的数据 if (com.navinfo.collect.library.system.Constant.HAD_LAYER_INVISIABLE_ARRAY != null && com.navinfo.collect.library.system.Constant.HAD_LAYER_INVISIABLE_ARRAY.size > 0) { realmQuery.beginGroup() diff --git a/app/src/main/java/com/navinfo/omqs/ui/activity/map/MainViewModel.kt b/app/src/main/java/com/navinfo/omqs/ui/activity/map/MainViewModel.kt index 9eb1a23e..13195a8a 100644 --- a/app/src/main/java/com/navinfo/omqs/ui/activity/map/MainViewModel.kt +++ b/app/src/main/java/com/navinfo/omqs/ui/activity/map/MainViewModel.kt @@ -50,17 +50,11 @@ import io.realm.Realm import io.realm.RealmConfiguration import io.realm.RealmSet import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.delay -import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.collectLatest -import kotlinx.coroutines.flow.flow import kotlinx.coroutines.launch import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.withContext -import org.locationtech.jts.geom.Envelope import org.locationtech.jts.geom.Geometry -import org.locationtech.jts.geom.LineString -import org.locationtech.spatial4j.shape.Rectangle import org.oscim.core.GeoPoint import org.oscim.core.MapPosition import org.oscim.map.Map @@ -637,7 +631,7 @@ class MainViewModel @Inject constructor( private suspend fun captureItem(point: GeoPoint) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { var buffer = 3.2 - if(mapController.mMapView.mapLevel>=18){ + if (mapController.mMapView.mapLevel >= 18) { buffer = 2.0 } val itemList = realmOperateHelper.queryElement( @@ -677,9 +671,9 @@ class MainViewModel @Inject constructor( val topSignList = mutableListOf() mapController.lineHandler.linksLayer.clear() if (linkIdCache != route.linkId) { - + val realm = realmOperateHelper.getSelectTaskRealmInstance() mapController.lineHandler.showLine(route.pointList) - var elementList = realmOperateHelper.queryLinkByLinkPid(route.linkId) + val elementList = realmOperateHelper.queryLinkByLinkPid(realm, route.linkId) for (element in elementList) { when (element.code) { @@ -749,6 +743,7 @@ class MainViewModel @Inject constructor( speakMode?.speakText(speechText) } linkIdCache = route.linkId ?: "" + realm.close() } } } catch (e: Exception) { @@ -769,8 +764,8 @@ class MainViewModel @Inject constructor( captureLinkState = true if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - - val linkList = realmOperateHelper.queryLink(point = point) + val realm = realmOperateHelper.getSelectTaskRealmInstance() + val linkList = realmOperateHelper.queryLink(realm, point = point) var hisRoadName = false @@ -807,7 +802,8 @@ class MainViewModel @Inject constructor( val newLineString = GeometryTools.createLineString(linePoints) linkId?.let { - var elementList = realmOperateHelper.queryLinkByLinkPid(it) + val elementList = realmOperateHelper.queryLinkByLinkPid(realm, it) + Log.e("jingo", "捕捉到数据 ${elementList.size} 个") for (element in elementList) { if (element.code == DataCodeEnum.OMDB_LINK_NAME.code) { hisRoadName = true @@ -824,7 +820,10 @@ class MainViewModel @Inject constructor( newLineString, element ) -// Log.e("jingo", "捕捉到的数据code ${element.code}") + Log.e( + "jingo", + "捕捉到的数据code ${DataCodeEnum.findTableNameByCode(element.code)}" + ) when (element.code) { DataCodeEnum.OMDB_MULTI_DIGITIZED.code,//上下线分离 DataCodeEnum.OMDB_CON_ACCESS.code,//全封闭 @@ -887,10 +886,10 @@ class MainViewModel @Inject constructor( } - val realm = realmOperateHelper.getSelectTaskRealmInstance() +// val realm = realmOperateHelper.getSelectTaskRealmInstance() val entityList = realmOperateHelper.getSelectTaskRealmTools( - RenderEntity::class.java, true + realm, RenderEntity::class.java, true ).and().equalTo("table", DataCodeEnum.OMDB_RESTRICTION.name).and() .equalTo( "properties['linkIn']", it @@ -901,7 +900,7 @@ class MainViewModel @Inject constructor( val outLink = outList[i].properties["linkOut"] val linkOutEntity = realmOperateHelper.getSelectTaskRealmTools( - RenderEntity::class.java, + realm, RenderEntity::class.java, true ) .equalTo("table", DataCodeEnum.OMDB_RD_LINK_KIND.name) @@ -919,8 +918,8 @@ class MainViewModel @Inject constructor( mapController.lineHandler.linksLayer.addLine( link.geometry, Color.BLUE ) - realm.close() } + } liveDataTopSignList.postValue(topSignList.distinctBy { it.name } @@ -941,6 +940,7 @@ class MainViewModel @Inject constructor( if (!hisRoadName) { liveDataRoadName.postValue(null) } + realm.close() } } catch (e: Exception) { diff --git a/app/src/main/java/com/navinfo/omqs/ui/fragment/evaluationresult/EvaluationResultViewModel.kt b/app/src/main/java/com/navinfo/omqs/ui/fragment/evaluationresult/EvaluationResultViewModel.kt index c084c50a..260884fb 100644 --- a/app/src/main/java/com/navinfo/omqs/ui/fragment/evaluationresult/EvaluationResultViewModel.kt +++ b/app/src/main/java/com/navinfo/omqs/ui/fragment/evaluationresult/EvaluationResultViewModel.kt @@ -218,7 +218,7 @@ class EvaluationResultViewModel @Inject constructor( } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { liveDataQsRecordBean.value?.let { - + val realm = realmOperateHelper.getSelectTaskRealmInstance() val taskLink = realmOperateHelper.captureTaskLink(point) if (taskLink != null) { @@ -226,7 +226,7 @@ class EvaluationResultViewModel @Inject constructor( mapController.lineHandler.showLine(taskLink.geometry) return } else { - val linkList = realmOperateHelper.queryLink(point = point) + val linkList = realmOperateHelper.queryLink(realm,point = point) if (linkList.isNotEmpty()) { it.linkId = linkList[0].properties[LinkTable.linkPid] ?: "" mapController.lineHandler.showLine(linkList[0].geometry) @@ -235,6 +235,7 @@ class EvaluationResultViewModel @Inject constructor( } it.linkId = "" mapController.lineHandler.removeLine() + realm.close() } } } diff --git a/app/src/main/java/com/navinfo/omqs/ui/fragment/personalcenter/PersonalCenterViewModel.kt b/app/src/main/java/com/navinfo/omqs/ui/fragment/personalcenter/PersonalCenterViewModel.kt index 25138031..1c8c0a26 100644 --- a/app/src/main/java/com/navinfo/omqs/ui/fragment/personalcenter/PersonalCenterViewModel.kt +++ b/app/src/main/java/com/navinfo/omqs/ui/fragment/personalcenter/PersonalCenterViewModel.kt @@ -275,7 +275,7 @@ class PersonalCenterViewModel @Inject constructor( liveDataMessage.postValue("元数据表导入成功") roomAppDatabase.getScRootCauseAnalysisDao().insertOrUpdateList(list2) } - if(list3.isNotEmpty()){ + if (list3.isNotEmpty()) { liveDataMessage.postValue("标牌对照表导入成功") roomAppDatabase.getScWarningCodeDao().insertList(list3) } @@ -295,7 +295,9 @@ class PersonalCenterViewModel @Inject constructor( fun readRealmData() { viewModelScope.launch(Dispatchers.IO) { // val result = realmOperateHelper.queryLink(GeometryTools.createPoint(115.685817,28.62759)) - val result = realmOperateHelper.queryLinkByLinkPid("84206617008217069") + val realm = realmOperateHelper.getSelectTaskRealmInstance() + val result = realmOperateHelper.queryLinkByLinkPid(realm, "84206617008217069") + realm.close() Log.d("xiaoyan", result.toString()) } } diff --git a/app/src/main/java/com/navinfo/omqs/ui/fragment/tasklist/TaskFragment.kt b/app/src/main/java/com/navinfo/omqs/ui/fragment/tasklist/TaskFragment.kt index 08a0ddb7..34bf24f0 100644 --- a/app/src/main/java/com/navinfo/omqs/ui/fragment/tasklist/TaskFragment.kt +++ b/app/src/main/java/com/navinfo/omqs/ui/fragment/tasklist/TaskFragment.kt @@ -76,6 +76,11 @@ class TaskFragment : BaseFragment() { binding.taskAddLink.isSelected = it } + viewModel.liveDataAddLinkDialog.observe(viewLifecycleOwner){ + viewModel.addTaskLink(requireContext(),it) + } + + //注意:使用滑动菜单不能开启滑动删除,否则只有滑动删除没有滑动菜单 val mSwipeMenuCreator = SwipeMenuCreator { _, rightMenu, _ -> //添加菜单自动添加至尾部 @@ -110,6 +115,7 @@ class TaskFragment : BaseFragment() { viewModel.liveDataTaskLinks.observe(viewLifecycleOwner) { adapter.resetSelect() adapter.refreshData(it) +// adapter.setSelectTag(it.last().linkPid) } viewModel.getTaskList(requireContext()) binding.taskSearch.addTextChangedListener(object : TextWatcher { diff --git a/app/src/main/java/com/navinfo/omqs/ui/fragment/tasklist/TaskListAdapter.kt b/app/src/main/java/com/navinfo/omqs/ui/fragment/tasklist/TaskListAdapter.kt index fc2024b3..5a8e1e91 100644 --- a/app/src/main/java/com/navinfo/omqs/ui/fragment/tasklist/TaskListAdapter.kt +++ b/app/src/main/java/com/navinfo/omqs/ui/fragment/tasklist/TaskListAdapter.kt @@ -128,21 +128,29 @@ class TaskListAdapter( holder.addObserver(object : OnLifecycleStateListener { override fun onState(tag: String, state: Lifecycle.State) { when (state) { - Lifecycle.State.STARTED -> + Lifecycle.State.STARTED -> { + uploadManager.observer( + taskBean.id, + holder, + UploadObserver(taskBean.id, binding) + ) downloadManager.observer( taskBean.id, holder, DownloadObserver(taskBean.id, holder) ) - Lifecycle.State.DESTROYED -> + } + Lifecycle.State.DESTROYED -> { downloadManager.removeObserver(tag.toInt()) + uploadManager.removeObserver(tag.toInt()) + } else -> {} } } }) downloadManager.addTask(taskBean) uploadManager.addTask(taskBean) - uploadManager.observer(taskBean.id, holder, UploadObserver(taskBean.id, binding)) +// uploadManager.observer(taskBean.id, holder, UploadObserver(taskBean.id, binding)) if (taskBean.status == FileDownloadStatus.NONE) { binding.taskDownloadBtn.setBackgroundColor(Color.WHITE) binding.taskDownloadBtn.setTextColor(Color.parseColor("#888FB3")) @@ -187,7 +195,6 @@ class TaskListAdapter( } } - } @@ -226,8 +233,8 @@ class TaskListAdapter( binding.taskUploadBtn.stopAnimator() binding.taskUploadBtn.setText("重新同步") binding.taskUploadBtn.setProgress(100) - if(!TextUtils.isEmpty(taskBean.errMsg)){ - Toast.makeText(binding.root.context,taskBean.errMsg,Toast.LENGTH_LONG).show() + if (!TextUtils.isEmpty(taskBean.errMsg)) { + Toast.makeText(binding.root.context, taskBean.errMsg, Toast.LENGTH_LONG).show() } } @@ -357,7 +364,7 @@ class TaskListAdapter( refreshData(list) } - fun getSelectTaskPosition():Int{ + fun getSelectTaskPosition(): Int { return selectPosition } diff --git a/app/src/main/java/com/navinfo/omqs/ui/fragment/tasklist/TaskViewModel.kt b/app/src/main/java/com/navinfo/omqs/ui/fragment/tasklist/TaskViewModel.kt index 5b30d286..b019f26f 100644 --- a/app/src/main/java/com/navinfo/omqs/ui/fragment/tasklist/TaskViewModel.kt +++ b/app/src/main/java/com/navinfo/omqs/ui/fragment/tasklist/TaskViewModel.kt @@ -88,7 +88,12 @@ class TaskViewModel @Inject constructor( /** * 是否开启了道路选择 */ - var liveDataSelectNewLink = MutableLiveData(false) + val liveDataSelectNewLink = MutableLiveData(false) + + /** + * 选中link + */ + val liveDataAddLinkDialog = MutableLiveData() init { sharedPreferences.registerOnSharedPreferenceChangeListener(this) @@ -98,10 +103,11 @@ class TaskViewModel @Inject constructor( if (tag == TAG) { if (liveDataSelectNewLink.value == true) { viewModelScope.launch(Dispatchers.Default) { + val realm = realmOperateHelper.getSelectTaskRealmInstance() if (currentSelectTaskBean == null) { liveDataToastMessage.postValue("还没有开启任何任务") } else { - val links = realmOperateHelper.queryLink( + val links = realmOperateHelper.queryLink(realm, point = point, ) if (links.isNotEmpty()) { @@ -111,43 +117,15 @@ class TaskViewModel @Inject constructor( return@launch } } - val hadLinkDvoBean = HadLinkDvoBean( - taskId = currentSelectTaskBean!!.id, - linkPid = l.properties["linkPid"]!!, - geometry = l.geometry, - linkStatus = 2 - ) - currentSelectTaskBean!!.hadLinkDvoList.add( - hadLinkDvoBean - ) - val realm = Realm.getDefaultInstance() - realm.executeTransaction { r -> - r.copyToRealmOrUpdate(hadLinkDvoBean) - r.copyToRealmOrUpdate(currentSelectTaskBean!!) - } - //根据Link数据查询对应数据上要素,对要素进行显示重置 - l.properties["linkPid"]?.let { - realmOperateHelper.queryLinkToMutableRenderEntityList(it) - ?.forEach { renderEntity -> - if (renderEntity.enable != 1) { - renderEntity.enable = 1 - realm.executeTransaction { r -> - r.copyToRealmOrUpdate(renderEntity) - } - } - } - } - liveDataTaskLinks.postValue(currentSelectTaskBean!!.hadLinkDvoList) - mapController.lineHandler.addTaskLink(hadLinkDvoBean) - mapController.layerManagerHandler.updateOMDBVectorTileLayer() - mapController.mMapView.vtmMap.updateMap(true) - realm.close() + liveDataAddLinkDialog.postValue(l) } } + realm.close() } } else { viewModelScope.launch(Dispatchers.IO) { - val links = realmOperateHelper.queryLink( + val realm = realmOperateHelper.getSelectTaskRealmInstance() + val links = realmOperateHelper.queryLink(realm, point = point, ) if (links.isNotEmpty()) { @@ -160,6 +138,7 @@ class TaskViewModel @Inject constructor( } } } + realm.close() } } } @@ -282,7 +261,7 @@ class TaskViewModel @Inject constructor( * 设置当前选择的任务,并高亮当前任务的所有link */ - fun setSelectTaskBean( taskBean: TaskBean) { + fun setSelectTaskBean(taskBean: TaskBean) { sharedPreferences.edit().putInt(Constant.SELECT_TASK_ID, taskBean.id).apply() @@ -291,15 +270,17 @@ class TaskViewModel @Inject constructor( liveDataTaskLinks.value = taskBean.hadLinkDvoList showTaskLinks(taskBean) MapParamUtils.setTaskId(taskBean.id) - Constant.currentSelectTaskFolder = File(Constant.USER_DATA_PATH +"/${taskBean.id}") - Constant.currentSelectTaskConfig = RealmConfiguration.Builder().directory(Constant.currentSelectTaskFolder).name("OMQS.realm").encryptionKey(Constant.PASSWORD).allowQueriesOnUiThread(true).schemaVersion(2).build() + Constant.currentSelectTaskFolder = File(Constant.USER_DATA_PATH + "/${taskBean.id}") + Constant.currentSelectTaskConfig = + RealmConfiguration.Builder().directory(Constant.currentSelectTaskFolder) + .name("OMQS.realm").encryptionKey(Constant.PASSWORD).allowQueriesOnUiThread(true) + .schemaVersion(2).build() MapParamUtils.setTaskConfig(Constant.currentSelectTaskConfig) mapController.layerManagerHandler.updateOMDBVectorTileLayer() mapController.mMapView.updateMap(true) } - private fun showTaskLinks(taskBean: TaskBean) { mapController.lineHandler.removeAllTaskLine() @@ -494,17 +475,17 @@ class TaskViewModel @Inject constructor( realm.where(QsRecordBean::class.java).equalTo("linkId", hadLinkDvoBean.linkPid) .and().equalTo("taskId", hadLinkDvoBean.taskId).findAll() if (objects.isEmpty() && hadLinkDvoBean.reason.isEmpty()) { - if(hadLinkDvoBean.linkStatus==3){ + if (hadLinkDvoBean.linkStatus == 3) { result = 1 realm.close() return@forEach - }else{ + } else { result = 2 } } } realm.close() - if(result==1){ + if (result == 1) { liveDataTaskUpload.postValue(map) withContext(Dispatchers.Main) { val mDialog = FirstDialog(context) @@ -518,7 +499,7 @@ class TaskViewModel @Inject constructor( mDialog.setCancelVisibility(View.GONE) mDialog.show() } - }else if(result==2){ + } else if (result == 2) { liveDataTaskUpload.postValue(map) withContext(Dispatchers.Main) { val mDialog = FirstDialog(context) @@ -536,7 +517,7 @@ class TaskViewModel @Inject constructor( ) { _, _ -> mDialog.dismiss() } mDialog.show() } - }else{ + } else { map[taskBean] = true liveDataTaskUpload.postValue(map) } @@ -559,69 +540,62 @@ class TaskViewModel @Inject constructor( */ fun setSelectLink(selected: Boolean) { liveDataSelectNewLink.value = selected -// //开始捕捉 -// if (selected) { -// mapController.mMapView.addOnNIMapClickListener(TAG, object : OnGeoPointClickListener { -// override fun onMapClick(tag: String, point: GeoPoint) { -// if (tag == TAG) { -// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { -// viewModelScope.launch(Dispatchers.Default) { -// if (currentSelectTaskBean == null) { -// liveDataToastMessage.postValue("还没有开启任何任务") -// } else { -// val links = realmOperateHelper.queryLink( -// point = point, -// ) -// if (links.isNotEmpty()) { -// val l = links[0] -// for (link in currentSelectTaskBean!!.hadLinkDvoList) { -// if (link.linkPid == l.properties["linkPid"]) { -// return@launch -// } -// } -// val hadLinkDvoBean = HadLinkDvoBean( -// taskId = currentSelectTaskBean!!.id, -// linkPid = l.properties["linkPid"]!!, -// geometry = l.geometry, -// linkStatus = 2 -// ) -// currentSelectTaskBean!!.hadLinkDvoList.add( -// hadLinkDvoBean -// ) -// val realm = Realm.getDefaultInstance() -// realm.executeTransaction { r -> -// r.copyToRealmOrUpdate(hadLinkDvoBean) -// r.copyToRealmOrUpdate(currentSelectTaskBean!!) -// } -// //根据Link数据查询对应数据上要素,对要素进行显示重置 -// l.properties["linkPid"]?.let { -// realmOperateHelper.queryLinkToMutableRenderEntityList(it) -// ?.forEach { renderEntity -> -// if (renderEntity.enable != 1) { -// renderEntity.enable = 1 -// realm.executeTransaction { r -> -// r.copyToRealmOrUpdate(renderEntity) -// } -// } -// } -// } -// liveDataTaskLinks.postValue(currentSelectTaskBean!!.hadLinkDvoList) -// mapController.lineHandler.addTaskLink(hadLinkDvoBean) -// mapController.layerManagerHandler.updateOMDBVectorTileLayer() -// mapController.mMapView.vtmMap.updateMap(true) -// } -// } -// } -// } -// } -// } -// }) -// } else { -// mapController.mMapView.removeOnNIMapClickListener(TAG) -// mapController.lineHandler.removeLine() -// } } + /** + * 添加link + */ + fun addTaskLink(context: Context, data: RenderEntity) { + val mDialog = FirstDialog(context) + mDialog.setTitle("提示") + mDialog.setMessage("是否添加当前link") + mDialog.setPositiveButton( + "确定" + ) { dialog, _ -> + dialog.dismiss() + viewModelScope.launch(Dispatchers.IO) { + val hadLinkDvoBean = HadLinkDvoBean( + taskId = currentSelectTaskBean!!.id, + linkPid = data.properties["linkPid"]!!, + geometry = data.geometry, + linkStatus = 2 + ) + currentSelectTaskBean!!.hadLinkDvoList.add( + hadLinkDvoBean + ) + val realm = Realm.getDefaultInstance() + realm.executeTransaction { r -> + r.copyToRealmOrUpdate(hadLinkDvoBean) + r.copyToRealmOrUpdate(currentSelectTaskBean!!) + } + //根据Link数据查询对应数据上要素,对要素进行显示重置 + data.properties["linkPid"]?.let { + realmOperateHelper.queryLinkToMutableRenderEntityList(realm,it) + ?.forEach { renderEntity -> + if (renderEntity.enable != 1) { + renderEntity.enable = 1 + realm.executeTransaction { r -> + r.copyToRealmOrUpdate(renderEntity) + } + } + } + } + liveDataTaskLinks.postValue(currentSelectTaskBean!!.hadLinkDvoList) + mapController.lineHandler.addTaskLink(hadLinkDvoBean) + mapController.layerManagerHandler.updateOMDBVectorTileLayer() + mapController.mMapView.vtmMap.updateMap(true) + realm.close() + } + } + mDialog.setNegativeButton( + "取消" + ) { _, _ -> + mDialog.dismiss() + } + mDialog.show() + } + + /** * 删除评测link */ @@ -651,7 +625,7 @@ class TaskViewModel @Inject constructor( //重置数据为隐藏 if (hadLinkDvoBean.linkStatus == 2) { - realmOperateHelper.queryLinkToMutableRenderEntityList(hadLinkDvoBean.linkPid) + realmOperateHelper.queryLinkToMutableRenderEntityList(realm,hadLinkDvoBean.linkPid) ?.forEach { renderEntity -> if (renderEntity.enable == 1) { renderEntity.enable = 0 diff --git a/app/src/main/java/com/navinfo/omqs/util/SignUtil.kt b/app/src/main/java/com/navinfo/omqs/util/SignUtil.kt index 1aefbd52..4d45c49b 100644 --- a/app/src/main/java/com/navinfo/omqs/util/SignUtil.kt +++ b/app/src/main/java/com/navinfo/omqs/util/SignUtil.kt @@ -707,6 +707,28 @@ class SignUtil { ) ) } + DataCodeEnum.OMDB_FILL_AREA.code->{ + list.add( + TwoItemAdapterItem( + title = "对象号码", + text = "${data.properties["objectPid"]}" + ) + ) + list.add( + TwoItemAdapterItem( + title = "符合高精", text = when (data.properties["compliant"]) { + "0" -> "否" + "1" -> "是" + else -> "" + } + ) + ) + list.add( + TwoItemAdapterItem( + title = "关联车道组", text = "${data.properties["lgList"]}" + ) + ) + } } adapter.data = list return adapter From 9db5e0c4b19c24a572eda4b1ae8731239e5dcc03 Mon Sep 17 00:00:00 2001 From: xiaoyan Date: Mon, 9 Oct 2023 11:07:30 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E8=BD=A6=E4=BF=A1?= =?UTF-8?q?=E6=B8=B2=E6=9F=93=E4=BD=8D=E7=BD=AE=E9=94=99=E8=AF=AF=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/navinfo/omqs/db/ImportPreProcess.kt | 29 ++++++++++++------- .../personalcenter/PersonalCenterFragment.kt | 2 +- .../map/handler/LayerManagerHandler.kt | 4 +-- .../library/map/source/OMDBDataDecoder.java | 1 - .../map/source/OMDBReferenceDataSource.java | 13 +++++++-- .../map/source/OMDBReferenceTileSource.java | 9 +++++- .../map/source/OMDBTileDataSource.java | 14 ++++++++- .../library/map/source/OMDBTileSource.java | 14 +++++++-- 8 files changed, 65 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/com/navinfo/omqs/db/ImportPreProcess.kt b/app/src/main/java/com/navinfo/omqs/db/ImportPreProcess.kt index 392db41d..438319c8 100644 --- a/app/src/main/java/com/navinfo/omqs/db/ImportPreProcess.kt +++ b/app/src/main/java/com/navinfo/omqs/db/ImportPreProcess.kt @@ -52,24 +52,33 @@ class ImportPreProcess { // 获取当前renderEntity的geometry val geometry = renderEntity.wkt var radian = 0.0 // geometry的角度,如果是点,获取angle,如果是线,获取最后两个点的方向 - var point = Coordinate(geometry?.coordinate) + + var isReverse = false // 是否为逆向 + if (direction.isNotEmpty()) { + val paramDirections = direction.split("=") + if (paramDirections.size >= 2 && renderEntity.properties[paramDirections[0].trim()] == paramDirections[1].trim()) { + isReverse = true; + } + } + // 如果是正向,则取最后一个点作为渲染图标的位置 + var point = geometry!!.coordinates[geometry!!.coordinates.size-1] + if (isReverse){ + // 逆向的话取第一个点作为渲染图标的位置 + point = geometry.coordinates[0] + } + // 如果数据属性中存在angle,则使用该值,否则需要根据line中的数据进行计算 if (renderEntity?.properties?.get( "angle" ) != null ) { + // 带有angle字段的数据,也有可能是线,需要判断是否需要根据指定字段判断数据是否为逆向 + var angle = renderEntity?.properties?.get("angle")?.toDouble()!! // angle角度为与正北方向的顺时针夹角,将其转换为与X轴正方向的逆时针夹角,即为正东方向的夹角 angle = ((450 - angle) % 360) radian = Math.toRadians(angle) } else { - var isReverse = false // 是否为逆向 - if (direction.isNotEmpty()) { - val paramDirections = direction.split("=") - if (paramDirections.size >= 2 && renderEntity.properties[paramDirections[0].trim()] == paramDirections[1].trim()) { - isReverse = true; - } - } if (Geometry.TYPENAME_LINESTRING == geometry?.geometryType) { var coordinates = geometry.coordinates if (isReverse) { @@ -79,7 +88,7 @@ class ImportPreProcess { val p2: Coordinate = coordinates.get(coordinates.size - 1) // 计算线段的方向 radian = Angle.angle(p1, p2) - point = p1 + point = p2 } } @@ -97,7 +106,7 @@ class ImportPreProcess { val coord = Coordinate(point.getX() + dy, point.getY() - dx) - // 记录偏移后的点位或线数据,如果数据为线时,记录的偏移后数据为倒数第二个点右移后,方向与线的最后两个点平行同向的单位向量 + // 记录偏移后的点位或线数据,如果数据为线时,记录的偏移后数据为最后一个点右移后,方向与线的最后两个点平行同向的单位向量 if (Geometry.TYPENAME_POINT == geometry?.geometryType) { val geometryTranslate: Geometry = GeometryTools.createGeometry(doubleArrayOf(coord.x, coord.y)) diff --git a/app/src/main/java/com/navinfo/omqs/ui/fragment/personalcenter/PersonalCenterFragment.kt b/app/src/main/java/com/navinfo/omqs/ui/fragment/personalcenter/PersonalCenterFragment.kt index a9876542..64bcc9d6 100644 --- a/app/src/main/java/com/navinfo/omqs/ui/fragment/personalcenter/PersonalCenterFragment.kt +++ b/app/src/main/java/com/navinfo/omqs/ui/fragment/personalcenter/PersonalCenterFragment.kt @@ -178,7 +178,7 @@ class PersonalCenterFragment(private var indoorDataListener: ((Boolean) -> Unit? // 定位到指定位置 niMapController.mMapView.vtmMap.animator() // .animateTo(GeoPoint( 40.05108004733645, 116.29187746293708 )) - .animateTo(GeoPoint(40.50704534740206, 115.80404946472662)) + .animateTo(GeoPoint(40.07245537956604, 116.239638575623)) } R.id.personal_center_menu_open_all_layer -> { diff --git a/collect-library/src/main/java/com/navinfo/collect/library/map/handler/LayerManagerHandler.kt b/collect-library/src/main/java/com/navinfo/collect/library/map/handler/LayerManagerHandler.kt index 1ee392b7..7006827a 100644 --- a/collect-library/src/main/java/com/navinfo/collect/library/map/handler/LayerManagerHandler.kt +++ b/collect-library/src/main/java/com/navinfo/collect/library/map/handler/LayerManagerHandler.kt @@ -58,8 +58,8 @@ class LayerManagerHandler(context: AppCompatActivity, mapView: NIMapView, traceP private lateinit var omdbReferenceLabelLayer: LabelLayer private lateinit var tileGridLayer: TileGridLayer // 用来显示tile号的layer - private val omdbTileSource by lazy { OMDBTileSource() } - private val omdbReferenceTileSource by lazy { OMDBReferenceTileSource() } + private val omdbTileSource by lazy { OMDBTileSource(mMapView.vtmMap.viewport()) } + private val omdbReferenceTileSource by lazy { OMDBReferenceTileSource(mMapView.vtmMap.viewport()) } private val labelTileLoaderHook = LabelTileLoaderHook() private val navinfoTileThemeHook = NavinfoTileThemeHook() diff --git a/collect-library/src/main/java/com/navinfo/collect/library/map/source/OMDBDataDecoder.java b/collect-library/src/main/java/com/navinfo/collect/library/map/source/OMDBDataDecoder.java index fdb2b98a..7c0b4d75 100644 --- a/collect-library/src/main/java/com/navinfo/collect/library/map/source/OMDBDataDecoder.java +++ b/collect-library/src/main/java/com/navinfo/collect/library/map/source/OMDBDataDecoder.java @@ -4,7 +4,6 @@ import static org.oscim.core.MercatorProjection.latitudeToY; import static org.oscim.core.MercatorProjection.longitudeToX; import android.os.Build; -import android.util.Log; import androidx.annotation.RequiresApi; diff --git a/collect-library/src/main/java/com/navinfo/collect/library/map/source/OMDBReferenceDataSource.java b/collect-library/src/main/java/com/navinfo/collect/library/map/source/OMDBReferenceDataSource.java index 9cd8765d..61a0334b 100644 --- a/collect-library/src/main/java/com/navinfo/collect/library/map/source/OMDBReferenceDataSource.java +++ b/collect-library/src/main/java/com/navinfo/collect/library/map/source/OMDBReferenceDataSource.java @@ -12,6 +12,7 @@ import com.navinfo.collect.library.utils.MapParamUtils; import org.locationtech.jts.geom.Polygon; import org.oscim.layers.tile.MapTile; +import org.oscim.map.Viewport; import org.oscim.tiling.ITileDataSink; import org.oscim.tiling.ITileDataSource; import org.oscim.tiling.QueryResult; @@ -24,6 +25,11 @@ import io.realm.RealmQuery; public class OMDBReferenceDataSource implements ITileDataSource { private boolean isUpdate; + private Viewport viewport; + + public OMDBReferenceDataSource(Viewport viewport) { + this.viewport = viewport; + } private final ThreadLocal mThreadLocalDecoders = new ThreadLocal() { @Override @@ -48,7 +54,7 @@ public class OMDBReferenceDataSource implements ITileDataSource { yStart = (int) (yStart << m); yEnd = (int) (yEnd << m); } - + final int currentTileX = xStart; if(isUpdate){ Realm.getInstance(MapParamUtils.getTaskConfig()).refresh(); @@ -76,7 +82,10 @@ public class OMDBReferenceDataSource implements ITileDataSource { List listResult = realmQuery/*.distinct("id")*/.findAll(); if (!listResult.isEmpty()) { Polygon tilePolygon = GeometryTools.getTilePolygon(tile); - listResult = listResult.stream().filter((ReferenceEntity referenceEntity) -> referenceEntity.getWkt().intersects(tilePolygon)).collect(Collectors.toList()); + listResult = listResult.stream().filter((ReferenceEntity referenceEntity) -> referenceEntity.getWkt().intersects(tilePolygon)) + /*过滤数据,只有最小x(屏幕的最小x或数据的最小x会被渲染,跨Tile的其他数据不再重复渲染)*/ +// .filter((ReferenceEntity referenceEntity) -> MercatorProjection.longitudeToTileX(viewport.fromScreenPoint(0,0).getLongitude(), (byte) Constant.DATA_ZOOM) == currentTileX || referenceEntity.getTileX().stream().min(Integer::compare).get() == currentTileX) + .collect(Collectors.toList()); mThreadLocalDecoders.get().decode(tile.zoomLevel, tile, mapDataSink, listResult); mapDataSink.completed(QueryResult.SUCCESS); } else { diff --git a/collect-library/src/main/java/com/navinfo/collect/library/map/source/OMDBReferenceTileSource.java b/collect-library/src/main/java/com/navinfo/collect/library/map/source/OMDBReferenceTileSource.java index 3fc6ea84..5f8b17c4 100644 --- a/collect-library/src/main/java/com/navinfo/collect/library/map/source/OMDBReferenceTileSource.java +++ b/collect-library/src/main/java/com/navinfo/collect/library/map/source/OMDBReferenceTileSource.java @@ -2,11 +2,18 @@ package com.navinfo.collect.library.map.source; import com.navinfo.collect.library.system.Constant; +import org.oscim.map.Viewport; import org.oscim.tiling.ITileDataSource; import org.oscim.tiling.OverzoomTileDataSource; public class OMDBReferenceTileSource extends RealmDBTileSource { - private OMDBReferenceDataSource omdbReferenceTileSource = new OMDBReferenceDataSource(); + private OMDBReferenceDataSource omdbReferenceTileSource; + private Viewport viewport; + + public OMDBReferenceTileSource(Viewport viewport) { + this.viewport = viewport; + this.omdbReferenceTileSource = new OMDBReferenceDataSource(this.viewport); + } @Override public ITileDataSource getDataSource() { diff --git a/collect-library/src/main/java/com/navinfo/collect/library/map/source/OMDBTileDataSource.java b/collect-library/src/main/java/com/navinfo/collect/library/map/source/OMDBTileDataSource.java index 62475226..c6e5be22 100644 --- a/collect-library/src/main/java/com/navinfo/collect/library/map/source/OMDBTileDataSource.java +++ b/collect-library/src/main/java/com/navinfo/collect/library/map/source/OMDBTileDataSource.java @@ -12,6 +12,7 @@ import com.navinfo.collect.library.utils.MapParamUtils; import org.locationtech.jts.geom.Polygon; import org.oscim.layers.tile.MapTile; +import org.oscim.map.Viewport; import org.oscim.tiling.ITileDataSink; import org.oscim.tiling.ITileDataSource; import org.oscim.tiling.QueryResult; @@ -24,6 +25,7 @@ import io.realm.RealmQuery; public class OMDBTileDataSource implements ITileDataSource { private boolean isUpdate; + private Viewport viewport; private final ThreadLocal mThreadLocalDecoders = new ThreadLocal() { @Override protected OMDBDataDecoder initialValue() { @@ -31,6 +33,10 @@ public class OMDBTileDataSource implements ITileDataSource { } }; + public OMDBTileDataSource(Viewport viewport) { + this.viewport = viewport; + } + @RequiresApi(api = Build.VERSION_CODES.N) @Override public void query(MapTile tile, ITileDataSink mapDataSink) { @@ -48,6 +54,7 @@ public class OMDBTileDataSource implements ITileDataSource { yEnd = (int) (yEnd << m); } + final int currentTileX = xStart; if(isUpdate){ Realm.getInstance(MapParamUtils.getTaskConfig()).refresh(); isUpdate = false; @@ -74,7 +81,12 @@ public class OMDBTileDataSource implements ITileDataSource { // 数据记录的tile号是以正外接tile号列表,此处过滤并未与当前tile相交的数据 if (!listResult.isEmpty()) { Polygon tilePolygon = GeometryTools.getTilePolygon(tile); - listResult = listResult.stream().filter((RenderEntity renderEntity) -> renderEntity.getWkt().intersects(tilePolygon)).collect(Collectors.toList()); + System.out.println("第一条数据的最小x值:" + listResult.get(0).getTileX().stream().min(Integer::compare).get()); + System.out.println("当前tile的:" + listResult.get(0).getTileX().stream().min(Integer::compare).get()); + listResult = listResult.stream().filter((RenderEntity renderEntity) -> renderEntity.getWkt().intersects(tilePolygon)) + /*过滤数据,只有最小x(屏幕的最小x或数据的最小x会被渲染,跨Tile的其他数据不再重复渲染)*/ +// .filter((RenderEntity renderEntity) -> MercatorProjection.longitudeToTileX(viewport.fromScreenPoint(0,0).getLongitude(), (byte) Constant.DATA_ZOOM) == currentTileX || renderEntity.getTileX().stream().min(Integer::compare).get() == currentTileX) + .collect(Collectors.toList()); mThreadLocalDecoders.get().decode(tile.zoomLevel, tile, mapDataSink, listResult); mapDataSink.completed(QueryResult.SUCCESS); } else { diff --git a/collect-library/src/main/java/com/navinfo/collect/library/map/source/OMDBTileSource.java b/collect-library/src/main/java/com/navinfo/collect/library/map/source/OMDBTileSource.java index 406c27ec..9cda466c 100644 --- a/collect-library/src/main/java/com/navinfo/collect/library/map/source/OMDBTileSource.java +++ b/collect-library/src/main/java/com/navinfo/collect/library/map/source/OMDBTileSource.java @@ -5,17 +5,25 @@ import android.util.Log; import com.navinfo.collect.library.data.entity.RenderEntity; import com.navinfo.collect.library.system.Constant; +import org.oscim.map.Viewport; import org.oscim.tiling.ITileDataSource; import org.oscim.tiling.OverzoomTileDataSource; import io.realm.Realm; public class OMDBTileSource extends RealmDBTileSource { - private OMDBTileDataSource omdbTileSource = new OMDBTileDataSource(); + private Viewport viewport; + private OMDBTileDataSource omdbTileDataSource; + + public OMDBTileSource(Viewport viewport) { + this.viewport = viewport; + this.omdbTileDataSource = new OMDBTileDataSource(this.viewport); + } + @Override public ITileDataSource getDataSource() { // return new OverzoomTileDataSource(new OMDBTileDataSource(), Constant.OVER_ZOOM); - return new OverzoomTileDataSource(omdbTileSource, Constant.OVER_ZOOM); + return new OverzoomTileDataSource(omdbTileDataSource, Constant.OVER_ZOOM); } @Override @@ -32,6 +40,6 @@ public class OMDBTileSource extends RealmDBTileSource { @Override public void update() { super.update(); - omdbTileSource.update(); + omdbTileDataSource.update(); } }