diff --git a/app/src/main/assets/omdb_config.json b/app/src/main/assets/omdb_config.json index 46d82ecc..0a684a78 100644 --- a/app/src/main/assets/omdb_config.json +++ b/app/src/main/assets/omdb_config.json @@ -153,14 +153,20 @@ "isDependOnOtherTable": false, "zoomMin": 18, "zoomMax": 20, - "transformer": [ - { - "k": "geometry", - "v": "~", - "klib": "geometry", - "vlib": "generateLaneTypeAccessS2ERefPoint()" - } - ] + "transformer": [ + { + "k": "geometry", + "v": "~", + "klib": "geometry", + "vlib": "filterLaneTypeAccess()" + }, + { + "k": "geometry", + "v": "~", + "klib": "geometry", + "vlib": "generateLaneTypeAccessS2ERefPoint()" + } + ] }, "2097": { "table": "OMDB_PHY_LANENUM", 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 57ba6e93..ba296f44 100644 --- a/app/src/main/java/com/navinfo/omqs/db/ImportPreProcess.kt +++ b/app/src/main/java/com/navinfo/omqs/db/ImportPreProcess.kt @@ -248,12 +248,26 @@ class ImportPreProcess { //insertData(listResult) } + /** + * 过滤车道类型数据,只保留加速车道、减速车道和自行车道 + * */ + fun filterLaneTypeAccess(renderEntity: RenderEntity): Boolean { + if (renderEntity.properties["laneType"]!!.toInt() and (0b1100) > 0 || renderEntity.properties["laneType"]!!.toInt() and (0b1 shl 19) > 0) { // 是加速车道/减速车道/自行车道 + // 如果是自行车道,需要在properties中增加新的属性,用于渲染自行车道的特殊线型 + if (renderEntity.properties["laneType"]!!.toInt() and (0b1 shl 19) > 0) { + renderEntity.properties["bike"] = "true" + } + return true + } + return false + } + /** * 生成车道类型起终点参考数据 * */ fun generateLaneTypeAccessS2ERefPoint(renderEntity: RenderEntity) { - // 如果车道类型非常规车道(第0bit的数据),则需要生成辅助数据 - if (renderEntity.properties["laneType"]!!.toInt()>0) { + // 只需要生成加速车道和减速车道的起终点辅助数据 + if (renderEntity.properties["laneType"]!!.toInt() and (0b1100) > 0) { // 是加速车道或者减速车道 val geometry = GeometryTools.createGeometry(renderEntity.properties["geometry"]) val pointEnd = geometry!!.coordinates[geometry.numPoints - 1] // 获取这个geometry对应的结束点坐标 @@ -274,7 +288,7 @@ class ImportPreProcess { startReference.geometry = GeometryTools.createGeometry(GeoPoint(pointStart.y, pointStart.x)).toString() startReference.properties["qi_table"] = renderEntity.table - startReference.properties["type"] = "s_2_p" + startReference.properties["type"] = "s${if (renderEntity.properties["laneType"]!!.toInt() and (0b1000)>0) "_dec" else "_acc"}" startReference.properties["geometry"] = startReference.geometry listResult.add(startReference) @@ -292,7 +306,7 @@ class ImportPreProcess { endReference.geometry = GeometryTools.createGeometry(GeoPoint(pointEnd.y, pointEnd.x)).toString() endReference.properties["qi_table"] = renderEntity.table - endReference.properties["type"] = "e_2_p" + endReference.properties["type"] = "e${if (renderEntity.properties["laneType"]!!.toInt() and (0b1000)>0) "_dec" else "_acc"}" endReference.properties["geometry"] = endReference.geometry renderEntity.referenceEntitys?.add(endReference) //listResult.add(endReference) @@ -1101,4 +1115,118 @@ class ImportPreProcess { renderEntity.properties["ref"] = "${renderEntity.properties["maxSpeed"]}|${renderEntity.properties["minSpeed"]}" } } + + /** + * 生成立交的辅助图层数据 + * */ + fun obtainZLevelReference(renderEntity: RenderEntity) { + if(renderEntity!=null&&renderEntity.properties.containsKey("zlevelList")) { + // 获取ZLevelList数据 + val zLevelList = JSONArray(renderEntity.properties["zlevelList"]) + for (i in 0 until zLevelList.length()) { + val zLevelObject = zLevelList.getJSONObject(i) + // 获取ZLevelObject的startEnd字段值 + val startEnd = zLevelObject.optInt("startEnd", 0) + val zLevel = zLevelObject.optInt("zlevel", 0) + val shpSeqNum = zLevelObject.optInt("shpSeqNum", 0) + val linkGeometry = GeometryTools.createGeometry(zLevelObject.optString("linkGeometry")) + val coordinates = linkGeometry!!.coordinates + val referenceEntityList = mutableListOf() + // 判断当前数据的startEnd,如果是0则向前和向后都绘制线,如果是1(起点)则只绘制前两个点组成的线,如果是2(终点)则只绘制后两个点组成的线 + if (startEnd == 0 || startEnd == 1) { // 处理向后的线 + val zLevelReference = createZLevelReference(renderEntity) + zLevelReference.properties["type"] = "zlevelLine" +// zLevelReference.properties["name"] = zLevel.toString() + // 根据shpSeqNum获取对应的点位 + if (shpSeqNum < coordinates.size-1) { + val currentCoordinate = coordinates[shpSeqNum] + var nextCoordinate = coordinates[shpSeqNum+1] + // 计算两个点的距离,如果小于指定阈值,程序按照方向计算延长线 +// if (GeometryTools.getDistance(currentCoordinate.y, currentCoordinate.x, nextCoordinate.y, nextCoordinate.x) < 3.0) { + // 获取当前点到下一个点的线方向 + val angle = Angle.angle(currentCoordinate, nextCoordinate) + // 计算偏移距离 + val dx: Double = GeometryTools.convertDistanceToDegree( + 3.0, + currentCoordinate.y!! + ) * Math.cos(angle) + val dy: Double = GeometryTools.convertDistanceToDegree( + 3.0, + currentCoordinate.y!! + ) * Math.sin(angle) + + // 计算偏移后的点 + nextCoordinate = + Coordinate(currentCoordinate.getX() + dx, currentCoordinate.getY() + dy) +// } + zLevelReference.geometry = GeometryTools.createLineString(arrayListOf(GeoPoint(currentCoordinate.y, currentCoordinate.x), GeoPoint(nextCoordinate.y, nextCoordinate.x))).toString() + + referenceEntityList.add(zLevelReference) + + val zLevelNameReference = createZLevelReference(renderEntity) + zLevelNameReference.properties["type"] = "zlevelName" + zLevelNameReference.properties["name"] = zLevel.toString() + zLevelNameReference.geometry = GeometryTools.createGeometry(GeoPoint(nextCoordinate.y, nextCoordinate.x)).toString() + referenceEntityList.add(zLevelNameReference) + } + } + + if (startEnd == 0 || startEnd == 2) { // 处理向前的线 + val zLevelReference = createZLevelReference(renderEntity) + zLevelReference.properties["type"] = "zlevelLine" +// zLevelReference.properties["name"] = zLevel.toString() + // 根据shpSeqNum获取对应的点位 + if (shpSeqNum < coordinates.size&&shpSeqNum>0) { + val currentCoordinate = coordinates[shpSeqNum] + var preCoordinate = coordinates[shpSeqNum-1] + // 计算两个点的距离,如果小于指定阈值,程序按照方向计算延长线 +// if (GeometryTools.getDistance(currentCoordinate.y, currentCoordinate.x, preCoordinate.y, preCoordinate.x) < 3.0) { + // 获取当前点到下一个点的线方向 + val angle = Angle.angle(currentCoordinate, preCoordinate) + // 计算偏移距离 + val dx: Double = GeometryTools.convertDistanceToDegree( + 3.0, + currentCoordinate.y!! + ) * Math.cos(angle) + val dy: Double = GeometryTools.convertDistanceToDegree( + 3.0, + currentCoordinate.y!! + ) * Math.sin(angle) + + // 计算偏移后的点 + preCoordinate = + Coordinate(currentCoordinate.getX() + dx, currentCoordinate.getY() + dy) +// } + zLevelReference.geometry = GeometryTools.createLineString(arrayListOf(GeoPoint(currentCoordinate.y, currentCoordinate.x), GeoPoint(preCoordinate.y, preCoordinate.x))).toString() + referenceEntityList.add(zLevelReference) + + val zLevelNameReference = createZLevelReference(renderEntity) + zLevelNameReference.properties["type"] = "zlevelName" + zLevelNameReference.properties["name"] = zLevel.toString() + zLevelNameReference.geometry = GeometryTools.createGeometry(GeoPoint(preCoordinate.y, preCoordinate.x)).toString() + referenceEntityList.add(zLevelNameReference) + } + } + + insertData(referenceEntityList) + // 移除zlevelList,减小原始数据大小 + renderEntity.properties.remove("zlevelList") + } + } + } + + private fun createZLevelReference(renderEntity: RenderEntity): ReferenceEntity { + val zLevelReference = ReferenceEntity() + zLevelReference.renderEntityId = renderEntity.id + zLevelReference.name = "${renderEntity.name}参考点" + zLevelReference.code = renderEntity.code + zLevelReference.table = renderEntity.table + zLevelReference.zoomMin = renderEntity.zoomMin + zLevelReference.zoomMax = renderEntity.zoomMax + zLevelReference.taskId = renderEntity.taskId + zLevelReference.enable = renderEntity.enable + + zLevelReference.properties["qi_table"] = renderEntity.table + return zLevelReference + } } \ No newline at end of file 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 8de5a029..51342551 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 @@ -196,7 +196,7 @@ class PersonalCenterFragment(private var indoorDataListener: ((Boolean) -> Unit? // 定位到指定位置 niMapController.mMapView.vtmMap.animator() // .animateTo(GeoPoint( 40.05108004733645, 116.29187746293708 )) - .animateTo(GeoPoint(31.205913609396507, 121.56955739056055 )) + .animateTo(GeoPoint(39.63769191655024, 115.58991663847937)) } R.id.personal_center_menu_open_all_layer -> { diff --git a/collect-library/src/main/assets/editormarker.xml b/collect-library/src/main/assets/editormarker.xml index 7ac93b78..f3e26dc5 100644 --- a/collect-library/src/main/assets/editormarker.xml +++ b/collect-library/src/main/assets/editormarker.xml @@ -2058,17 +2058,38 @@ + + + + + + + + + + + + + - - + + - - + - - + + + + + + + diff --git a/collect-library/src/main/assets/omdb/icon_2092_acc_e.svg b/collect-library/src/main/assets/omdb/icon_2092_acc_e.svg new file mode 100644 index 00000000..0dec78b2 --- /dev/null +++ b/collect-library/src/main/assets/omdb/icon_2092_acc_e.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/collect-library/src/main/assets/omdb/icon_2092_acc_s.svg b/collect-library/src/main/assets/omdb/icon_2092_acc_s.svg new file mode 100644 index 00000000..662697c9 --- /dev/null +++ b/collect-library/src/main/assets/omdb/icon_2092_acc_s.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/collect-library/src/main/assets/omdb/icon_2092_dec_e.svg b/collect-library/src/main/assets/omdb/icon_2092_dec_e.svg new file mode 100644 index 00000000..5657b2cd --- /dev/null +++ b/collect-library/src/main/assets/omdb/icon_2092_dec_e.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/collect-library/src/main/assets/omdb/icon_2092_dec_s.svg b/collect-library/src/main/assets/omdb/icon_2092_dec_s.svg new file mode 100644 index 00000000..b9f5ec97 --- /dev/null +++ b/collect-library/src/main/assets/omdb/icon_2092_dec_s.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/collect-library/src/main/assets/omdb/icon_2092_e.svg b/collect-library/src/main/assets/omdb/icon_2092_e.svg deleted file mode 100644 index 96006c66..00000000 --- a/collect-library/src/main/assets/omdb/icon_2092_e.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/collect-library/src/main/assets/omdb/icon_2092_s.svg b/collect-library/src/main/assets/omdb/icon_2092_s.svg deleted file mode 100644 index 83a60267..00000000 --- a/collect-library/src/main/assets/omdb/icon_2092_s.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/vtm b/vtm index 9e0cc6dc..ee88167c 160000 --- a/vtm +++ b/vtm @@ -1 +1 @@ -Subproject commit 9e0cc6dcdce04d1082ed6459e8810d6329e8cfdc +Subproject commit ee88167c7de989b3f7c71ae00d9580ff91fd3bf6