This commit is contained in:
ann 2023-02-24 17:24:44 +08:00
parent 3feccfac9a
commit d9193bbb5e
1 changed files with 13 additions and 14 deletions

View File

@ -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)
})