fix-map-error-handler

This commit is contained in:
unknown
2025-08-17 16:25:34 +08:00
parent 9c7a118102
commit 6b2e4b3710

View File

@@ -4145,31 +4145,35 @@ function add_map(user_title, user_topic, user_content, user_style, title_style)
var tmp = [] var tmp = []
var markergeos = [] var markergeos = []
var layergeos = [] var layergeos = []
for (marker in markers) { try{
tmp.push(markers[marker].long) for (marker in markers) {
tmp.push(markers[marker].lat) tmp.push(markers[marker].long)
tmp.push(markers[marker].time) tmp.push(markers[marker].lat)
tmp.push(markers[marker].message) tmp.push(markers[marker].time)
tmp.push(markers[marker].clientid) tmp.push(markers[marker].message)
markergeos.push({ tmp.push(markers[marker].clientid)
"id": markers[marker].clientid + "marker", markergeos.push({
"styleId": "myStyle", "id": markers[marker].clientid + "marker",
"position": new TMap.LatLng(markers[marker].lat, markers[marker].long) "styleId": "myStyle",
}) "position": new TMap.LatLng(markers[marker].lat, markers[marker].long)
layergeos.push({ })
"id": markers[marker].clientid + "layer", layergeos.push({
"styleId": "label", "id": markers[marker].clientid + "layer",
"position": new TMap.LatLng(markers[marker].lat, markers[marker].long), "styleId": "label",
"content": markers[marker].message + " " + markers[marker].time "position": new TMap.LatLng(markers[marker].lat, markers[marker].long),
}) "content": markers[marker].message + " " + markers[marker].time
})
}
if(markergeos.length == 1){
map.setCenter(new TMap.LatLng(markers[0].lat, markers[0].long))
}
title.parent().parent().attr('user-content', tmp.join("@#@$@"))
markerLayer.setGeometries(markergeos)
mapTextLayer.setGeometries(layergeos)
} }
console.log(markergeos) catch(e){
if(markergeos.length == 1){ showtext(e)
map.setCenter(new TMap.LatLng(markers[0].lat, markers[0].long))
} }
title.parent().parent().attr('user-content', tmp.join("@#@$@"))
markerLayer.setGeometries(markergeos)
mapTextLayer.setGeometries(layergeos)
} }
itemdiv.bind(MixIO.actionTags.DATA_MAP_CHANGE, function(event, message) { itemdiv.bind(MixIO.actionTags.DATA_MAP_CHANGE, function(event, message) {
MixIO.publish(topic.text(), JSON.stringify(message)) MixIO.publish(topic.text(), JSON.stringify(message))