From d9193bbb5e400d5b2ff64a402fcd49d2f4519326 Mon Sep 17 00:00:00 2001 From: ann Date: Fri, 24 Feb 2023 17:24:44 +0800 Subject: [PATCH] fix --- src/views/prometheusMonitor/earth.vue | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/views/prometheusMonitor/earth.vue b/src/views/prometheusMonitor/earth.vue index 79e7b14..4ba566e 100644 --- a/src/views/prometheusMonitor/earth.vue +++ b/src/views/prometheusMonitor/earth.vue @@ -172,23 +172,22 @@ export default { // 遍历省份构建模型 const map = new Three.Object3D() chinaJson.features.forEach(elem => { - console.log(elem) // 新建一个省份容器:用来存放省份对应的模型和轮廓线 const province = new Three.Object3D() const coordinates = elem.geometry.coordinates - coordinates.forEach(polygon => { - // multiPolygon.forEach(polygon => { - const lineMaterial = new Three.LineBasicMaterial({ color: 0XF19553 }) // 0x3BFA9E - const positions = [] - const linGeometry = new Three.BufferGeometry() - for (let i = 0; i < polygon.length; i++) { - var pos = this.getPosition(polygon[i][0], polygon[i][1]) - positions.push(pos.x, pos.y, pos.z) - } - linGeometry.setAttribute('position', new Three.Float32BufferAttribute(positions, 3)) - const line = new Three.Line(linGeometry, lineMaterial) - province.add(line) - // }) + coordinates.forEach(multiPolygon => { + multiPolygon.forEach(polygon => { + const lineMaterial = new Three.LineBasicMaterial({ color: 0XF19553 }) // 0x3BFA9E + const positions = [] + const linGeometry = new Three.BufferGeometry() + for (let i = 0; i < polygon.length; i++) { + var pos = this.getPosition(polygon[i][0], polygon[i][1], 100) + positions.push(pos.x, pos.y, pos.z) + } + linGeometry.setAttribute('position', new Three.Float32BufferAttribute(positions, 3)) + const line = new Three.Line(linGeometry, lineMaterial) + province.add(line) + }) }) map.add(province) })