maptalks 开发GIS地图(21)maptalks.three.14 - buildings-vertexcolor
1. Vertex 查了一下意思是 顶点的意思,但是我一直没有理解到底是啥原因,
代码使用的是 threeLayer.toExtrudePolygon,而不是 toExtrudeMesh , 也许
是因为是多边形,所以才会有顶点之说。
2. 代码参考
1 features.forEach(function (g) { 2 var heightPerLevel = 10; 3 var levels = g.properties.levels || 1; 4 var mesh = threeLayer.toExtrudePolygon(maptalks.GeoJSON.toGeometry(g), { 5 height: levels * heightPerLevel, 6 topColor: '#fff' 7 }, material); 8 9 //tooltip test 10 mesh.setToolTip(levels * heightPerLevel, { 11 showTimeout: 0, 12 eventsPropagation: true, 13 dx: 10 14 }); 15 16 //infowindow test 17 mesh.setInfoWindow({ 18 content: 'hello world,height:' + levels * heightPerLevel, 19 title: 'message', 20 animationDuration: 0, 21 autoOpenOn: false 22 }); 23 }
3. 页面显示
4. 源码地址
https://github.com/WhatGIS/maptalkMap/tree/main/threelayer/demo