fix: omdb_config增加是否引入3D Z轴数据参数,默认不引入,如果引入,数据按照3D样式渲染
This commit is contained in:
parent
df2524244f
commit
b3bb83032b
@ -129,6 +129,39 @@
|
|||||||
"zoomMax": 20,
|
"zoomMax": 20,
|
||||||
"transformer2Code": ""
|
"transformer2Code": ""
|
||||||
},
|
},
|
||||||
|
"3005":{
|
||||||
|
"table": "OMDB_TRAFFIC_SIGN",
|
||||||
|
"code": 3005,
|
||||||
|
"name": "交通标牌",
|
||||||
|
"is3D": true,
|
||||||
|
"transformer": [
|
||||||
|
{
|
||||||
|
"k": "geometry",
|
||||||
|
"v": "~",
|
||||||
|
"klib": "geometry",
|
||||||
|
"vlib": "normalizationTrafficSignHeight()"
|
||||||
|
},{
|
||||||
|
"k": "geometry",
|
||||||
|
"v": "~",
|
||||||
|
"klib": "geometry",
|
||||||
|
"vlib": "generateDirectReferenceLine('', 0.2)"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"3006":{
|
||||||
|
"table": "OMDB_POLE",
|
||||||
|
"code": 3006,
|
||||||
|
"name": "杆状物",
|
||||||
|
"is3D": true,
|
||||||
|
"transformer": [
|
||||||
|
{
|
||||||
|
"k": "geometry",
|
||||||
|
"v": "~",
|
||||||
|
"klib": "geometry",
|
||||||
|
"vlib": "normalizationPoleHeight()"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"3012":{
|
"3012":{
|
||||||
"table": "OMDB_FILL_AREA",
|
"table": "OMDB_FILL_AREA",
|
||||||
"code": 3012,
|
"code": 3012,
|
||||||
|
@ -125,6 +125,7 @@ class TableInfo {
|
|||||||
val name: String = ""
|
val name: String = ""
|
||||||
var checked : Boolean = true
|
var checked : Boolean = true
|
||||||
var transformer: MutableList<Transform> = mutableListOf()
|
var transformer: MutableList<Transform> = mutableListOf()
|
||||||
|
var is3D : Boolean = false // 是否支持3D,默认情况下都不支持3D,在数据导入阶段会自动抹去Z轴高程信息
|
||||||
}
|
}
|
||||||
|
|
||||||
class Transform {
|
class Transform {
|
||||||
|
@ -12,6 +12,7 @@ import com.google.gson.reflect.TypeToken
|
|||||||
import com.navinfo.collect.library.data.entity.RenderEntity
|
import com.navinfo.collect.library.data.entity.RenderEntity
|
||||||
import com.navinfo.collect.library.data.entity.TaskBean
|
import com.navinfo.collect.library.data.entity.TaskBean
|
||||||
import com.navinfo.collect.library.enums.DataCodeEnum
|
import com.navinfo.collect.library.enums.DataCodeEnum
|
||||||
|
import com.navinfo.collect.library.utils.GeometryTools
|
||||||
import com.navinfo.omqs.Constant
|
import com.navinfo.omqs.Constant
|
||||||
import com.navinfo.omqs.bean.ImportConfig
|
import com.navinfo.omqs.bean.ImportConfig
|
||||||
import com.navinfo.omqs.db.deep.LinkList
|
import com.navinfo.omqs.db.deep.LinkList
|
||||||
@ -23,6 +24,7 @@ import kotlinx.coroutines.Dispatchers
|
|||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.flow
|
import kotlinx.coroutines.flow.flow
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
import org.locationtech.jts.geom.Geometry
|
||||||
import org.spatialite.database.SQLiteDatabase
|
import org.spatialite.database.SQLiteDatabase
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
@ -173,8 +175,6 @@ class ImportOMDBHelper @AssistedInject constructor(
|
|||||||
.toMutableMap()
|
.toMutableMap()
|
||||||
map["qi_table"] = currentConfig.table
|
map["qi_table"] = currentConfig.table
|
||||||
map["qi_name"] = currentConfig.name
|
map["qi_name"] = currentConfig.name
|
||||||
map["qi_code"] =
|
|
||||||
if (currentConfig.code == 0) currentConfig.code else currentEntry.key
|
|
||||||
map["qi_code"] = if (currentConfig.code == 0) currentConfig.code else currentEntry.key
|
map["qi_code"] = if (currentConfig.code == 0) currentConfig.code else currentEntry.key
|
||||||
map["qi_zoomMin"] = currentConfig.zoomMin
|
map["qi_zoomMin"] = currentConfig.zoomMin
|
||||||
map["qi_zoomMax"] = currentConfig.zoomMax
|
map["qi_zoomMax"] = currentConfig.zoomMax
|
||||||
@ -189,8 +189,26 @@ class ImportOMDBHelper @AssistedInject constructor(
|
|||||||
renderEntity.zoomMin = map["qi_zoomMin"].toString().toInt()
|
renderEntity.zoomMin = map["qi_zoomMin"].toString().toInt()
|
||||||
renderEntity.zoomMax = map["qi_zoomMax"].toString().toInt()
|
renderEntity.zoomMax = map["qi_zoomMax"].toString().toInt()
|
||||||
|
|
||||||
// 其他数据插入到Properties中
|
|
||||||
renderEntity.geometry = map["geometry"].toString()
|
renderEntity.geometry = map["geometry"].toString()
|
||||||
|
// 其他数据插入到Properties中
|
||||||
|
if (!currentConfig.is3D) { // 如果是非3d要素,则自动将Z轴坐标全部置为0
|
||||||
|
val coordinates = renderEntity.wkt?.coordinates?.map {
|
||||||
|
coordinate -> coordinate.z = 0.0
|
||||||
|
coordinate
|
||||||
|
}?.toTypedArray()
|
||||||
|
var newGeometry: Geometry? = null
|
||||||
|
if (renderEntity.wkt?.geometryType == Geometry.TYPENAME_POINT) {
|
||||||
|
newGeometry = GeometryTools.createPoint(coordinates!![0].x, coordinates!![0].y)
|
||||||
|
} else if (renderEntity.wkt?.geometryType == Geometry.TYPENAME_LINESTRING) {
|
||||||
|
newGeometry = GeometryTools.createLineString(coordinates)
|
||||||
|
} else if (renderEntity.wkt?.geometryType == Geometry.TYPENAME_POLYGON) {
|
||||||
|
newGeometry = GeometryTools.createLineString(coordinates)
|
||||||
|
}
|
||||||
|
if (newGeometry!=null) {
|
||||||
|
renderEntity.geometry = newGeometry.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for ((key, value) in map) {
|
for ((key, value) in map) {
|
||||||
when (value) {
|
when (value) {
|
||||||
is String -> renderEntity.properties.put(key, value)
|
is String -> renderEntity.properties.put(key, value)
|
||||||
|
@ -25,8 +25,7 @@ open class RenderEntity() : RealmObject(), Parcelable {
|
|||||||
lateinit var name: String //要素名
|
lateinit var name: String //要素名
|
||||||
lateinit var table: String //要素表名
|
lateinit var table: String //要素表名
|
||||||
var code: String = "0" // 要素编码
|
var code: String = "0" // 要素编码
|
||||||
var geometry: String =
|
var geometry: String = "" // 要素渲染参考的geometry,该数据可能会在导入预处理环节被修改,原始geometry会保存在properties的geometry字段下
|
||||||
"" // 要素渲染参考的geometry,该数据可能会在导入预处理环节被修改,原始geometry会保存在properties的geometry字段下
|
|
||||||
get() {
|
get() {
|
||||||
wkt = GeometryTools.createGeometry(field)
|
wkt = GeometryTools.createGeometry(field)
|
||||||
return field
|
return field
|
||||||
|
@ -146,7 +146,7 @@ public class OMDBDataDecoder extends TileDecoder {
|
|||||||
for (int i = 0; i < length; i++) {
|
for (int i = 0; i < length; i++) {
|
||||||
// double z = longitudeToX(MercatorProjection.pixelXToLongitudeWithScale(MercatorProjection.metersToPixelsWithScale((float) coordinates[i].z, coordinates[i].y, mTileScale), mTileScale))* mTileScale/8;
|
// double z = longitudeToX(MercatorProjection.pixelXToLongitudeWithScale(MercatorProjection.metersToPixelsWithScale((float) coordinates[i].z, coordinates[i].y, mTileScale), mTileScale))* mTileScale/8;
|
||||||
mMapElement.addPoint((float) ((longitudeToX(coordinates[i].x) - mTileX) * mTileScale),
|
mMapElement.addPoint((float) ((longitudeToX(coordinates[i].x) - mTileX) * mTileScale),
|
||||||
(float) ((latitudeToY(coordinates[i].y) - mTileY) * mTileScale), 0);
|
(float) ((latitudeToY(coordinates[i].y) - mTileY) * mTileScale), (float) coordinates[i].z);
|
||||||
}
|
}
|
||||||
|
|
||||||
// int length = removeLast ? coordinates.length - 1 : coordinates.length;
|
// int length = removeLast ? coordinates.length - 1 : coordinates.length;
|
||||||
|
@ -143,7 +143,7 @@ public class OMDBReferenceDecoder extends TileDecoder {
|
|||||||
// 将Z坐标的米转换为屏幕像素坐标
|
// 将Z坐标的米转换为屏幕像素坐标
|
||||||
// double z = longitudeToX(MercatorProjection.pixelXToLongitudeWithScale(MercatorProjection.metersToPixelsWithScale((float) coordinates[i].z, coordinates[i].y, mTileScale), mTileScale))* mTileScale/8;
|
// double z = longitudeToX(MercatorProjection.pixelXToLongitudeWithScale(MercatorProjection.metersToPixelsWithScale((float) coordinates[i].z, coordinates[i].y, mTileScale), mTileScale))* mTileScale/8;
|
||||||
mMapElement.addPoint((float) ((longitudeToX(coordinates[i].x) - mTileX) * mTileScale),
|
mMapElement.addPoint((float) ((longitudeToX(coordinates[i].x) - mTileX) * mTileScale),
|
||||||
(float) ((latitudeToY(coordinates[i].y) - mTileY) * mTileScale), 0);
|
(float) ((latitudeToY(coordinates[i].y) - mTileY) * mTileScale), (float) coordinates[i].z);
|
||||||
}
|
}
|
||||||
|
|
||||||
// int length = removeLast ? coordinates.length - 1 : coordinates.length;
|
// int length = removeLast ? coordinates.length - 1 : coordinates.length;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user