Merge branch 'master' of gitlab.navinfo.com:CollectVehicle/OneMapQS

This commit is contained in:
squallzhjch 2023-05-26 14:01:49 +08:00
commit c94eb5654d
19 changed files with 254 additions and 58 deletions

3
.gitignore vendored
View File

@ -12,5 +12,4 @@
/build
/captures
.externalNativeBuild
.cxx
local.properties
.cxx

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "vtm"]
path = vtm
url = git@github.com:mapsforge/vtm.git

View File

@ -75,6 +75,12 @@
"v": "0",
"klib": "maxSpeed",
"vlib": "限"
},
{
"k": "geometry",
"v": "~",
"klib": "geometry",
"vlib": "translateRight()"
}
]
},
@ -119,7 +125,28 @@
"4006":{
"table": "OMDB_RESTRICTION",
"code": 4006,
"name": "普通交限"
"name": "普通交限",
"transformer": [
{
"k": "geometry",
"v": "~",
"klib": "geometry",
"vlib": "translateRightWithAngle()"
}
]
},
"4022": {
"table": "OMDB_TRAFFICLIGHT",
"code": 4022,
"name": "交通灯",
"transformer": [
{
"k": "angle",
"v": "~",
"klib": "angle",
"vlib": "0"
}
]
},
"4022":{
"table": "OMDB_TRAFFICLIGHT",
@ -131,6 +158,5 @@
"code": 5001,
"name": "车道中心线"
}
}
}

View File

