fix: 修改杆状物渲染为图标样式

This commit is contained in:
2023-09-01 14:24:22 +08:00
parent 8a1d36b117
commit af294bbf50
5 changed files with 64 additions and 30 deletions

View File

@@ -610,26 +610,28 @@ class ImportPreProcess {
// 获取杆状物的高程数据
val geometry = renderEntity.wkt
if (geometry != null) {
var minHeight = Double.MAX_VALUE
var maxHeight = Double.MIN_VALUE
for (coordinate in geometry.coordinates) {
if (coordinate.z < minHeight) {
minHeight = coordinate.z
}
if (coordinate.z > maxHeight) {
maxHeight = coordinate.z
}
}
for (coordinate in geometry.coordinates) {
if (coordinate.z == minHeight) {
coordinate.z = 0.0
}
if (coordinate.z == maxHeight) {
coordinate.z = 40.0
}
}
renderEntity.geometry =
WKTWriter(3).write(GeometryTools.createLineString(geometry.coordinates))
// var minHeight = Double.MAX_VALUE
// var maxHeight = Double.MIN_VALUE
// for (coordinate in geometry.coordinates) {
// if (coordinate.z < minHeight) {
// minHeight = coordinate.z
// }
// if (coordinate.z > maxHeight) {
// maxHeight = coordinate.z
// }
// }
// for (coordinate in geometry.coordinates) {
// if (coordinate.z == minHeight) {
// coordinate.z = 0.0
// }
// if (coordinate.z == maxHeight) {
// coordinate.z = 40.0
// }
// }
// renderEntity.geometry =
// WKTWriter(3).write(GeometryTools.createLineString(geometry.coordinates))
renderEntity.geometry = GeometryTools.createGeometry(GeoPoint(geometry.coordinates[0].y, geometry.coordinates[0].x)).toString()
}
}
@@ -741,4 +743,12 @@ class ImportPreProcess {
Realm.getDefaultInstance().insert(dynamicSrcReference)
}
}
/**
* 向当前renderEntity中添加动态属性
* */
fun obtainDynamicSrc(renderEntity: RenderEntity, prefix: String, suffix: String, codeName: String) {
val code = renderEntity.properties[codeName]
renderEntity.properties["src"] = "${prefix}${code}${suffix}"
}
}