From 27b8be2cb1514c4dfe109fa4625e8ad9f3e97191 Mon Sep 17 00:00:00 2001 From: xiaoyan Date: Thu, 7 Sep 2023 14:26:21 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E7=94=B5=E5=AD=90?= =?UTF-8?q?=E7=9C=BC=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../personalcenter/PersonalCenterFragment.kt | 2 +- .../src/main/assets/editormarker.xml | 28 ++--- .../omdb/4010/icon_electroniceye_4010.svg | 104 +----------------- 3 files changed, 12 insertions(+), 122 deletions(-) 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 90fa5f37..96e7543f 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 @@ -129,7 +129,7 @@ class PersonalCenterFragment(private var indoorDataListener: ((Boolean) -> Unit? // 定位到指定位置 niMapController.mMapView.vtmMap.animator() // .animateTo(GeoPoint( 40.05108004733645, 116.29187746293708 )) - .animateTo(GeoPoint(40.51850916836801,115.78801387178642)) + .animateTo(GeoPoint(40.04315565069137, 116.28669540538765)) } R.id.personal_center_menu_open_all_layer -> { MapParamUtils.setDataLayerEnum(DataLayerEnum.SHOW_ALL_LAYERS) diff --git a/collect-library/src/main/assets/editormarker.xml b/collect-library/src/main/assets/editormarker.xml index 09fda163..b74a853d 100644 --- a/collect-library/src/main/assets/editormarker.xml +++ b/collect-library/src/main/assets/editormarker.xml @@ -1613,14 +1613,6 @@ - @@ -1897,10 +1889,10 @@ - - - + + + + - - - - + + + + + + src="assets:omdb/icon_arrow_right.svg" symbol-height="44" symbol-width="44"> diff --git a/collect-library/src/main/assets/omdb/4010/icon_electroniceye_4010.svg b/collect-library/src/main/assets/omdb/4010/icon_electroniceye_4010.svg index 122a28af..cb0c181d 100644 --- a/collect-library/src/main/assets/omdb/4010/icon_electroniceye_4010.svg +++ b/collect-library/src/main/assets/omdb/4010/icon_electroniceye_4010.svg @@ -1,103 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + \ No newline at end of file From bcc11946a166ecbef4323faeeb1c07334a21018d Mon Sep 17 00:00:00 2001 From: xiaoyan Date: Thu, 7 Sep 2023 14:52:01 +0800 Subject: [PATCH 2/4] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E7=94=B5=E5=AD=90?= =?UTF-8?q?=E7=9C=BC=E6=B8=B2=E6=9F=93=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/assets/editormarker.xml | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/collect-library/src/main/assets/editormarker.xml b/collect-library/src/main/assets/editormarker.xml index b74a853d..685a66b9 100644 --- a/collect-library/src/main/assets/editormarker.xml +++ b/collect-library/src/main/assets/editormarker.xml @@ -1889,10 +1889,10 @@ - - - - + + + - - - - - + + + + + src="assets:omdb/icon_arrow_right.svg" symbol-height="54" symbol-width="54"> From 408d98ddea58fa493516294d56057a4c8619b9fc Mon Sep 17 00:00:00 2001 From: xiaoyan Date: Thu, 7 Sep 2023 17:28:09 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E4=B8=BB=E7=82=B9?= =?UTF-8?q?=E5=81=8F=E7=A7=BB=E4=B8=8E=E5=8F=82=E8=80=83=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E4=B8=8D=E5=8C=B9=E9=85=8D=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/navinfo/omqs/db/ImportPreProcess.kt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 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 cf2396e8..0133d3f9 100644 --- a/app/src/main/java/com/navinfo/omqs/db/ImportPreProcess.kt +++ b/app/src/main/java/com/navinfo/omqs/db/ImportPreProcess.kt @@ -18,7 +18,7 @@ class ImportPreProcess { val code2NameMap = Code2NameMap() lateinit var cacheRdLink: Map val defaultTranslateDistance = 3.0 - val testFlag:Boolean = true + val testFlag:Boolean = false fun checkCircleRoad(renderEntity: RenderEntity): Boolean { // val linkInId = renderEntity.properties["linkIn"] // val linkOutId = renderEntity.properties["linkOut"] @@ -58,7 +58,7 @@ class ImportPreProcess { )!=null) { var angle = renderEntity?.properties?.get("angle")?.toDouble()!! // angle角度为与正北方向的顺时针夹角,将其转换为与X轴正方向的逆时针夹角,即为正东方向的夹角 - angle = -((450 - angle) % 360) + angle = ((450 - angle) % 360) radian = Math.toRadians(angle) } else { var isReverse = false // 是否为逆向 @@ -135,7 +135,7 @@ class ImportPreProcess { // angle += 180 // } // angle角度为与正北方向的顺时针夹角,将其转换为与X轴正方向的逆时针夹角,即为正东方向的夹角 - angle = -((450 - angle) % 360) + angle = ((450 - angle) % 360) radian = Math.toRadians(angle) } else if (Geometry.TYPENAME_LINESTRING == geometry?.geometryType) { var coordinates = geometry.coordinates @@ -309,7 +309,7 @@ class ImportPreProcess { "angle" )?.toDouble()!! // angle角度为与正北方向的顺时针夹角,将其转换为与X轴正方向的逆时针夹角,即为正东方向的夹角 - angle = -((450 - angle) % 360) + angle = ((450 - angle) % 360) radian = Math.toRadians(angle) } else if (Geometry.TYPENAME_LINESTRING == geometry?.geometryType) { var coordinates = geometry.coordinates @@ -333,7 +333,7 @@ class ImportPreProcess { } } else renderEntity?.properties?.get("angle")?.toDouble()!! - angle = -((450 - angle) % 360) + angle = ((450 - angle) % 360) radian = Math.toRadians(angle) } @@ -697,7 +697,7 @@ class ImportPreProcess { "angle" )?.toDouble()!! // angle角度为与正北方向的顺时针夹角,将其转换为与X轴正方向的逆时针夹角,即为正东方向的夹角 - angle = -((450 - angle) % 360) + angle = ((450 - angle) % 360) radian = Math.toRadians(angle) } else if (Geometry.TYPENAME_LINESTRING == geometry?.geometryType) { var coordinates = geometry.coordinates @@ -718,7 +718,7 @@ class ImportPreProcess { } } else renderEntity?.properties?.get("angle")?.toDouble()!! - angle = -((450 - angle) % 360) + angle = ((450 - angle) % 360) radian = Math.toRadians(angle) } From 70b820a358151d236def33507cff168ebcbe65eb Mon Sep 17 00:00:00 2001 From: xiaoyan Date: Fri, 8 Sep 2023 17:20:39 +0800 Subject: [PATCH 4/4] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E6=9C=80=E9=AB=98?= =?UTF-8?q?=E7=BA=A7=E5=88=AB=E4=B8=8B=E7=BA=BF=E6=95=B0=E6=8D=AE=E5=87=BA?= =?UTF-8?q?=E7=8E=B0=E5=B9=BD=E7=81=B5=E6=B8=B2=E6=9F=93=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../personalcenter/PersonalCenterFragment.kt | 2 +- .../map/source/OMDBReferenceDataSource.java | 13 ++++++-- .../map/source/OMDBTileDataSource.java | 14 +++++++-- .../collect/library/utils/GeometryTools.java | 30 +++++++++++++++++++ vtm | 2 +- 5 files changed, 53 insertions(+), 8 deletions(-) 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 96e7543f..ab78744b 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 @@ -129,7 +129,7 @@ class PersonalCenterFragment(private var indoorDataListener: ((Boolean) -> Unit? // 定位到指定位置 niMapController.mMapView.vtmMap.animator() // .animateTo(GeoPoint( 40.05108004733645, 116.29187746293708 )) - .animateTo(GeoPoint(40.04315565069137, 116.28669540538765)) + .animateTo(GeoPoint(40.08785792571823, 116.27562659540283)) } R.id.personal_center_menu_open_all_layer -> { MapParamUtils.setDataLayerEnum(DataLayerEnum.SHOW_ALL_LAYERS) 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 b9ba60de..3722aec3 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 @@ -7,14 +7,17 @@ import androidx.annotation.RequiresApi; import com.navinfo.collect.library.data.entity.ReferenceEntity; import com.navinfo.collect.library.system.Constant; +import com.navinfo.collect.library.utils.GeometryTools; import com.navinfo.collect.library.utils.MapParamUtils; +import org.locationtech.jts.geom.Polygon; import org.oscim.layers.tile.MapTile; import org.oscim.tiling.ITileDataSink; import org.oscim.tiling.ITileDataSource; import org.oscim.tiling.QueryResult; import java.util.List; +import java.util.stream.Collectors; import io.realm.Realm; import io.realm.RealmQuery; @@ -33,7 +36,7 @@ public class OMDBReferenceDataSource implements ITileDataSource { @Override public void query(MapTile tile, ITileDataSink mapDataSink) { // 获取tile对应的坐标范围 - if (tile.zoomLevel >= Constant.OMDB_MIN_ZOOM && tile.zoomLevel <= Constant.OVER_ZOOM) { + if (tile.zoomLevel >= Constant.OMDB_MIN_ZOOM && tile.zoomLevel < Constant.OVER_ZOOM) { int m = Constant.OVER_ZOOM - tile.zoomLevel; int xStart = (int) tile.tileX << m; int xEnd = (int) ((tile.tileX + 1) << m); @@ -64,12 +67,16 @@ 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()); mThreadLocalDecoders.get().decode(tile.zoomLevel, tile, mapDataSink, listResult); + mapDataSink.completed(QueryResult.SUCCESS); + } else { + mapDataSink.completed(QueryResult.TILE_NOT_FOUND); } - mapDataSink.completed(QueryResult.SUCCESS); // Log.d("RealmDBTileDataSource", "tile:"+tile.getBoundingBox().toString()); } else { - mapDataSink.completed(QueryResult.SUCCESS); + mapDataSink.completed(QueryResult.TILE_NOT_FOUND); } } 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 e5720e14..49dbba31 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 @@ -7,14 +7,17 @@ import androidx.annotation.RequiresApi; import com.navinfo.collect.library.data.entity.RenderEntity; import com.navinfo.collect.library.system.Constant; +import com.navinfo.collect.library.utils.GeometryTools; import com.navinfo.collect.library.utils.MapParamUtils; +import org.locationtech.jts.geom.Polygon; import org.oscim.layers.tile.MapTile; import org.oscim.tiling.ITileDataSink; import org.oscim.tiling.ITileDataSource; import org.oscim.tiling.QueryResult; import java.util.List; +import java.util.stream.Collectors; import io.realm.Realm; import io.realm.RealmQuery; @@ -32,7 +35,7 @@ public class OMDBTileDataSource implements ITileDataSource { @Override public void query(MapTile tile, ITileDataSink mapDataSink) { // 获取tile对应的坐标范围 - if (tile.zoomLevel >= Constant.OMDB_MIN_ZOOM && tile.zoomLevel <= Constant.OVER_ZOOM) { + if (tile.zoomLevel >= Constant.OMDB_MIN_ZOOM && tile.zoomLevel < Constant.OVER_ZOOM) { int m = Constant.OVER_ZOOM - tile.zoomLevel; int xStart = (int) tile.tileX << m; int xEnd = (int) ((tile.tileX + 1) << m); @@ -61,12 +64,17 @@ public class OMDBTileDataSource implements ITileDataSource { realmQuery.endGroup(); } List listResult = realmQuery/*.distinct("id")*/.findAll(); + // 数据记录的tile号是以正外接tile号列表,此处过滤并未与当前tile相交的数据 if (!listResult.isEmpty()) { + Polygon tilePolygon = GeometryTools.getTilePolygon(tile); + listResult = listResult.stream().filter((RenderEntity renderEntity) -> renderEntity.getWkt().intersects(tilePolygon)).collect(Collectors.toList()); mThreadLocalDecoders.get().decode(tile.zoomLevel, tile, mapDataSink, listResult); + mapDataSink.completed(QueryResult.SUCCESS); + } else { + mapDataSink.completed(QueryResult.TILE_NOT_FOUND); } - mapDataSink.completed(QueryResult.SUCCESS); } else { - mapDataSink.completed(QueryResult.SUCCESS); + mapDataSink.completed(QueryResult.TILE_NOT_FOUND); } } diff --git a/collect-library/src/main/java/com/navinfo/collect/library/utils/GeometryTools.java b/collect-library/src/main/java/com/navinfo/collect/library/utils/GeometryTools.java index 02d1e1ff..8fe0be1e 100644 --- a/collect-library/src/main/java/com/navinfo/collect/library/utils/GeometryTools.java +++ b/collect-library/src/main/java/com/navinfo/collect/library/utils/GeometryTools.java @@ -2,6 +2,7 @@ package com.navinfo.collect.library.utils; import android.graphics.Point; import android.util.Log; + import org.locationtech.jts.geom.Coordinate; import org.locationtech.jts.geom.Geometry; import org.locationtech.jts.geom.GeometryFactory; @@ -13,7 +14,10 @@ import org.locationtech.jts.geom.Polygon; import org.locationtech.jts.io.WKTReader; import org.locationtech.jts.operation.linemerge.LineMerger; import org.oscim.core.GeoPoint; +import org.oscim.core.MercatorProjection; +import org.oscim.core.Tile; import org.oscim.map.Map; + import java.math.BigDecimal; import java.util.ArrayList; import java.util.Collection; @@ -251,6 +255,22 @@ public class GeometryTools { return gon.toString(); } + /** + * 创建多边形几何 + * + * @param coords [] + * @return Geometry + */ + public static Polygon createPolygonFromCoords(Coordinate[] coords) { + GeometryFactory factory = new GeometryFactory(); + + Polygon gon = factory.createPolygon(coords); + + if (gon == null) + return null; + return gon; + } + /** * 创建多边形几何 * @@ -1579,4 +1599,14 @@ public class GeometryTools { double radianDegree = 2 * Math.asin(Math.sin(radianDistance / 2) / Math.cos(radianLatitude)); return Math.toDegrees(radianDegree); } + + public static Polygon getTilePolygon(Tile tile) { + // 获取当前tile的起点坐标 + double startLongitude = MercatorProjection.tileXToLongitude(tile.tileX, tile.zoomLevel); + double startLatitude = MercatorProjection.tileYToLatitude(tile.tileY, tile.zoomLevel); + double endLongitude = MercatorProjection.tileXToLongitude(tile.tileX+1, tile.zoomLevel); + double endLatitude = MercatorProjection.tileYToLatitude(tile.tileY+1, tile.zoomLevel); + return GeometryTools.createPolygonFromCoords(new Coordinate[]{new Coordinate(startLongitude, startLongitude), new Coordinate(endLongitude, startLatitude), + new Coordinate(endLongitude, endLatitude), new Coordinate(startLongitude, endLatitude), new Coordinate(startLongitude, startLongitude)}); + } } diff --git a/vtm b/vtm index a087521b..d1ac330c 160000 --- a/vtm +++ b/vtm @@ -1 +1 @@ -Subproject commit a087521b6e1b312d7ed2bdf20f83b0e674fad9b5 +Subproject commit d1ac330cf7a8727bb2065093e72d60521775ba6d