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

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

View File

@ -173,7 +173,7 @@
"name": "文字",
"zoomMin": 15,
"zoomMax": 20,
"transformer2Code": ""
"transformer": []
},
"3003":{
"table": "OMDB_OBJECT_SYMBOL",
@ -181,7 +181,22 @@
"name": "符号",
"zoomMin": 15,
"zoomMax": 20,
"transformer2Code": ""
"transformer": []
},
"3004":{
"table": "OMDB_OBJECT_ARROW",
"code": 3004,
"name": "箭头",
"zoomMin": 15,
"zoomMax": 20,
"transformer": [
{
"k": "geometry",
"v": "~",
"klib": "geometry",
"vlib": "obtainDynamicSrc('assets:omdb/arrowDirection/','.svg','arrowClass')"
}
]
},
"3005":{
"table": "OMDB_TRAFFIC_SIGN",

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}"
}
}

View File

@ -129,7 +129,7 @@ class PersonalCenterFragment(private var indoorDataListener: ((Boolean) -> Unit?
// 定位到指定位置
niMapController.mMapView.vtmMap.animator()
// .animateTo(GeoPoint( 40.05108004733645, 116.29187746293708 ))
.animateTo(GeoPoint( 40.503796123773355,115.81649866261817))
.animateTo(GeoPoint( 40.50755634913162,115.80235967728436 ))
}
R.id.personal_center_menu_open_all_layer -> {
MapParamUtils.setDataLayerEnum(DataLayerEnum.SHOW_ALL_LAYERS)

View File

@ -1948,16 +1948,19 @@
</m>
</m>
<!-- 杆状物 -->
<m v="OMDB_POLE">
<line stroke="#000000" width="2" cap="butt"></line>
<!-- <line stroke="#000000" width="2" cap="butt"></line>-->
<symbol src="assets:omdb/icon_pole_3006.svg" symbol-height="56" symbol-width="56"></symbol>
</m>
<m v="OMDB_TRAFFIC_SIGN">
<area use="sign-bg" repeat="false" stroke="#ff0000" stroke-width="2"></area>
<m k="type" v="angle">
<line stroke="#00ff00" width="0.1"></line>
</m>
</m>
<!-- 交通标牌 -->
<!-- <m v="OMDB_TRAFFIC_SIGN">-->
<!-- <area use="sign-bg" repeat="false" stroke="#ff0000" stroke-width="2"></area>-->
<!-- <m k="type" v="angle">-->
<!-- <line stroke="#00ff00" width="0.1"></line>-->
<!-- </m>-->
<!-- </m>-->
<m v="OMDB_AREA">
<!-- <area use="sign-bg" repeat="false" src="assets:omdb/veer_side_walk.jpg" stroke="#ff0000" stroke-width="2"></area>
@ -2355,6 +2358,11 @@
<area use="obj-area" stroke="#00000000" repeat="true" src="assets:omdb/object_crosswalk_3014.svg" longEdge="s"></area>
</m>
<!-- 箭头 -->
<m v="OMDB_OBJECT_ARROW">
<area use="obj-area" stroke="#00000000" repeat="false" src="@src" longEdge="s" hasDirect="true"></area>
</m>
<!-- 道路施工 -->
<m v="OMDB_LINK_CONSTRUCTION">
<line stroke="#FF0000" width="1" />

View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><svg id="b" xmlns="http://www.w3.org/2000/svg" width="124.7" height="124.7" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 124.7 124.7"><defs><style>.m{fill:url(#f);}.n,.o{fill:#535a60;}.p{fill:#262d34;isolation:isolate;opacity:.2;}.q{fill:url(#j);filter:url(#k);}.r{fill:url(#g);filter:url(#h);}.o{opacity:0;}</style><linearGradient id="f" x1="58.7" y1="31" x2="66.4" y2="31" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#989898"/><stop offset="0" stop-color="#a3a3a3"/><stop offset=".1" stop-color="#c4c5c5"/><stop offset=".2" stop-color="#d8d9d9"/><stop offset=".3" stop-color="#e0e1e1"/><stop offset=".4" stop-color="#dbdcdc"/><stop offset=".5" stop-color="#cccece"/><stop offset=".6" stop-color="#b5b6b7"/><stop offset=".7" stop-color="#949697"/><stop offset=".8" stop-color="#6a6c6f"/><stop offset=".8" stop-color="#3f4246"/><stop offset="1" stop-color="#404247"/><stop offset="1" stop-color="#43434a"/></linearGradient><linearGradient id="g" x1="776.5" y1="39.3" x2="788.4" y2="39.3" gradientTransform="translate(-720)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#11627b"/><stop offset=".1" stop-color="#0b788d"/><stop offset=".3" stop-color="#00a4b1"/><stop offset=".4" stop-color="#039aa9"/><stop offset=".5" stop-color="#068b9d"/><stop offset=".8" stop-color="#11627b"/></linearGradient><filter id="h" filterUnits="userSpaceOnUse"><feOffset dx="0" dy="1"/><feGaussianBlur result="i" stdDeviation=".3"/><feFlood flood-color="#000" flood-opacity=".2"/><feComposite in2="i" operator="in"/><feComposite in="SourceGraphic"/></filter><linearGradient id="j" x1="-396.1" y1="15.6" x2="-408" y2="15.6" gradientTransform="translate(-339.8) rotate(-180) scale(1 -1)" xlink:href="#g"/><filter id="k" filterUnits="userSpaceOnUse"><feOffset dx="0" dy="1"/><feGaussianBlur result="l" stdDeviation=".3"/><feFlood flood-color="#000" flood-opacity=".2"/><feComposite in2="l" operator="in"/><feComposite in="SourceGraphic"/></filter></defs><g id="c"><g><rect class="o" y="0" width="124.7" height="124.7"/><g><ellipse id="d" class="p" cx="62.4" cy="61.3" rx="14.4" ry="3.7"/><ellipse id="e" class="n" cx="62.4" cy="61.3" rx="7.5" ry="3"/><path class="m" d="M59.4,0h6C66.1,0,66.6,.6,66.6,1.3V58.7c0,1.9-1.5,3.4-3.4,3.4h-1.8c-1.9,0-3.4-1.5-3.4-3.4V1.3C58.1,.6,58.7,0,59.4,0Z"/></g><path class="r" d="M68.4,46.8s-1.1,.7-5.8,.7-6.2-.7-6.2-.7v-14.7s.7-1,6.2-1,5.8,1,5.8,1v14.7Z"/><path class="q" d="M56.3,23.2s1.1,.7,5.8,.7,6.2-.7,6.2-.7V8.4s-.7-1-6.2-1-5.8,1-5.8,1v14.7Z"/></g></g></svg>

After

Width:  |  Height:  |  Size: 2.5 KiB