@ -75,7 +75,7 @@ class Constant {
const val SELECT_TAKEPHOTO_OR_RECORD = "select_takephoto_or_record"
const val OMDB_CONFIG = "omdb_config.json"
const val OTHER_CONFIG = "other.config"
const val OTHER_CONFIG = "other_config.json"
val OMDB_LAYER_VISIBLE_LIST: MutableList<String> = mutableListOf() // 记录OMDB数据显示的图层名称列表

View File

@ -32,23 +32,25 @@ class ImportConfig {
}
// 开始解析key和value并对数据进行匹配
m@ for (k in processKeyOrValue(key)) {
for (v in processKeyOrValue(value)) {
if ("~" == v &&renderEntity.properties.containsKey(k)) { // ~符可以匹配任意元素
if (valuelib.endsWith("()")) { // 以()结尾说明该value配置是一个function需要通过反射调用指定方法
val method = preProcess::class.declaredMemberFunctions.first { it.name == valuelib.replace("()", "") }
method.call(preProcess, renderEntity)
} else {
renderEntity.properties[keylib] = valuelib
if (renderEntity.properties.containsKey(k)) { // json配置的key可以匹配到数据
for (v in processKeyOrValue(value)) {
if ("~" == v ) { // ~符可以匹配任意元素
if (valuelib.endsWith("()")) { // 以()结尾说明该value配置是一个function需要通过反射调用指定方法
val method = preProcess::class.declaredMemberFunctions.first { it.name == valuelib.replace("()", "") }
method.call(preProcess, renderEntity)
} else {
renderEntity.properties[keylib] = valuelib
}
break@m
} else if (renderEntity.properties[k] == v) { // 完全匹配
if (valuelib.endsWith("()")) { // 以()结尾说明该value配置是一个function需要通过反射调用指定方法
val method = preProcess::class.declaredMemberFunctions.first { it.name == valuelib.replace("()", "") }
method.call(preProcess, renderEntity)
} else {
renderEntity.properties[keylib] = valuelib
}
break@m
}
break@m
} else if (renderEntity.properties[k] == v) {
if (valuelib.endsWith("()")) { // 以()结尾说明该value配置是一个function需要通过反射调用指定方法
val method = preProcess::class.declaredMemberFunctions.first { it.name == valuelib.replace("()", "") }
method.call(preProcess, renderEntity)
} else {
renderEntity.properties[keylib] = valuelib
}
break@m
}
}
}

View File

@ -1,6 +1,12 @@
package com.navinfo.omqs.db
import com.navinfo.collect.library.data.entity.RenderEntity
import com.navinfo.collect.library.utils.GeometryTools
import org.locationtech.jts.algorithm.Angle
import org.locationtech.jts.geom.Coordinate
import org.locationtech.jts.geom.Geometry
import org.oscim.core.GeoPoint
class ImportPreProcess {
/**
@ -11,4 +17,94 @@ class ImportPreProcess {
renderEntity.properties["foo"] = "bar"
return renderEntity
}
/**
* 计算指定数据指定方向的坐标
* */
fun translateRight(renderEntity: RenderEntity): RenderEntity {
// 获取当前renderEntity的geometry
val geometry = renderEntity.wkt
var radian = 0.0 // geometry的角度如果是点获取angle如果是线获取最后两个点的方向
var point = Coordinate(geometry?.coordinate)
if (Geometry.TYPENAME_POINT == geometry?.geometryType) {
val angle = if(renderEntity?.properties?.get("angle") == null) 0.0 else renderEntity?.properties?.get("angle")?.toDouble()!!
radian = Math.toRadians(angle)
} else if (Geometry.TYPENAME_LINESTRING == geometry?.geometryType) {
val p1: Coordinate = geometry.coordinates.get(geometry.coordinates.size - 2)
val p2: Coordinate = geometry.coordinates.get(geometry.coordinates.size - 1)
// 计算线段的方向
radian = Angle.angle(p1, p2)
point = p2
}
// 计算偏移距离
val dx: Double = GeometryTools.convertDistanceToDegree(3.0, geometry?.coordinate?.y!!) * Math.cos(radian)
val dy: Double = GeometryTools.convertDistanceToDegree(3.0, geometry?.coordinate?.y!!) * Math.sin(radian)
// 计算偏移后的点
val coord =
Coordinate(point.getX() + dy, point.getY() - dx)
// 将这个点记录在数据中
val geometryTranslate: Geometry = GeometryTools.createGeometry(doubleArrayOf(coord.x, coord.y))
renderEntity.geometry = geometryTranslate.toString()
return renderEntity
}
/**
* 将要素按照点位角度的垂直方向右移5米并生成一个按照垂直角度指向方向的线段用以显示有方向的图标
* */
fun translateRightWithAngle(renderEntity: RenderEntity): RenderEntity {
// 获取当前renderEntity的geometry
val geometry = renderEntity.wkt
var radian = 0.0 // geometry的角度如果是点获取angle如果是线获取最后两个点的方向
var point = Coordinate(geometry?.coordinate)
if (Geometry.TYPENAME_POINT == geometry?.geometryType) {
val angle = if(renderEntity?.properties?.get("angle") == null) 0.0 else renderEntity?.properties?.get("angle")?.toDouble()!!
radian = Math.toRadians(angle)
} else if (Geometry.TYPENAME_LINESTRING == geometry?.geometryType) {
val p1: Coordinate = geometry.coordinates.get(geometry.coordinates.size - 2)
val p2: Coordinate = geometry.coordinates.get(geometry.coordinates.size - 1)
// 计算线段的方向
radian = Angle.angle(p1, p2)
point = p2
}
// 根据角度计算偏移距离
val dx: Double = GeometryTools.convertDistanceToDegree(3.0, geometry?.coordinate?.y!!) * Math.cos(radian)
val dy: Double = GeometryTools.convertDistanceToDegree(3.0, geometry?.coordinate?.y!!) * Math.sin(radian)
// 计算偏移后的点
// val coordMid =
// Coordinate(point.getX() + dy, point.getY() - dx)
val pointStart = GeoPoint(point.getY() - dx, point.getX() + dy)
// val pointStart = GeoPoint(pointMid.latitude-dy, pointMid.longitude-dx)
val pointEnd = GeoPoint(pointStart.latitude- dx, pointStart.longitude+ dy)
// 将这个线记录在数据中
val geometryTranslate: Geometry = GeometryTools.createLineString(listOf(pointStart, pointEnd))
renderEntity.geometry = geometryTranslate.toString()
return renderEntity
}
fun addAngleFromGeometry(renderEntity: RenderEntity): String {
if (!renderEntity.properties.containsKey("angle")) {
if (renderEntity.wkt!=null) {
val geometry = renderEntity.wkt
var angle: String = "90"
if (geometry?.numPoints!!>=2) {
val p1: Coordinate = geometry?.coordinates?.get(geometry.coordinates.size - 2)!!
val p2: Coordinate = geometry?.coordinates?.get(geometry.coordinates.size - 1)!!
// 弧度转角度
angle = Math.toDegrees(Angle.angle(p1, p2)).toString()
} else {
angle = "90"
}
// 计算线段的方向
renderEntity.properties["angle"] = angle
return angle
}
}
return "0"
}
}

View File

@ -1,5 +0,0 @@
package com.navinfo.omqs.rule
class LeftPanel {
}

View File

@ -182,9 +182,9 @@ class LoginViewModel @Inject constructor(
Realm.setDefaultConfiguration(config)
// 拷贝配置文件到用户目录下
val omdbConfigFile = File(userFolder.absolutePath, Constant.OMDB_CONFIG);
if (!omdbConfigFile.exists()) {
// if (!omdbConfigFile.exists()) {
ResourceUtils.copyFileFromAssets(Constant.OMDB_CONFIG, omdbConfigFile.absolutePath)
}
// }
}
/**

View File

@ -111,7 +111,7 @@ class PersonalCenterFragment : BaseFragment(), FSAFActivityCallbacks {
viewModel.readRealmData()
// 定位到指定位置
niMapController.mMapView.vtmMap.animator()
.animateTo(GeoPoint(40.1012346774074730, 116.25571303257621))
.animateTo(GeoPoint(28.724637921467508 ,115.83412668023867 ))
}
R.id.personal_center_menu_task_list -> {
findNavController().navigate(R.id.TaskManagerFragment)

View File

@ -8,9 +8,14 @@ buildscript {
}
}
plugins {
id 'com.android.application' version '7.3.1' apply false
id 'com.android.library' version '7.3.1' apply false
id 'com.android.application' version '7.4.2' apply false
id 'com.android.library' version '7.4.2' apply false
id 'org.jetbrains.kotlin.android' version '1.8.0' apply false
id 'com.google.dagger.hilt.android' version '2.44' apply false
}
static def androidCompileSdk() { return 33 }
allprojects {
ext.gdxVersion = "1.11.0"
ext.gwtVersion = "2.8.2"
ext.slf4jVersion = "1.7.28"
}

View File

@ -45,6 +45,12 @@ android {
sourceSets {
main {
jniLibs.srcDirs = ['libs']
file("../vtm/vtm-android/natives").eachDir() { dir ->
jniLibs.srcDirs += "${dir.path}/lib"
}
file("../vtm/vtm-android-gdx/natives").eachDir() { dir ->
jniLibs.srcDirs += "${dir.path}/lib"
}
}
}
}
@ -72,25 +78,34 @@ dependencies {
// VTM依赖
implementation "net.sf.kxml:kxml2:2.3.0"
implementation 'org.slf4j:slf4j-api:2.0.7'
api "org.mapsforge:vtm:$vtmVersion"
implementation "org.mapsforge:vtm-themes:$vtmVersion"
implementation "org.mapsforge:vtm-android:$vtmVersion"
runtimeOnly "org.mapsforge:vtm-android:$vtmVersion:natives-armeabi-v7a"
runtimeOnly "org.mapsforge:vtm-android:$vtmVersion:natives-arm64-v8a"
runtimeOnly "org.mapsforge:vtm-android:$vtmVersion:natives-x86"
runtimeOnly "org.mapsforge:vtm-android:$vtmVersion:natives-x86_64"
implementation "org.mapsforge:vtm-http:$vtmVersion"
implementation project(":vtm-themes")
implementation project(":vtm-android")
implementation project(':vtm-extras')
implementation project(":vtm-http")
// implementation "org.mapsforge:vtm-themes:$vtmVersion"
// implementation "org.mapsforge:vtm-android:$vtmVersion"
// runtimeOnly "org.mapsforge:vtm-android:$vtmVersion:natives-armeabi-v7a"
// runtimeOnly "org.mapsforge:vtm-android:$vtmVersion:natives-arm64-v8a"
// runtimeOnly "org.mapsforge:vtm-android:$vtmVersion:natives-x86"
// runtimeOnly "org.mapsforge:vtm-android:$vtmVersion:natives-x86_64"
// implementation "org.mapsforge:vtm-http:$vtmVersion"
implementation "org.mapsforge:vtm-json:$vtmVersion"
implementation "org.mapsforge:vtm-gdx:$vtmVersion"
implementation "org.mapsforge:vtm-android-mvt:$vtmVersion"
implementation "org.mapsforge:vtm-mvt:$vtmVersion"
implementation project(":vtm-json")
// implementation project(":vtm-gdx")
// implementation project(":vtm-gdx-poi3d")
implementation project(":vtm-android-mvt")
implementation project(":vtm-mvt")
// implementation "org.mapsforge:vtm-json:$vtmVersion"
// implementation "org.mapsforge:vtm-gdx:$vtmVersion"
// implementation "org.mapsforge:vtm-android-mvt:$vtmVersion"
// implementation "org.mapsforge:vtm-mvt:$vtmVersion"
runtimeOnly "org.mapsforge:vtm-android-gdx:$vtmVersion:natives-armeabi-v7a"
runtimeOnly "org.mapsforge:vtm-android-gdx:$vtmVersion:natives-arm64-v8a"
runtimeOnly "org.mapsforge:vtm-android-gdx:$vtmVersion:natives-x86"
runtimeOnly "org.mapsforge:vtm-android-gdx:$vtmVersion:natives-x86_64"
implementation "org.mapsforge:vtm-android-gdx:$vtmVersion"
// implementation project(":vtm-android-gdx")
// runtimeOnly "org.mapsforge:vtm-android-gdx:$vtmVersion:natives-armeabi-v7a"
// runtimeOnly "org.mapsforge:vtm-android-gdx:$vtmVersion:natives-arm64-v8a"
// runtimeOnly "org.mapsforge:vtm-android-gdx:$vtmVersion:natives-x86"
// runtimeOnly "org.mapsforge:vtm-android-gdx:$vtmVersion:natives-x86_64"
// implementation "org.mapsforge:vtm-android-gdx:$vtmVersion"
implementation "com.google.protobuf:protobuf-java:3.6.1"
implementation "com.wdtinc:mapbox-vector-tile:3.1.0"
@ -98,7 +113,8 @@ dependencies {
implementation "com.badlogicgames.gdx:gdx:1.11.0"
implementation "com.badlogicgames.gdx:gdx-backend-android:1.11.0"
implementation "com.caverock:androidsvg:1.4"
api "org.mapsforge:vtm-jts:$vtmVersion"
// api "org.mapsforge:vtm-jts:$vtmVersion"
api project(":vtm-jts")
api 'org.locationtech.jts:jts-core:1.19.0'
implementation 'com.squareup.okhttp3:okhttp:5.0.0-alpha.11'
implementation 'com.squareup.okio:okio:3.3.0'

View File

@ -94,6 +94,7 @@
<xs:enumeration value="name"/>
<xs:enumeration value="maxSpeed"/><!--最高速度-->
<xs:enumeration value="minSpeed"/><!--最低速度-->
<xs:enumeration value="angle"/><!--角度-->
<xs:enumeration value="ref"/>
</xs:restriction>
</xs:simpleType>

View File

@ -1730,7 +1730,7 @@
stroke-width="1.0"></caption>
</m>
<m v="1">
<caption k="maxSpeed" fill="#000000" priority="0" size="16" stroke="#ffffff"
<caption k="maxSpeed" fill="#000000" priority="0" size="14" stroke="#ffffff"
stroke-width="1.0"></caption>
<symbol src="assets:omdb/icon_4002_1.png" symbol-width="46" symbol-height="46"></symbol>
<!-- <circle fill="#ffffff" radius="28" scale-radius="true" stroke="#00ff00" stroke-width="6"/>-->
@ -1818,14 +1818,14 @@
<m k="speedFlag">
<m v="0">
<!-- <symbol src="assets:omdb/round_speedlimit.svg" symbol-width="30" symbol-height="30"></symbol>-->
<caption k="maxSpeed" fill="#000000" priority="0" size="16" stroke="#ffffff"
<caption k="maxSpeed" fill="#000000" priority="0" size="14" stroke="#ffffff"
stroke-width="1.0"></caption>
<symbol src="assets:omdb/icon_4003_0.png" symbol-width="46" symbol-height="46"></symbol>
<caption k="minSpeed" dy="-28" fill="#000000" priority="0" size="14" stroke="#ffffff"
stroke-width="1.0"></caption>
</m>
<m v="1">
<caption k="maxSpeed" fill="#000000" priority="0" size="16" stroke="#ffffff"
<caption k="maxSpeed" fill="#000000" priority="0" size="14" stroke="#ffffff"
stroke-width="1.0"></caption>
<symbol src="assets:omdb/icon_4003_1.png" symbol-width="46" symbol-height="46"></symbol>
<caption k="minSpeed" dy="-28" fill="#000000" priority="0" size="14" stroke="#ffffff"
@ -1837,14 +1837,14 @@
<m v="OMDB_SPEEDLIMIT_VAR">
<m v="0">
<!-- <symbol src="assets:omdb/round_speedlimit.svg" symbol-width="30" symbol-height="30"></symbol>-->
<caption k="maxSpeed" fill="#000000" priority="0" size="16" stroke="#ffffff"
<caption k="maxSpeed" fill="#000000" priority="0" size="14" stroke="#ffffff"
stroke-width="1.0"></caption>
<symbol src="assets:omdb/icon_4004_0.png" symbol-width="46" symbol-height="46"></symbol>
<caption k="minSpeed" dy="-28" fill="#000000" priority="0" size="14" stroke="#ffffff"
stroke-width="1.0"></caption>
</m>
<m v="1">
<caption k="maxSpeed" fill="#000000" priority="0" size="16" stroke="#ffffff"
<caption k="maxSpeed" fill="#000000" priority="0" size="14" stroke="#ffffff"
stroke-width="1.0"></caption>
<symbol src="assets:omdb/icon_4004_1.png" symbol-width="46" symbol-height="46"></symbol>
<caption k="minSpeed" dy="-28" fill="#000000" priority="0" size="14" stroke="#ffffff"
@ -1860,7 +1860,7 @@
<m k="direct">
<m v="2">
<!-- <lineSymbol src="assets:omdb/oneway_right.svg"></lineSymbol>-->
<symbol src="assets:omdb/oneway_right.svg" repeat-start="99.9" repeat="false" ></symbol>
<lineSymbol src="assets:omdb/oneway_right.svg" ></lineSymbol>
</m>
<m v="3">
<!-- <lineSymbol src="assets:omdb/oneway_left.svg"></lineSymbol>-->
@ -1868,5 +1868,16 @@
</m>
</m>
</m>
<!--交通灯-->
<m v="OMDB_TRAFFICLIGHT">
<symbol src="assets:omdb/icon_4022_0.png" repeat="false" symbol-width="14" symbol-height="40" rotate="false"></symbol>
</m>
<!--普通交限-->
<m v="OMDB_RESTRICTION">
<symbol src="assets:omdb/icon_4006_0.png" repeat="false" symbol-width="35" symbol-height="35" rotate="true" repeat-start="0" ></symbol>
<!-- <line stroke="#14582c" width="0.1"/>-->
<!-- <caption k="angle" fill="#000000" priority="0" size="14" stroke="#ffffff"-->
<!-- stroke-width="1.0"></caption>-->
</m>
</m>
</rendertheme>

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -22,7 +22,7 @@ open class RenderEntity() : RealmObject() {
lateinit var name: String //要素名
lateinit var table: String //要素表名
var code: Int = 0 // 要素编码
var geometry: String = ""
var geometry: String = "" // 要素渲染参考的geometry该数据可能会在导入预处理环节被修改原始geometry会保存在properties的geometry字段下
get() {
wkt = GeometryTools.createGeometry(field)
return field

View File

@ -1,6 +1,6 @@
#Tue Mar 21 10:15:37 CST 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

View File

@ -30,5 +30,46 @@ dependencyResolutionManagement {
}
}
rootProject.name = "OMQualityInspection"
include ':app'
include ':collect-library'
//include ':vtm:vtm'
//include ':vtm:vtm-android'
//include ':vtm:vtm-android-gdx'
//include ':vtm:vtm-android-mvt'
//include ':vtm:vtm-extras'
//include ':vtm:vtm-gdx'
//include ':vtm:vtm-gdx-poi3d'
//include ':vtm:vtm-http'
//include ':vtm:vtm-json'
//include ':vtm:vtm-jts'
//include ':vtm:vtm-models'
//include ':vtm:vtm-mvt'
//include ':vtm:vtm-theme-comparator'
//include ':vtm:vtm-themes'
include ':vtm'
include ':vtm-models'
include ':vtm-themes'
include ':vtm-android-mvt'
include ':vtm-android-gdx'
include ':vtm-android'
include ':vtm-mvt'
include ':vtm-gdx'
include ':vtm-jts'
include ':vtm-http'
include ':vtm-json'
include ':vtm-extras'
include ':vtm-gdx-poi3d'
project(':vtm').projectDir = new File(rootDir, 'vtm/vtm/')
project(':vtm-models').projectDir = new File(rootDir, 'vtm/vtm-models/')
project(':vtm-themes').projectDir = new File(rootDir, 'vtm/vtm-themes/')
project(':vtm-android-mvt').projectDir = new File(rootDir, 'vtm/vtm-android-mvt/')
project(':vtm-android-gdx').projectDir = new File(rootDir, 'vtm/vtm-android-gdx/')
project(':vtm-android').projectDir = new File(rootDir, 'vtm/vtm-android/')
project(':vtm-mvt').projectDir = new File(rootDir, 'vtm/vtm-mvt/')
project(':vtm-gdx').projectDir = new File(rootDir, 'vtm/vtm-gdx/')
project(':vtm-jts').projectDir = new File(rootDir, 'vtm/vtm-jts/')
project(':vtm-http').projectDir = new File(rootDir, 'vtm/vtm-http/')
project(':vtm-json').projectDir = new File(rootDir, 'vtm/vtm-json/')
project(':vtm-extras').projectDir = new File(rootDir, 'vtm/vtm-extras/')
project(':vtm-gdx-poi3d').projectDir = new File(rootDir, 'vtm/vtm-gdx-poi3d/')

1
vtm Submodule

@ -0,0 +1 @@
Subproject commit dd13e533c38b5738ab404c2737d7ccadeff01323